Skip to content
04 Upload Fw Multipart Overflow

04 Upload Fw Multipart Overflow

github.com • November 4, 2026

Component: /www/cgi-bin/upload_fw.cgi (MIPS32 ELF binary, firmware upload handler)

The multipart/form-data header parser of /cgi-bin/upload_fw.cgi ( init_multipart ) appends attacker-controlled header lines into a 1024-byte global buffer using unbounded strcat() . Each crafted header block contributes up to ~1533 bytes and the parsing loop can be re-entered arbitrarily many times, so the overflow length is attacker-controlled. The overflow was dynamically verified to crash the CGI process (HTTP 500). Combined with the pre-authentication session-issuance flaws in al.cgi / mesh_login.cgi, the vulnerable endpoint is reachable without credentials.

Vulnerability Type / CWE

CWE-787: Out-of-bounds Write (CWE-120)

Decompiled logic of init_multipart :

A Content-Disposition line that does NOT contain filename= (e.g. a padded form-field part) triggers the triple strcat : up to ~1533 bytes appended per block into the 1024-byte buffer, and the loop continues reading further parts.

Proof of Concept (non-destructive)

Observed result (reproducible): HTTP 500 — the CGI process dies mid-request (memory corruption); lighttpd itself remains alive. A smaller single-block overflow (~470 bytes past the buffer) completes normally and the upload succeeds, confirming the vulnerable code path executes.

Repeatable denial of service against the firmware-upload endpoint via memory corruption.

Out-of-bounds write of attacker-controlled data with attacker-controlled length; further exploitation (code execution) depends on .bss adjacency and was not pursued.

AV:A/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H — 6.5 (Medium)

Method: static reverse engineering (Ghidra) + dynamic crash reproduction on rehosted firmware

2026-10-10: Vulnerability discovered and verified

TBD: Vendor notification

TBD: CVE ID assignment

TBD: Public disclosure

Extracted Entities