Automated Threat Modeling

Brief Summary: D-Link DSL-2640B CVE-2026-138290 IP Filter OS Command Injection (with PoC)

A brief summary of CVE-2026-138290, an OS command injection in the D-Link DSL-2640B IP Filter functionality, including the publicly disclosed proof of concept and its verification caveats.

CVE Analysis

9 min read

Gaurav Sarraf
Gaurav Sarraf

2026-11-29

Brief Summary: D-Link DSL-2640B CVE-2026-138290 IP Filter OS Command Injection (with PoC)

Introduction

The D-Link DSL-2640B is a discontinued DSL gateway whose US support ended in 2013, yet units remain in service at the edge of home and small office networks. A newly published vulnerability, CVE-2026-138290, shows how its IP Filter configuration turns attacker-supplied firewall rule values into shell command arguments. It carries a maximum published CVSS 3.1 score of 10.0.

The affected device is a consumer and small business DSL router built on the Broadcom BCM6348 platform. D-Link is an international networking supplier with 90 operating and sales locations across 43 countries, but corporate reach does not imply ongoing security maintenance for a product that reached end of support more than a decade ago. That lifecycle gap is central to both the risk and the response here.

Technical Information

The vulnerability resides in the IP Filter handling of the /bin/cfm web management CGI dispatcher on the DSL-2640B. The researcher's tested platform is hardware revision A, board D-4P-W, using BCM6348, with firmware image GE_DSL-2640B_306041G00_cfe_fs_kernel corresponding to firmware 3.0.6.0.41. The NVD record classifies the weakness under CWE-77 and CWE-78 and names srcAddr, while the research describes a broader problem spanning multiple address and port fields.

The two vulnerable endpoints are:

  • GET /scoutflt.cmd?action=add (outgoing IP filter)
  • GET /scinflt.cmd?action=add (incoming IP filter)

Both accept the parameters fltName, protocol, srcAddr, srcMask, srcPort, dstAddr, dstMask, and dstPort.

Root cause

The IP filter handlers store up to eight attacker-controlled strings in fixed-size char[16] entry structures without any address or port format validation. According to the disclosure, there is no inet_addr() or inet_aton() call in the cgiScOutFltAdd to SecFltOutTbl path; only the mask is converted. Because nothing normalizes or rejects malformed values, invalid input survives the request and is persisted into the firewall configuration.

When the filter policy is later applied, the stored strings are concatenated directly into an iptables command line and executed under /bin/sh -c via bcmSystemNoHang(). The disclosure documents the reconstructed sink for the outgoing filter from /bin/cfm:

/* SecFltOutTbl::executeCommand() — outgoing filter */ sprintf(part, "-s %s", entry->srcAddr); /* 0x4ede2c */ sprintf(part, "--sport %s", entry->srcPort); /* 0x4ede34 */ sprintf(cmd, "iptables -%c FORWARD -i %s -p tcp %s %s %s %s -j DROP", op, ifc, ...); /* 0x4ede60 */ bcmSystemNoHang(cmd); /* /bin/sh -c */

Call chain

The reconstructed outgoing filter call chain is:

webmain()@0x47d6f0 -> do_cmd_cgi()@0x496b90 -> cgiScOutFlt()@0x48e878 -> cgiScOutFltAdd()@0x48e65c -> BcmScm_addFilterOut()@0x45d180 -> SecFltOutTbl::set()/executeCommand()

The rule is executed via the WAN monitor path:

BcmWan_monitorInterfaces()@0x44e1bc -> doIpGlobalPolicy() -> SecFltOutTbl::doPolicy()@0x462ec4

Incoming rules pass through corresponding incoming filter handling and runiptables(). The structural detail that matters is that accepting a filter entry and executing the resulting rule are separate events. The action=save operation persists and redisplays entries but does not execute them. Execution depends on WAN policy processing such as WAN state changes or configuration application, which runs on any operational device.

Attack flow

An attacker who can reach the web management interface submits a crafted IP filter entry where an address field (for example srcAddr) contains shell metacharacters. The handler accepts the GET request, returns HTTP 200, and stores the raw payload in the fixed-size entry structure. Later, when the WAN monitor applies the global policy (on a WAN state change or configuration application), the stored string is spliced into the iptables command line and passed to /bin/sh -c. At that point the injected command runs with the privileges of the policy engine.

The disclosure also notes a secondary buffer overflow primitive classified under CWE-121: srcAddr sits only 0x80 bytes below the saved $ra in the 0x1b8 byte frame of cgiScOutFltAdd(), so over-long values corrupt the entry structure and saved registers. This observation should not be treated as a separately validated memory corruption exploit for this command injection CVE.

Scoring context

Published scores do not fully agree. The NVD record carries a CNA-supplied CVSS 3.1 vector of AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H (10.0 Critical), while the researcher's own stated vector is AV:A/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (8.8 High), reflecting an adjacent network and unchanged scope assumption. VulDB publishes a temporal score of 9.1. These differences do not eliminate the reported injection path. They limit how confidently prerequisites and demonstrated outcomes can be stated.

Proof of Concept

A public, non-destructive proof of concept is published in the researcher's GitHub disclosure repository (dujiaode/DSL2640B, directory 04-scoutflt-scinflt-filter-cmd-injection) and associated with the CVE through VulDB entry 445115. Note that the repository README still labels the issue "CVE-TBD"; the CVE-2026-138290 association is established through VulDB and NVD, not the README itself.

Authentication uses a hardcoded account (asus:00202b004720), which makes exploitation effectively unauthenticated despite requests without credentials returning HTTP 401.

Step 1: Store the payload (verified)

curl -s -o /dev/null -w '%{http_code}\n' -u 'asus:00202b004720' --get \ --data-urlencode 'action=add' \ --data-urlencode 'fltName=g7' \ --data-urlencode 'protocol=1' \ --data-urlencode 'srcAddr=;mkdir /var/q1;#' \ --data-urlencode 'srcPort=1' \ --data-urlencode 'dstAddr=0.0.0.0' \ --data-urlencode 'dstPort=1' \ http://127.0.0.1:18741/scoutflt.cmd # 200

Storage verification:

curl -s -u 'asus:00202b004720' 'http://127.0.0.1:18741/scoutflt.cmd?action=view' | grep -c g7 # 2

Step 2: Rule application

On a device with a live WAN interface, the policy engine applies the stored rule automatically, executing the following command line:

iptables -A FORWARD -i br0 -p tcp -s ;mkdir /var/q1;# --sport 1 -d 0.0.0.0 --dport 1 -j DROP

Verification status and caveat

The author verified entry storage dynamically: HTTP 200 with the payload persisted and visible in action=view. Control tests confirmed that no credentials yields 401 and no storage, a benign srcAddr=1.2.3.4 yields 200 and is stored, and action=save alone does not execute rules (storage only). Final command execution was not demonstrated in the rehosted and emulated lab because that environment lacked a WAN interface, so the policy engine did not run and the /var/q1 marker was not created. Execution on real hardware is inferred from the reconstructed WAN monitor code path rather than directly observed.

Affected Systems and Versions

  • Product: D-Link DSL-2640B
  • Firmware: 3.0.6.0.41
  • Tested hardware: revision A, board D-4P-W, BCM6348, firmware image GE_DSL-2640B_306041G00_cfe_fs_kernel
  • Affected component: IP Filter functionality in the /bin/cfm web management CGI dispatcher
  • Affected endpoints: /scoutflt.cmd (outgoing) and /scinflt.cmd (incoming)

The report describes other models as potentially sharing the code but does not establish them as tested targets for this CVE. Earlier Raelize research on the DSL-2640B concerned revision Bx and EU_4.01B firmware, a different hardware and firmware branch from the revision A and 3.0.6.0.41 analyzed here. These cases show recurring exposure around the product family rather than proof that the vulnerabilities or firmware branches are identical.

Vendor Security History

The DSL-2640B family has a documented record of recurring lifecycle exposure. D-Link's historical advisory records US support ending on May 5, 2013 and states that firmware development has ceased, directing owners of the European firmware discussed there to their regional D-Link office. Raelize reported DSL-2640B findings affecting firmware available as of March 27, 2020, which had been reported to D-Link and had no known security fix at publication.

More broadly, in July 2019 D-Link Systems, Inc. agreed to implement a comprehensive software security program to settle FTC allegations about security representations for routers and Internet connected cameras. The announced requirements included security planning, threat modeling, testing before release, ongoing vulnerability monitoring, automatic firmware updates, acceptance of researcher reports, and 10 years of independent assessments conducted every two years. This documents a security governance obligation but does not establish delivery of a fix for an unsupported DSL-2640B. A separate active exploitation report exists for CVE-2026-0625, a DNS configuration endpoint issue on legacy DSL-2640B devices. It strengthens the general case for retiring unsupported equipment but is a distinct vulnerability from the IP Filter path analyzed here.

References

Detect & fix
what others miss

Works with
  • GitHub
  • GitLab
  • Bitbucket
  • Azure DevOps Services
  • Gerrit
  • CVS
  • Jira
  • Linear
  • Slack
  • Security Compass
Explore integrations
Security magnifying glass visualization