Cesanta Mongoose Stack-Based Buffer Overflow Vulnerability in mDNS Record Handler

Vulnerability

A stack-based buffer overflow vulnerability has been identified in Cesanta Mongoose versions prior to 7.21. The issue arises in the mDNS record handling function within 'mongoose.c', where a fixed-size stack buffer is used to construct responses. This buffer can be overflowed by manipulating the response data, leading to potential corruption of the stack and execution control.

Impact

Exploitation of this vulnerability causes a stack-based buffer overflow, overwriting saved registers and the return address on the MIPS stack. This corruption leads to a crash when the function returns, as execution jumps to a corrupted address.

Reproduction

The vulnerability can be reproduced by sending a standard mDNS PTR query for a service type to UDP port 5353. The server responds by building a PTR response that includes additional DNS records (SRV, TXT, and A) which collectively exceed the buffer size, causing the overflow. This can be automated with a Python script that sends the crafted mDNS query and checks if the server crashes.

Remediation

Users are advised to upgrade to Cesanta Mongoose version 7.21, which addresses this vulnerability.

Added: Apr 2, 2026, 10:59 AM
Updated: Apr 2, 2026, 10:59 AM

Vulnerability Rating

Custom Algorithm
spread
3.1
impact
3.1
exploitability
6.6
remediation
7.7
relevance
5.1
threat
6.4
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.