cbcvebase.
CVE-2023-36845
published 2023-08-17

CVE-2023-36845: A PHP External Variable Modification vulnerability in J-Web of Juniper Networks Junos OS on EX Series and SRX Series allows an unauthenticated, network-based…

PriorityP1100critical9.8CVSS 3.1
AVNACLPRNUINSUCHIHAH
KEVITWEXPLOITInitial access
CISA Known Exploited Vulnerabilitydue 2023-11-17
Exploited in the wild
EPSS
93.55%
99.8th percentile
A PHP External Variable Modification vulnerability in J-Web of Juniper Networks Junos OS on EX Series and SRX Series allows an unauthenticated, network-based attacker to remotely execute code. Using a crafted request which sets the variable PHPRC an attacker is able to modify the PHP execution environment allowing the injection und execution of code. This issue affects Juniper Networks Junos OS on EX Series and SRX Series: * All versions prior to 20.4R3-S9; * 21.1 versions 21.1R1 and later; * 21.2 versions prior to 21.2R3-S7; * 21.3 versions prior to 21.3R3-S5; * 21.4 versions prior to 21.4R3-S5; * 22.1 versions prior to 22.1R3-S4; * 22.2 versions prior to 22.2R3-S2; * 22.3 versions prior to 22.3R2-S2, 22.3R3-S1; * 22.4 versions prior to 22.4R2-S1, 22.4R3; * 23.2 versions prior to 23.2R1-S1, 23.2R2.

Affected

25 ranges
VendorProductVersion rangeFixed in
juniperex_series
juniperj-web
juniperjunos< 20.420.4
juniperjunos
juniperjunos
juniperjunos
juniperjunos
juniperjunos
juniperjunos
juniperjunos
juniperjunos
juniperjunos
juniperjunos
juniperjunos_os
junipersrx_series
juniper_networksjunos_os< 20.4R3-S920.4R3-S9
juniper_networksjunos_os>= 21.1 < 21.1*21.1*
juniper_networksjunos_os>= 21.2 < 21.2R3-S721.2R3-S7
juniper_networksjunos_os>= 21.3 < 21.3R3-S521.3R3-S5
juniper_networksjunos_os>= 21.4 < 21.4R3-S521.4R3-S5
juniper_networksjunos_os>= 22.1 < 22.1R3-S422.1R3-S4
juniper_networksjunos_os>= 22.2 < 22.2R3-S222.2R3-S2
juniper_networksjunos_os>= 22.3 < 22.3R2-S2, 22.3R3-S122.3R2-S2, 22.3R3-S1
juniper_networksjunos_os>= 22.4 < 22.4R2-S1, 22.4R322.4R2-S1, 22.4R3
juniper_networksjunos_os>= 23,2 < 23.2R1-S1, 23.2R223.2R1-S1, 23.2R2

Detection & IOCsextracted from sources · hover to see the quote

url/webauth_operation.php
url/webauth_operation.php?PHPRC=/var/tmp/{{inifile}}
path/var/tmp/
path/dev/fd/0
commandcurl 'localhost/cgi-bin/app.cgi?PHPRC=/dev/fd/0' --data "data=allow_url_include%3D1%0Aauto_prepend_file%3D%22data%3A%2F%2Ftext%2Fplain%3Bbase64%2CPD8gc2hlbGxfZXhlYygiaWQgPiAvdG1wLzEiKTsgPz4%3D%22"
commandrs=do_upload&rsargs[]=[{"fileData": "data:text/html;base64,{{base64(payload)}}", "fileName": "{{rand_base(5, "abc")}}.php", "csize": {{len(payload)}}}]
otherPHPRC=/dev/fd/0
otherallow_url_include=1 auto_prepend_file="data://text/plain;base64,PD9waHAgZXZhbCgkX1BPU1RbJ2MnXSk7Pz4="
sigma
shodan-query: title:"Juniper Web Device Manager"
  • Detect HTTP requests to /webauth_operation.php containing the PHPRC parameter in the query string or POST body, especially pointing to /dev/fd/0 or /var/tmp/ paths.
  • Detect HTTP requests where the PHPRC variable is set to /dev/fd/0, enabling stdin-based PHP config injection without file upload.
  • Detect POST bodies to J-Web endpoints containing 'allow_url_include' and 'auto_prepend_file' directives, particularly with data:// URI schemes including base64-encoded payloads.
  • Detect HTTP requests to /webauth_operation.php with POST parameter 'rs=do_upload' and rsargs[] containing fileData with data:text/html;base64 and .php or .ini filenames — indicative of the watchTowr two-file exploit chain.
  • Monitor for Juniper J-Web interfaces (title:'Juniper Web Device Manager') exposed on the internet via Shodan/Censys as a discovery indicator for vulnerable devices.
  • The fileless RCE exploit can be delivered in a single curl command without uploading files; look for HTTP requests to J-Web CGI endpoints with URL-encoded 'allow_url_include' and 'auto_prepend_file' in POST data.
  • The Metasploit module exploits this via /dev/fd/0 as PHPRC and uses data:// protocol with base64-encoded PHP payload in auto_prepend_file; detect these patterns in HTTP request bodies targeting Junos J-Web.
  • ·The single-CVE fileless exploit (CVE-2023-36845 alone) does not require file upload and bypasses the need for CVE-2023-36846; it affects older devices that lack the do_fileUpload() function, broadening the vulnerable population beyond the original chained exploit.
  • ·The Metasploit JAIL_BREAK option attempts to steal tokens from an authenticated J-Web user to overwrite the root password hash and then authenticate via SSH; if no user is authenticated, it attempts to create one — this secondary stage requires SSH access and may leave forensic artifacts in /etc/master.passwd.

CVSS provenance

nvdv3.19.8CRITICALCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
vulncheck9.8CRITICAL
cisa9.8CRITICAL
CVEs like this are exactly what “Exploited This Week” covers.

Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.