CVE-2022-22241: Juniper SSLVPN / JunOS RCE and Multiple Vulnerabilities
Multiple vulnerabilities in Juniper JunOS J-Web, including a pre-authenticated PHP phar deserialization that can lead to remote code execution, a reflected XSS, XPath injection, path traversal in file upload, and local file inclusion. An unauthenticated attacker could exploit the phar deserialization to write arbitrary files and potentially execute code, while other flaws require authentication or chaining.
Published on octagon.net
The following software releases have been updated to resolve these specific issues: Junos OS 19.1R3-S9, 19.2R3-S6, 19.3R3-S7, 19.4R3-S9, 20.1R3-S5, 20.2R3-S5, 20.3R3-S5, 20.4R3-S4, 21.1R3-S2, 21.2R3-S1, 21.3R2-S2, 21.3R3, 21.4R1-S2, 21.4R3, 22.1R1-S1, 22.1R2, 22.2R1, and all subsequent releases. The Juniper advisory…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the root cause is missing authentication checks and improper input validation in multiple PHP scripts, allowing user-controlled input to reach dangerous functions like deserialization, XPath queries, file operations, and file inclusion.
What the attacker needed
Network access to J-Web; For some bugs, a low-privileged account; Victim interaction for XSS
The fix
The vulnerabilities were fixed in the listed Junos OS releases; as a workaround, disable J-Web or limit access to trusted hosts.
How it was found
- Send a POST request to /jsdm/ajax/logging_browse.php with the filepath parameter pointing to a phar file.
- The phar file can be a local image uploaded through the image upload portal, a cache file, or a remote file uploaded via the unauthenticated upload page.
- For the XSS, access /error.php with a crafted SERVER_NAME parameter.
- For XPath injection, send a request to /jsdm/ajax/wizards/setup/setup.php with a cmd parameter.
- For path traversal, upload a file with a filename containing backslashes to bypass check_filename and write to an arbitrary location.
- For local file inclusion, send a request to /jrest.php with a crafted query string to include an arbitrary PHP file.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
This report describes several security holes in Juniper's JunOS web interface. The most serious one lets an attacker who has not logged in trick the server into running harmful code by sending a specially crafted file path. Other bugs let logged-in users do things like inject commands or upload files to unintended places.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.