CVE-2026-50161: libre: Integer overflow in websock_decode() masked frame length check leads to heap buffer overflow
libre is a generic library for real-time communications with asynchronous input and output support. Prior to 4.8.1, the websock_decode() function in src/websock/websock.c contains an integer overflow when validating a masked WebSocket frame that uses the 64-bit extended length encoding. The expression 4 + hdr->len can wrap when hdr->len is close to UINT64_MAX, causing the mbuf_get_left() bounds check to pass. The subsequent XOR unmasking loop then writes beyond the heap buffer. Applications using websock_accept() or websock_accept_proto() to implement a WebSocket server are affected, and exploitation can cause attacker-controlled heap corruption or denial of service after the HTTP WebSocket upgrade handshake. This issue is fixed in version 4.8.1.
Security readout for executives and security teams
Plain-English summary
A remote attacker can send a specially sized masked WebSocket frame that bypasses a length check and corrupts heap memory. WebSocket servers built with affected libre/re versions may crash or experience attacker-controlled memory corruption. The sources do not establish code execution.
Executive priority
Treat as an immediate remediation priority for reachable WebSocket servers. The flaw is unauthenticated, network-accessible, and rated critical, although active exploitation is not evidenced. Rapidly inventory affected services, upgrade them, and temporarily restrict exposure where deployment cannot occur promptly.
Technical view
Before version 4.8.1, websock_decode() can overflow the calculation 4 + hdr->len for masked frames using 64-bit extended lengths. The wrapped value may pass the remaining-buffer check, after which the XOR unmasking loop writes beyond the heap buffer. This is classified as CWE-190 and CWE-787, with CVSS 4.0 score 9.3.
Likely exposure
Exposure is limited to applications using affected versions before 4.8.1 and websock_accept() or websock_accept_proto() as a WebSocket server. An attacker must reach the service and complete the HTTP WebSocket upgrade handshake. Client-only use is not identified as affected by the supplied sources.
Exploitation context
The vulnerability is remotely reachable, requires no privileges or user interaction, and has low attack complexity according to the supplied CVSS vector. The source bundle marks it absent from KEV and provides no evidence of active exploitation. Potential outcomes are denial of service and attacker-controlled heap corruption; practical code execution is not established.
Researcher notes
The critical condition depends on a masked frame using 64-bit extended length encoding and an hdr->len value that wraps the validation expression. Review should focus on integer-safe bounds validation before reading the mask and unmasking payload bytes. The supplied commit, pull request, advisory, and 4.8.1 release provide the authoritative fix trail.
Mitigation direction
Upgrade libre/re to version 4.8.1 or later.
Identify applications embedding vulnerable versions, including statically linked copies.
Prioritize internet-accessible WebSocket servers using the affected accept functions.
If immediate upgrading is impossible, restrict WebSocket access and consult vendor guidance.
Validation and detection
Confirm the deployed libre/re version is 4.8.1 or later.
Search source and dependency inventories for websock_accept() and websock_accept_proto().
Verify whether affected WebSocket listeners are reachable from untrusted networks.
Confirm rebuilt applications no longer include vulnerable static library copies.
Review service telemetry for unexplained crashes or memory-corruption indicators.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · low confidence lookup
CWE-190: Exact CWE lookup
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
Use the exact CWE identifier as the starting point before reviewing related ATT&CK behavior. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-190 · source CWE mapping
Integer Overflow or Wraparound
Integer Overflow or Wraparound represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.
Out-of-bounds Write represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.