
CVE Reproduction: cve-2024-0012_9474-panos_authbypass_reproduction
| CVE | Description | CVSS |
|---|---|---|
| CVE-2024-0012 | PAN-OS Management Interface Authentication Bypass | 9.3 |
| CVE-2024-9474 | PAN-OS Privilege Escalation | 6.9 |
When chained, these vulnerabilities allow unauthenticated remote code execution on the PAN-OS management web interface.
Both were actively exploited as zero-days in the wild under what has been tracked as Operation Lunar Peek. The research was initially disclosed by watchTowr.
The Palo Alto Networks PAN-OS management web interface is exposed to two critical flaws that, when combined, give an attacker full root-level access without any authentication:
The management web interface improperly validates authentication for certain API and PHP endpoints. By manipulating HTTP request paths (e.g. path traversal or double-slash techniques), an attacker can reach restricted handlers that normally require a valid session. This effectively grants unauthenticated access to the PHPRESTAPI and other internal endpoints.
The root cause lies in the Nginx/Apache routing rules that fail to enforce session checks on specific URI patterns, allowing requests to bypass the authentication middleware.
Once authenticated (even as a read-only or low-privileged user), the vulnerability exists in the PHP session serialisation mechanism. The session.save_path is misconfigured, and the session filename is partially user-controlled. By crafting a session ID containing path-traversal sequences, an attacker can write a PHP session file to an arbitrary location (e.g. ../utils/webshell.php).
Because the web server runs as root, the written file inherits root ownership, giving the attacker a root-level webshell.
Attacker (unauthenticated)
│
├─ CVE-2024-0012 ─────────────────────────────┐
│ Bypass auth via crafted URI │
│ → Gain access to PHPRESTAPI endpoint │
│ → Create a low-privilege API key / session │
└──────────────────────────────────────────────┘
│
├─ CVE-2024-9474 ─────────────────────────────┐
│ Use obtained session/key │
│ → Send crafted PHP session ID (path traversal)│
│ → Write session file to webroot │
│ → File contains PHP code (webshell) │
└──────────────────────────────────────────────┘
│
▼
RCE as root via webshell
X-PAN- or cookie-based session ID containing ../ traversal to write a PHP payload to the web-accessible php/ directory./php/<shell>.php to execute arbitrary commands as root.See exploit.py in this directory for a working proof-of-concept that chains both CVEs.
| PAN-OS Version | Affected | Fixed In |
|---|
| 10.2 | < 10.2.12-h2 | 10.2.12-h2 |
| 11.0 | < 11.0.6-h1 | 11.0.6-h1 |
| 11.1 | < 11.1.5-h1 | 11.1.5-h1 |
| 11.2 | < 11.2.4-h1 | 11.2.4-h1 |
| 11.3 | Not affected | — |
| Cloud NGFW | Not affected | — |