Reproduction lab and PoC for CVE-2026-129354, a pre-auth stack overflow in D-Link DIR-600L HNAP hnap_main via the SOAPAction header, with qemu-mipsel firmware harness.
hnap_main pre-auth stack buffer overflow via the SOAPAction header| CVE | CVE-2026-129354 (VDB-437417) |
| Component | D-Link DIR-600L hardware rev B, firmware 2.17b02 — hnap_main in htdocs/cgibin, reached as /usr/sbin/hnap through boa's /HNAP1/ mapping (HNAP Handler) |
| Affected | DIR-600L B1 firmware 2.17b02 (shared DIR-600Bx platform image) — EOL, no vendor fix will be released (D-Link SAP10393) |
| Fixed in | nothing; the device is end-of-life. This repository's differential uses a bounds-enforcing remediation instead (see §2) |
| CWE | CWE-121 (Stack-based Buffer Overflow), CWE-119 (Memory Corruption) |
| Impact | Pre-authentication memory corruption of the HNAP CGI with demonstrated instruction-pointer control; crash of the CGI child per request (the httpd keeps serving) and, on exploitation, arbitrary code execution as the web server (root) on the device |
| Vector | Network, unauthenticated — an HTTP request whose SOAPAction header contains a whitelisted HNAP action name followed by / and an over-long suffix |
| Trigger | SOAPAction: "http://purenetworks.com/HNAP1/GetDeviceSettings/EEE…" — suffix ≥ ~260 bytes faults (si_addr=0x45454545); a NUL-free pointer-preserving suffix of 236 bytes reaches the saved $ra and sets it to an attacker-chosen value |
| CVSS | 10.0 CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H (VulDB) — the exploitability metric on real hardware additionally requires knowledge of the target memory layout |
| Credit | ruanyi (VulDB user ruanyi101) — original advisory and emulated-evidence disclosure; this laboratory extends the proof to instruction-pointer control on the same MD5-verified firmware image |
The HNAP handler derives the action it executes from the client-supplied
SOAPAction header. Its pre-authentication whitelist is a substring
test — any header that merely contains http://purenetworks.com/HNAP1/GetDeviceSettings
or …/GetWLanRadios passes without credentials — and the action actually
used is everything after the last slash of that same attacker-controlled
header. The action string is then copied into a 256-byte stack buffer with
an unbounded strcpy (and re-formatted through an unbounded sprintf
shell-command template). One request from an unauthenticated LAN-side (or
exposed-WAN-management) client corrupts the CGI child's stack; this
laboratory proves the chain end to end on the real firmware binary —
the exact MD5-verified image the upstream advisory recorded — re-hosted
under qemu-mipsel with boa's CGI execution model: advisory-matching crash
(0x45454545), crash threshold, and saved-return-address control
(faulting PC = 0x42424242).
main (0x00402a30) dispatches on the basename of argv[0]; boa maps
/HNAP1/ to /usr/sbin/hnap -> /htdocs/cgibin, selecting hnap_main
(0x00412a48). Ghidra 12.1.4 decompilation of the shipped binary:
memset(auStack_228, 0, 0x100); /* 256-byte stack buffer */
auth = getenv("HTTP_AUTHORIZATION");
soap = getenv("HTTP_SOAPACTION"); /* attacker controlled */
...
if (soap == NULL) soap = "http://purenetworks.com/HNAP1/GetDeviceSettings";
else if (strstr(soap, "http://purenetworks.com/HNAP1/GetDeviceSettings") == 0
&& strstr(soap, "http://purenetworks.com/HNAP1/GetWLanRadios") == 0
&& hnap_auth_ok(auth) < 0)
{ /* reject */ }
...
action = strrchr(soap, '/') + 1; /* suffix after last '/' */
...
strcpy(auStack_228, action); /* sink 1 — unbounded */
iVar6 = FUN_00412224(auStack_228, "/etc/templates/hnap//.shell_action");
sprintf(auStack_228, "sh %s%s.sh > /dev/console[ &]",
"/var/run/", action); /* sink 2 — unbounded %s */
system(auStack_228);
Two independent defects make the overflow pre-authentication reachable:
strstr — a substring match on the whole header, so
"http://purenetworks.com/HNAP1/GetDeviceSettings/<attacker suffix>"
satisfies it while the checked name and the used action are different
strings (the upstream advisory's observation);strrchr(soap, '/') + 1 — the tail after
the last slash, fully attacker-controlled, of unbounded length.The saved $ra sits 236 bytes above the destination buffer. Consequences,
all reproduced in this lab: 'E' fill ≥ ~260 bytes faults at
si_addr=0x45454545 (exactly the upstream advisory's strace signature);
a fill of NUL-free pointers into the always-mapped uClibc text region
keeps every intermediate dereference alive so the 236-byte offset lands on
the saved $ra, and the returning jr ra jumps to the attacker-chosen
address (0x42424242 in the PoC) — instruction-pointer control, one step
beyond the public advisory's evidence, which itself noted a PC/RA snapshot
was still missing.
| service | image | role |
|---|---|---|
hnap-vuln | cve-2026-129354:lab with LAB_BOUNDS_SHIM=0 | the firmware rootfs (extracted at build from the MD5-verified vendor image) re-hosted under qemu-mipsel-static — the vulnerable side |
hnap-fixed | cve-2026-129354:lab with LAB_BOUNDS_SHIM=1 | the same binary with LD_PRELOAD=/usr/lib/bndshim.so (bounds-enforcing strcpy/sprintf, cap 256) — the remediation-shape side |
poc | cve-2026-129354-poc:local | stdlib-only Python driver |
The DIR-600L is end-of-life: D-Link's SAP10393 states all DIR-600/605/605L
revisions are EOL/EOS with no further firmware. No vendor patch exists or
will exist, so there is no "fixed version" to build. The differential in
this laboratory instead contrasts the shipped binary against the same
binary with the two dangerous libc entry points interposed by
lab/shim/bndshim.c — a freestanding mipsel .so with no DT_NEEDED
that loads under the firmware's own ld-uClibc.so.0 and bounds every
strcpy/sprintf destination at the affected buffer (256). The shim is a
remediation shape, not a vendor patch: it demonstrates that the crash
is exactly the unbounded copy and nothing else. On real hardware the only
available mitigations are retiring the device or strictly isolating its
management interface.
Provenance of the binary, verified twice: the firmware image
DIR-600Bx_FW217b02.bin (md5 2f953ec274caeab6bc643045da56ab29, matching
the hash recorded in the upstream research advisory) is downloaded at image
build, its vendor-LZMA squashfs is unpacked with sasquatch, and the
resulting htdocs/cgibin (md5 e7016496219d73b3be39cad163995fcc) is
byte-identical to an independent researcher's committed extraction of the
same image. The front end (lab/service.py) reproduces boa's CGI model
for HNAP — one child per request, SOAPAction mapped to HTTP_SOAPACTION,
the URL in REQUEST_URI, the body on stdin, /var/run/hnap.lock creatable —
so a guest crash is a reported SIGSEGV with its si_addr, not a service
outage.
./run-lab.sh build # firmware fetch+verify, extraction, lab + PoC images
./run-lab.sh up # cve129354lab network, hnap-vuln, hnap-fixed
./run-lab.sh sweep # check / exploit / probe / mitigation on both sides
./run-lab.sh down
Single mode against one side:
podman run --rm --network cve129354lab cve-2026-129354-poc:local \
exploit --host=hnap-vuln
poc/poc.py (stdlib only; check / exploit / probe / mitigation):