Executive brief
Mongoose is a lightweight, embedded web server used in IoT devices, industrial controllers, and embedded systems. A flaw in its multipart form parsing allows remote attackers to inject lone carriage return or line feed characters that truncate HTTP headers and filenames, potentially causing the application to accept malicious file uploads or content by bypassing Content-Type validation checks.
Technical details
The vulnerability exists in the mg_http_next_multipart() function in src/http.c, which parses multipart/form-data boundaries and headers. The condition logic used to detect CRLF terminators is incorrect (an AND condition should be OR), causing the parsing loops to halt prematurely when encountering a lone carriage return (\r) or line feed (\n) character. This truncates multipart headers, filenames, or boundary markers, allowing an attacker to craft a multipart request where misleading Content-Type headers mask dangerous payloads. The attack requires only network access and a multipart-capable endpoint; no authentication is required. An attacker can bypass content validation and trick the application into processing dangerous files with incorrect MIME types. The fix is available in Mongoose version 7.22 and later.
Affected products
- Cesanta Mongoose prior to 7.22
Timeline
- 2026-08-20: disclosed
- 2026-06-23: patched: Fix merged in version 7.22