Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2026-129352 — TRENDnet TEW-657BRM 1.00.1 upgrade_flash.cgi: strncpy of the multipart first line into a 128-byte frame buffer (ra +192), delimiter unchecked -> wild-size SIGSEGV. Hash-verified CGI re-hosted under qemu-mips; bounds-patch side passes. EOL device. | Kitploit
Tools/GitHubGitHub/googlesky/cve-2026-129352
Embedded Systems SecurityDynamic Analysis (Sandboxing)Vulnerability AnalysisExploitationReverse EngineeringWeb Application ExploitationHardware & IoT SecurityPapers & ResearchFirmware AnalysisBinary Exploitation
4 days agoNot yet reviewed
Share
GitHub
googlesky/cve-2026-129352

CVE-2026-129352

TRENDnet TEW-657BRM 1.00.1 upgrade_flash.cgi: strncpy of the multipart first line into a 128-byte frame buffer (ra +192), delimiter unchecked -> wild-size SIGSEGV. Hash-verified CGI re-hosted under qemu-mips; bounds-patch side passes. EOL device.

View RepositoryWebsite

CVE-2026-129352 — TRENDnet TEW-657BRM upgrade_flash.cgi authenticated stack overflow: the multipart first line overflows a 128-byte strncpy

License: MIT Research status: validated

CVECVE-2026-129352 (VulDB)
ComponentTRENDnet TEW-657BRM v1.0R, firmware 1.00.1 — /usr/sbin/upgrade_flash.cgi (the firmware-upload handler)
AffectedTEW-657BRM v1.0R firmware 1.00.1 — EOL, no vendor fix will be released
Fixed innothing; the product is end-of-life. This repository's differential uses a bounds-enforcing binary patch instead (see §2)
CWECWE-121 (Stack-based Buffer Overflow), CWE-120 (Classic Buffer Overflow)
ImpactAuthenticated (LAN-administrator) memory corruption of the upload CGI: an unbounded strncpy of the multipart first line over a 128-byte frame buffer (saved registers and $ra 192 bytes above it), plus an unchecked delimiter search whose absence makes the copy size go wild — an immediate pre-body SIGSEGV
VectorA firmware-restore/upload request whose multipart first line exceeds 128 bytes, or whose body contains no CR/LF at all
Triggerfirst line ≥ 192 bytes reaches the saved $ra with attacker bytes (witnessed in the CGI's own trace); a body without CR/LF crashes immediately at 0x40801000
Creditruanyi (VulDB user ruanyi101) — original research advisory (documented saved-metadata overwrite and PC control in an image-accepted emulated flow)

The upload handler reads the request body, finds the end of the first line with strstr, and copies that line into a 128-byte stack buffer using the line's length as the strncpy size. Neither the delimiter result nor the length is bounded or checked. One authenticated request with an over-long first line overwrites the frame — the CGI's own debug trace logs a boundary string longer than the destination buffer — and a body without any CR/LF makes the pointer subtraction produce a wild size that kills the CGI immediately. This laboratory re-hosts the real firmware CGI (MIPS big-endian, hash-verified image) under qemu-mips with mini_httpd's CGI model, reproduces both primitives, and contrasts the shipped binary with the same binary carrying a six-instruction bounds cap on exactly that strncpy call site.


1. Root cause

main of upgrade_flash.cgi (Ghidra 12.1.4 decompilation, function at 0x00403780; the frame uses $s8):

buf = malloc(0x800);
read(0, buf, 0x800);                       /* the request body      */
local_34 = strstr(buf, "\r\n");            /* end of first line — result NOT checked */
strncpy(auStack_c8, buf, local_34 - buf);  /* dst = char[128] @ $s8+0x2f8, size = line length */
...
sep = strstr(buf, "Content-Disposition");  /* later markers ARE checked */
...
sep = strstr(buf, "\r\n\r\n");             /* checked */
check_updata(...);                         /* image validation */

Two consequences, both reproduced:

  • no CR/LF anywhere — strstr returns NULL, the subtraction yields a ~4 GB size, and the strncpy faults immediately (SIGSEGV si_addr=0x40801000, the copy walking off the mapping). This is the reliable crash primitive (the CGI's error paths call exit() directly, so the overlong-line overwrite does not pop $ra on those paths).
  • first line longer than 128 bytes — the copy writes past the buffer into the frame; the saved registers and $ra sit 192 bytes above the destination, and every byte of the first line is attacker-chosen. The CGI's own trace (written to /var/cgitest) logs the boundary string it copied — for an 800-byte first line it logs 804 bytes, proving the write continued far past the 128-byte destination. The upstream research documented program-counter control at main's epilogue in a flow whose body carried a valid vendor image (so the handler returns normally); this lab demonstrates the unbounded write and the wild-size crash instead, and states that boundary honestly.

The handler is reached only after the CGI authorises the client by resolving its MAC with SIOCGARP — the LAN-administrator position (see §2 for how the lab reproduces it).

2. Reproduction environment

serviceimagerole
upg-vulncve-2026-129352:lab with LAB_BOUNDS_SHIM=0the firmware rootfs (extracted at build from the hash-verified vendor image) chroot'd; each request forks /usr/sbin/upgrade_flash.cgi under qemu-mips-static with mini_httpd's CGI environment
upg-fixedcve-2026-129352:lab with LAB_BOUNDS_SHIM=1the same CGI with lab/patch.py's bounds patch: the one strncpy call site jumps to a six-instruction stub capping the length at 128 (the destination's size)
poccve-2026-129352-poc:localstdlib-only Python driver

The TEW-657BRM is end-of-life; no vendor patch exists or will exist. This firmware's uClibc loader does not support LD_PRELOAD at all (even its own pppoe.so is rejected), so the remediation cannot be an interposed library as in the sibling DIR-600L labs — it is a minimal binary patch applied at image build with hash-checked preconditions (lab/patch.py):

  • patch A (both sides, environment compatibility) — the CGI's SIOCGARP authorisation fills a big-endian arpreq; qemu-user passes guest buffers to the host kernel unconverted, so on a little-endian host the sockaddr family is byte-swapped and every conforming host kernel rejects the request. The device's own Linux 2.4 kernel accepted it. Patch A NOPs the call and the auth-failed branch identically on both sides, reproducing the authorised position without touching the vulnerable code path.
  • patch B (remediated side only) — 0x00403b84: jalr t9 (the strncpy call) becomes j 0x00403304, where a stub over the now-dead getMAC body caps $a2 at 128 and tail-jumps to the real strncpy.

Provenance: the firmware package TEW-657BRMv1.0R(1.00.1).zip (md5 0e2104c9259073e0a1e3bbdb6d740840) is fetched at image build from TRENDnet's server; the inner image and ad1006.bin are hash-gated, the vendor sqlz squashfs is unpacked with sasquatch, and usr/sbin/upgrade_flash.cgi is verified (md5 7561a1758fe08011906c86d416104820). The front end (lab/service.py) reproduces mini_httpd's CGI model — body on stdin, CONTENT_LENGTH, REMOTE_ADDR — and returns the child's fate as JSON, including the tail of the CGI's own /var/cgitest trace.

3. Running the environment

./run-lab.sh build     # firmware fetch+verify, extraction, lab + PoC images
./run-lab.sh up        # cve129352lab network, upg-vuln, upg-fixed (NET_ADMIN for the ARP entry)
./run-lab.sh sweep     # check / exploit / probe / mitigation on both sides
./run-lab.sh down

Single mode against one side:

podman run --rm --network cve129352lab cve-2026-129352-poc:local \
    exploit --host=upg-vuln

4. The PoC

poc/poc.py (stdlib only; check / exploit / probe / mitigation):

  • check — a body without any CR/LF; classifies the target by the child's exit status and si_addr. Exit 1 vulnerable, 0 safe, 3 no worker, 2 unreachable.
  • exploit — stage 1 reproduces the wild-size strncpy SIGSEGV; stage 2 sends an over-long first line and proves the frame overwrite through the CGI's own logged boundary length.
  • probe — boundary lengths around the 128-byte buffer and the 192-byte $ra distance, LF-only bodies, missing marker bodies, and the no-delimiter form.
  • mitigation — EOL device: demonstrates the front-end line cap as the effective form and contrasts the bounds-patch side.

5. Expected results

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    936
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    555
  • 3

    redforge

    cybersecurity91/redforge

    Browser-side red team toolkit with 102 offline tools for recon, payload generation, credential attacks, crypto, encoding and engagement reporting.

    353
  • 4

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    348
  • 5

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    336
  • 6

    CyberStrikeAI

    ed1s0nz/cyberstrikeai

    The system of action for AI-native cybersecurity—where intent becomes governed execution, evidence becomes operational memory, and every operation improves the next.

    288

Explore all tools

Browse our collection of tools

View all tools →