Juniper JunOS RCE Flaw

The J-Web component of Juniper Networks’ Junos OS has been discovered to contain a number of vulnerabilities, one or more of which may allow remote code execution, cross-site scripting attacks, route injection, traversal, or local file inclusion.

According to Octagon Networks, “Chief among them is a remote pre-authenticated PHP archive file deserialization vulnerability (CVE-2022-22241, CVSS score: 8.1) in the J-Web component of Junos OS”.

Details of Vulnerabilities

CVE-2022-22241: Remote pre-authenticated Phar Deserialization to RCE- (CVSS score: 8.1)

“An Improper Input Validation vulnerability in the J-Web component of Juniper Networks Junos OS may allow an unauthenticated attacker to access data without proper authorization”, Juniper Networks

EHA

When parsed by a PHP file operation function, the metadata in Phar files (PHP Archive) files is deserialized because it is stored in a serialized format. 

Reports say this behavior can be abused by an attacker to take advantage of a Juniper codebase object instantiation vulnerability.

Notably, deserialization will take place even using PHP functions that do not eval PHP code like file_get_contents(), fopen(), file() or file_exists(), md5_file(), filemtime() or filesize(), is_dir(), if user input is passed to the functions.

An unauthenticated remote attacker can make use of this vulnerability to have remote phar files deserialized, which results in arbitrary file writing and a remote code execution (RCE) vulnerability.

CVE-2022-22242: pre-authenticated reflected XSS on the error page- (CVSS score: 6.1)

This is a Cross-site Scripting (XSS) vulnerability found in the J-Web component of Juniper Networks Junos OS allows an unauthenticated attacker to run malicious scripts reflected off of J-Web to the victim’s browser in the context of their session within J-Web.

This flaw can be used with other vulnerabilities that require authentication or allow a remote unauthenticated attacker to steal JunOS admin sessions.

CVE-2022-22243– (CVSS score: 4.3) and & CVE-2022-22244 – (CVSS score: 5.3): XPATH Injection

It is an XPath Injection vulnerability caused due to Improper Input Validation in the J-Web component of Juniper Networks Junos OS. 

This allows an attacker to add an XPath command to the XPath stream that let chaining to other unspecified vulnerabilities, leading to a partial loss of confidentiality.

It can be exploited by a remote authenticated attacker to manipulate JunOS admin sessions or manipulate the XPATH stream that the server uses to talk with its XML parsers.

CVE-2022-22245: Path traversal during file upload leads to RCE – (CVSS score: 4.3)

This is a Path Traversal vulnerability in the J-Web component of Juniper Networks Junos OS. It allows attackers to upload arbitrary files to the device by bypassing validation checks built into Junos OS. 

The successful exploitation of this vulnerability could lead to loss of filesystem integrity. Reports say this flaw can be exploited by attackers to execute PHP code by uploading a file with a special name.

CVE-2022-22246: PHP Local File Inclusion (LFI) vulnerability – (CVSS score: 7.5)

This PHP Local File Inclusion (LFI) vulnerability was found in the J-Web component of Juniper Networks Junos OS. This may allow a low-privileged authenticated attacker to execute an untrusted PHP file. The successful exploitation could lead to a complete system compromise.

Fix Available

The issues are addressed in Junos OS versions 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.3R3, 21.4R3, 22.1R2, 22.2R1, and later.

Therefore, the users are recommended to apply the software patch available for Junos OS as early as possible to prevent the abovementioned threats.

Posted by Charlie