CVE-2026-0625: Unauthenticated RCE in D-Link DSL Gateways via dnscfg.cgi

D-Link DSL Gateways — Unauthenticated Command Injection in dnscfg.cgi

CVE ID: CVE-2026-0625
Affected Products: D-Link DSL Series Gateways
Vulnerability Class: OS Command Injection
Affected Component: Embedded Web Interface (dnscfg.cgi)
Authentication Required: No
User Interaction: None
Attack Vector: Network (HTTP)
Exploit Complexity: Low

Severity Summary

  • CVSS v3.x: 9.8 (Critical)
  • CVSS v4.0: 9.3 (Critical)
  • Impact: Full device compromise (root-level RCE)
  • Exploit Status: Observed active exploitation
  • Primary Risk: DNS hijacking, persistent compromise, network pivoting

Vulnerability Overview

CVE-2026-0625 is a critical remote command execution vulnerability in multiple D-Link DSL gateway models. The flaw exists in the router’s embedded web management interface, specifically in the dnscfg.cgi endpoint responsible for configuring DNS resolver settings.

The CGI script accepts user-controlled input via HTTP requests and improperly passes that input to underlying system utilities responsible for updating network configuration. Due to missing input validation and lack of command sanitization, shell metacharacters supplied in DNS parameters are interpreted by the operating system shell.

Because the endpoint is exposed without authentication, an attacker does not require credentials or prior access to exploit the vulnerability. When the management interface is reachable from the WAN, exploitation can occur directly from the internet.


Affected Devices and Firmware Scope

The vulnerability impacts several D-Link DSL gateway families, including:

  • DSL-2640B
  • DSL-2740R
  • DSL-2780B
  • DSL-526B

The exposure depends on firmware version, hardware revision, and regional build. Many impacted firmware versions are end-of-life, meaning no automatic security updates are available and devices remain permanently vulnerable unless replaced.


Technical Root Cause Analysis

At the implementation level, the vulnerability stems from unsafe construction of shell commands in the DNS configuration workflow:

  1. HTTP parameters are parsed directly by dnscfg.cgi.
  2. DNS values are concatenated into system command strings.
  3. Input is not validated against strict IP address or hostname formats.
  4. No escaping or whitelisting is applied.
  5. Commands execute with elevated (root) privileges.

The router firmware relies on BusyBox-based utilities and legacy CGI handlers, making this class of vulnerability particularly dangerous due to the high privilege context of network configuration operations.


Exploitation Characteristics

Described strictly for detection and defense.

  • Exploitation occurs via crafted HTTP requests targeting dnscfg.cgi.
  • Requests typically use POST but may also use GET depending on firmware.
  • DNS parameters are abused as the injection vector.
  • Successful exploitation does not disrupt device availability immediately, making attacks stealthy.
  • Persistence is often achieved by modifying startup scripts or cron jobs.

Post-Exploitation Impact

Once compromised, attackers can:

  • Redirect all client DNS traffic to attacker-controlled resolvers
  • Inject malicious responses or phishing redirects
  • Intercept plaintext traffic via DNS manipulation
  • Install persistent backdoors
  • Use the gateway as a staging point for internal network attacks
  • Enroll the device into botnets or proxy networks

Because routers sit upstream of all connected devices, compromise affects every endpoint behind them.


MITRE ATT&CK Mapping

Initial Access

  • T1190 – Exploit Public-Facing Application

Execution

  • T1059 – Command and Scripting Interpreter

Persistence

  • T1547 – Boot or Logon Autostart Execution

Lateral Movement

  • T1210 – Exploitation of Remote Services

Impact

  • T1565 – Data Manipulation (DNS)

Detection Guidance

Recommended Log Sources

  • Router HTTP access logs
  • Firewall or reverse proxy logs
  • IDS/IPS (Suricata, Zeek)
  • DNS logs (internal resolvers, upstream providers)
  • NetFlow / traffic telemetry from gateways

Splunk Detection Queries

The following queries are defensive detection logic only and intentionally avoid exploit payloads.

1. Detect Access to dnscfg.cgi

index=network OR index=proxy OR index=firewall
uri_path="/dnscfg.cgi"
| stats count by src_ip, dest_ip, http_method, user_agent
| sort -count

Purpose:
Identifies any access to the vulnerable CGI endpoint. Any access from non-administrative IP ranges should be treated as suspicious.


2. Detect External Access to Router Management Interface

index=firewall OR index=proxy
dest_port IN (80,443)
uri_path="/dnscfg.cgi"
NOT cidrmatch("192.168.0.0/16", src_ip)
NOT cidrmatch("10.0.0.0/8", src_ip)
| stats count by src_ip, dest_ip, dest_port

Purpose:
Flags attempts to reach the management interface from outside internal networks.


3. Detect Suspicious Parameter Length in DNS Configuration Requests

index=proxy OR index=network
uri_path="/dnscfg.cgi"
| eval param_length=len(http_request_body)
| where param_length > 300
| table _time src_ip dest_ip param_length

Purpose:
Abnormally long request bodies are common in injection attempts and rare during normal DNS configuration.


4. Detect Encoded or Non-Standard Characters in DNS Parameters

index=proxy OR index=network
uri_path="/dnscfg.cgi"
| regex http_request_body="(%[0-9A-Fa-f]{2}|\\+|\\=)"
| stats count by src_ip, dest_ip

Purpose:
Identifies requests containing encoded characters uncommon in legitimate DNS configuration.


5. Detect Unauthorized DNS Server Changes (Post-Exploitation Indicator)

index=dns_logs
| stats earliest(_time) as first_seen latest(_time) as last_seen by dns_server
| where dns_server NOT IN ("<approved_dns_1>", "<approved_dns_2>")

Purpose:
Highlights unexpected resolver changes that may indicate successful exploitation.


6. Detect Router-Initiated Suspicious Outbound Connections

index=netflow OR index=firewall
src_device_type="router"
| stats count by dest_ip dest_port
| where count > 20

Purpose:
Identifies potential command-and-control or botnet behavior originating from the gateway.


Incident Response Actions

Immediate

  • Block WAN access to router management interfaces
  • Isolate affected gateways
  • Preserve logs and configuration for analysis
  • Treat any exposed device as potentially compromised

Recovery

  • Apply official firmware updates if available
  • Factory reset and reconfigure manually
  • Replace EOL devices where no patch exists
  • Validate DNS and routing configurations

Mitigation and Hardening

  • Replace unsupported DSL gateways
  • Restrict administrative access to management VLANs
  • Disable remote management features
  • Monitor DNS integrity centrally
  • Enforce regular edge-device security audits

Official Patch Guidance

D-Link has released a security advisory covering affected models and firmware versions. Firmware updates are available only for select hardware revisions and regions. Administrators should apply updates strictly from official D-Link support channels.


Final Takeaway

CVE-2026-0625 is a high-impact, low-effort vulnerability affecting critical network infrastructure. Due to unauthenticated exploitation and the strategic position of routers, successful attacks can remain undetected while enabling full network compromise.

Immediate action is strongly recommended.


Aegiron

Backed by 11+ years in cybersecurity and incident response, we decode the latest threats shaping today’s digital battlefield. This blog cuts through the noise with clear insights on vulnerabilities, emerging exploits, and the cyber news defenders can’t afford to miss.