# CVE-2025-21590: Junos OS shell-to-code flaw, used to backdoor MX routers

A kernel isolation flaw lets an attacker with root shell access run code on a Junos OS device and get around its binary protections. Exploited by the China-nexus group UNC3886 since mid-2024 and on CISA's KEV list; no public proof of concept is confirmed.

- Vendor: Juniper Networks, Junos OS (kernel, shell access)
- Severity: MEDIUM (CVSS 4.0 6.7)
- Exploited (CISA KEV): yes, added 2025-03-13
- EPSS: 1.7% on 2026-12-02
- Public exploit: none reported
- Patch available: yes
- Vendor advisory: JSA93446, https://supportportal.juniper.net/JSA93446
- Published: 2025-03-12; updated: 2026-10-18
- Page: https://patchtonight.com/cve/CVE-2025-21590/

## Affected and fixed versions

| Affected | Fixed in |
| --- | --- |
| Junos OS before 21.2R3-S9 | 21.2R3-S9 or later (use 21.2R3-S9.21; S9.20 was incomplete) |
| Junos OS 21.4 | 21.4R3-S10 or later |
| Junos OS 22.2 | 22.2R3-S6 or later |
| Junos OS 22.4 | 22.4R3-S6 or later |
| Junos OS 23.2 | 23.2R2-S3 or later |
| Junos OS 23.4 | 23.4R2-S4 or later |
| Junos OS 24.2 | 24.2R1-S2, 24.2R2 or later |

## What it is

Junos OS is built on FreeBSD. Its **veriexec** feature stops unauthorized binaries from running. CVE-2025-21590 is a kernel flaw (improper isolation, CWE-653) that lets an attacker with **high privileges and shell access** inject code and compromise the device. It can't be triggered from the Junos CLI. Amazon found it in its own security research.

The CVSS 4.0 score is only 6.7 (medium) because the attacker needs local, privileged access. Don't let that set your priority. Mandiant reported that UNC3886, a China-nexus espionage group, used it against **Juniper MX routers on end-of-life hardware and software** from mid-2024. The attackers already had legitimate credentials, taken from a terminal server used to manage network devices. They went from the Junos CLI to the FreeBSD shell and had root.

To get past veriexec, they injected shellcode into a trusted process (a hung `cat`) rather than run a new binary. That loaded the `lmpad` backdoor. Mandiant found six TINYSHELL-based backdoors in all, some of which disable logging and delete log entries. Juniper says at least one exploitation was reported to its SIRT. CISA lists the CVE in KEV; its entry gives known ransomware use as unknown.

## Am I affected?

You're affected if you run **Junos OS older than**:

- 21.2R3-S9 (only 21.2R3-S9.21 is a complete fix; S9.20 was not)
- 21.4R3-S10
- 22.2R3-S6
- 22.4R3-S6
- 23.2R2-S3
- 23.4R2-S4
- 24.2R1-S2 or 24.2R2

Release 24.4R1 and later are fixed. The CVE record also lists **platform exceptions**, where the fix is not in every platform in the releases above:

- SRX300 Series: 21.2R3-S9, 23.4R2-S5 (future release) or 24.4R1
- SRX550HM: 22.2R3-S7 (future release)
- EX4300 Series: 21.4R3-S11 (future release), except EX4300-48MP
- EX4600: 21.4R3-S11 (future release), except EX4650
- ACX1000, ACX1100, ACX2100, ACX2200, ACX4000, ACX500 and MX104: 21.2R3-S9

Real-world risk is highest where **an attacker can reach a Junos shell**: shared or weakly protected admin credentials, exposed terminal servers, and end-of-life MX routers.

## What to do

1. **Upgrade** to a fixed release for your branch. On the 21.2 branch, use 21.2R3-S9.21, not S9.20. If the fix for your platform is a "future release", apply step 2 and track Juniper's advisory.
2. **Restrict shell access to trusted users only.** This is Juniper's workaround. Mandiant adds centralized authentication with MFA and role-based access for device management, plus segmentation of the management network and the terminal servers that reach it.
3. **After upgrading, run the Juniper Malware Removal Tool (JMRT)** Quick Scan and Integrity Check, as Mandiant recommends. Get the tool and its instructions from Juniper.
4. **If a device was reachable by attackers while vulnerable,** treat it as possibly compromised and check it against the indicators below. If you find a match, isolate it, reimage it from a clean image, and rotate every credential it held or that managed it, including terminal-server and TACACS+ accounts. Mandiant also saw a backdoored TACACS+ daemon on Linux hosts in this campaign.
5. **Replace end-of-life routers.** The observed targets were out of support.

## Detection

The lmpad backdoor turns off logging and deletes traces, so **missing logs are a signal too**. Mandiant reports these behaviours:

- **Files and paths:** `/var/tmp/pfed_jdhcp6_trace.log`, `/var/tmp/rts`, `/var/tmp/ldb*`, `/var/rundb+`, `/usr/lib/libjucomm.so.1`, `/config/usage_db`, and a named pipe called `null` in a working directory.
- **Look-alike daemons:** `appid`, `to`, `irad`, `lmpad`, `jdosd` and `oemd`, which mimic `appidd`, `top`, `irsd`, `lmpd`, `jddosd` and `oamd`. Compare hashes with the indicators above.
- **Listening ports:** UDP 33615 (lmpad), UDP 33512 (jdosd), TCP 31234 (irad), and TCP or UDP 45678 (oemd default).
- **Outbound connections on TCP 22** to the C2 addresses listed above.
- **Log tampering:** `syslog.conf` entries redirected to `/dev/null`, gaps in `/var/log/messages`, `/var/log/auth` or `interactive-commands`, and suppressed SNMP traps.
- **Network signatures:** Mandiant published Snort/Suricata rules for the backdoors' UDP and ICMP triggers, and YARA rules (`M_Hunting_TINYSHELL_5`, `M_Hunting_PacketEncryptionLayer_1`). Get them from its report.

## Sources

- [Juniper advisory JSA93446](https://supportportal.juniper.net/JSA93446)
- [CVE record for CVE-2025-21590](https://cveawg.mitre.org/api/cve/CVE-2025-21590)
- [CISA Known Exploited Vulnerabilities catalog entry](https://www.cisa.gov/known-exploited-vulnerabilities-catalog?field_cve=CVE-2025-21590)
- [Google Threat Intelligence (Mandiant) report on UNC3886 and Juniper routers](https://cloud.google.com/blog/topics/threat-intelligence/china-nexus-espionage-targets-juniper-routers)

---

Data from PatchTonight (https://patchtonight.com), compiled from vendor advisories, CISA KEV and FIRST EPSS. Please credit PatchTonight and link to the CVE page when you use it.
