
Reproduces CVE-2026-129351, a pre-auth out-of-bounds write in TRENDnet TEW-657BRM mini_httpd, running the hash-verified MIPS firmware under qemu with a PoC and bounds-shim differential.
mini_httpd pre-auth out-of-bounds write: the .htm redirect sprintf smashes the GOT| CVE | CVE-2026-129351 (VDB-437416 family, VulDB) |
| Component | TRENDnet TEW-657BRM v1.0R, firmware 1.00.1 — /usr/sbin/mini_httpd, request-line handling (.htm → setup.cgi redirect) |
| Affected | TEW-657BRM v1.0R firmware 1.00.1 — EOL, no vendor fix will be released |
| Fixed in | nothing; the product is end-of-life. This repository's differential uses a bounds-enforcing remediation instead (see §2) |
| CWE | CWE-787 (Out-of-bounds Write), CWE-120 (Classic Buffer Overflow) |
| Impact | Pre-authentication memory corruption of the web-management daemon with an attacker-controlled corrupted GOT pointer; crash of the per-connection child (the daemon keeps serving) and, per the upstream research notes, program-counter control in their emulation |
| Vector | Network, unauthenticated — one HTTP request whose URL path contains .htm (and no .cgi) and is longer than ~3.9 KB |
| Trigger | GET /AAAA…(≥3887 bytes)….htm — the redirect sprintf writes past a ~3.9 KB .bss buffer into the process GOT |
| Credit | ruanyi (VulDB user ruanyi101) — original research advisory (emulated-evidence disclosure); this laboratory reproduces it on the vendor's hash-verified firmware image |
mini_httpd rewrites any URL path that contains .htm (and does not
contain .cgi) into a setup.cgi redirect before it ever looks at the
Authorization header. The rewrite is a single unbounded sprintf into a
fixed .bss buffer at 0x100001bc; the process GOT begins at
0x10001110, 3908 bytes later. One unauthenticated request with a ~3.9 KB
path overwrites GOT entries with attacker bytes — the next library call or
data dereference runs through the corrupted slot. This laboratory runs the
real firmware daemon (MIPS big-endian, hash-verified image) under
qemu-mips in a firmware chroot, binding its HTTP port itself exactly as
on the device, and proves the chain: the pre-auth crash, the length
threshold at exactly the buffer→GOT distance, and an attacker-controlled
faulting pointer whose address bytes are the attacker's own payload.
mini_httpd's request handler (Ghidra 12.1.4 decompilation of the shipped
binary, function at 0x00403d84):
/* path = the request URL path */
pcVar7 = strstr(path, ".cgi");
if ((pcVar7 == NULL) && (pcVar7 = strstr(path, ".htm")) != NULL) {
if (*path == '/') path = path + 1;
sprintf(&DAT_100001bc, "/setup.cgi?next_file=%s", path); /* sink */
path = &DAT_100001bc;
}
...
/* the Authorization header is parsed AFTER the redirect rewrite:
strncasecmp(header, "Authorization:", 14) ... */
Three facts make the write pre-auth and attacker-sized:
.htm anywhere in the path (.html
qualifies too, as the sweep shows) and no .cgi;Authorization header is examined —
no credentials are needed;DAT_100001bc is a fixed .bss buffer ≈ 3.9 KB in
size, and the GOT starts at 0x10001110 — 0x100001bc + 3908.
Every byte past that boundary lands in a GOT slot.Reproduced consequences (see evidence/): a 3800-byte path is served
normally; at the 3887-byte boundary the child faults (SIGSEGV/
SIGBUS); with a controlled two-byte fill pattern at the boundary the
faulting address itself carries the payload bytes —
'a'*3887+'b'*64 faults at 0x6261e27a, 'c'*3887+'d'*64 faults at
0x6463e47c — proving the corrupted GOT data pointer is
attacker-controlled. The upstream research notes additionally document
program-counter control and a benign payload in their emulation; the
first-called GOT slot differs across environments, so this laboratory
claims the pointer-control primitive it can attribute.
| service | image | role |
|---|---|---|
tew-vuln | cve-2026-129351:lab with LAB_BOUNDS_SHIM=0 | the firmware rootfs (extracted at build from the hash-verified vendor image) chroot'd, with the real mini_httpd running under qemu-mips-static in foreground on port 8080 |
tew-fixed | cve-2026-129351:lab with LAB_BOUNDS_SHIM=1 | the same daemon with LD_PRELOAD=/usr/lib/bndshim.so (bounds-enforcing sprintf, cap 2048) |
poc | cve-2026-129351-poc:local | stdlib-only Python driver |
The TEW-657BRM is end-of-life; no vendor patch exists or will exist. The
differential therefore contrasts the shipped daemon against the same
binary with the dangerous sprintf interposed by lab/shim/bndshim.c —
a freestanding mips (big-endian) .so with no DT_NEEDED that loads
under the firmware's own ld-uClibc.so.0 and bounds the redirect
destination at 2048 bytes (well under the 3908-byte buffer→GOT distance;
every legitimate redirect is under 100 bytes). This is a remediation
shape, not a vendor patch.
Unlike a CGI harness, here the daemon itself is the target: mini_httpd
accepts, forks a child per connection, and the child performs the
vulnerable rewrite — so a crash kills only the connection child and the
parent keeps accepting, exactly as on the device. A small log endpoint
(lab/logtail.py) exposes the tail of the qemu -strace log so the PoC
can attribute guest signals to its own requests and read si_addr.
Provenance: the firmware package
TEW-657BRMv1.0R(1.00.1).zip (md5 0e2104c9259073e0a1e3bbdb6d740840)
is fetched at image build from TRENDnet's download server; the inner
TEW-657BRM-1001.img (md5 5dda131b6226e8c87c26aeafb0b19aba) contains
ad1006.bin (md5 5dc8a55bfe7a31702e43f56a09e1d46b), whose vendor
sqlz (squashfs 2.1 big-endian LZMA) filesystem is magic-swapped to the
standard sqsh and unpacked with sasquatch. usr/sbin/mini_httpd is
hash-gated (md5 1a026bd17b528f64d84b740f84efc817).
./run-lab.sh build # firmware fetch+verify, extraction, lab + PoC images
./run-lab.sh up # cve129351lab network, tew-vuln, tew-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 cve129351lab cve-2026-129351-poc:local \
exploit --host=tew-vuln
poc/poc.py (stdlib only; check / exploit / probe / mitigation):
.htm request; classifies the target by the
new guest signal in the daemon's strace. Exit 1 vulnerable, 0 safe,
3 no worker, 2 unreachable.si_addr bytes equal the payload bytes)..html
variant, query suffix, .cgi dominance, HEAD method, and post-crash
service health.