Integer Underflow (Wrap or Wraparound) Affecting cesanta/mongoose package, versions [,7.23)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.38% (30th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-UNMANAGED-CESANTAMONGOOSE-20948699
  • published15 Oct 2026
  • disclosed14 Oct 2026
  • credittao pan

Introduced: 14 Oct 2026

NewCVE-2026-73252  (opens in a new tab)
CWE-191  (opens in a new tab)

How to fix?

Upgrade cesanta/mongoose to version 7.23 or higher.

Overview

cesanta/mongoose is a networking library for C/C++. It implements event-driven non-blocking APIs for TCP, UDP, HTTP, WebSocket, MQTT.

Affected versions of this package are vulnerable to Integer Underflow (Wrap or Wraparound) in the mg_tls_recv_record function in src/tls_builtin.c, whose length guard rejects only msgsz < 16 although a TLS 1.3 ciphertext requires at least 17 bytes, so a record of exactly 16 bytes makes tls->recv_len = (size_t) msgsz - 16 - 1 wrap to SIZE_MAX. An attacker can read far past the receive buffer, and crash the process once the read leaves mapped memory, by sending a record carrying a valid AEAD tag over a zero-length plaintext, after which the leftover-data guard if (tls->recv_len > 0) return 0; is permanently true and stale buffer bytes are consumed as a decrypted message whose length field drives mg_sha256_update in mg_tls_drop_message. This affects only the MG_TLS_BUILTIN backend and not the OpenSSL or mbedTLS ones, and is reachable once directional handshake keys exist from the unauthenticated X25519 exchange, so either peer can trigger it before certificates are validated, including against a plain HTTPS server through mg_tls_server_recv_finish.

CVSS Base Scores

version 4.0
version 3.1