Summary
CVE-2026-50161 is a critical integer overflow vulnerability (CWE-190/CWE-787) in the websock_decode() function of libre (the re library used by the baresip SIP user-agent project), affecting all versions prior to 4.8.1. The flaw allows an unauthenticated remote attacker to send a crafted WebSocket frame that triggers a heap buffer overflow, resulting in denial of service or potential remote code execution against any application that accepts WebSocket connections via websock_accept() or websock_accept_proto(). The vulnerability carries a CVSS v4.0 base score of 9.3 (Critical).
Technical details
- Root cause: When decoding a masked WebSocket frame that uses the 64-bit extended payload-length encoding,
websock_decode()insrc/websock/websock.cperforms the bounds checkmbuf_get_left(mb) < (4 + hdr->len). Ifhdr->lenis close toUINT64_MAX, the addition4 + hdr->lenwraps around to a small value, causing the length validation to incorrectly pass. - Trigger conditions: A single, small (~14-byte) crafted, masked WebSocket frame with an oversized 64-bit extended length field is sufficient to trigger the flaw.
- Attack vector: Network-based and pre-authentication — the attacker only needs to complete a standard HTTP-to-WebSocket handshake with any service built on
libre‘s WebSocket server functionality; no credentials or user interaction are required. - Impact: Once the bogus length check passes, the subsequent XOR-based unmasking routine iterates far beyond the allocated buffer, writing attacker-influenced data out of bounds. This can crash the process (denial of service) or, depending on heap layout, be leveraged for memory corruption/remote code execution.
Affected software
- baresip
re(libre) library — all versions prior to 4.8.1 - Any application embedding libre’s WebSocket server code path (
websock_accept()/websock_accept_proto()) is exposed, including baresip-based SIP/VoIP deployments that expose a WebSocket listener.
Severity
- CVSS v4.0 Base Score: 9.3 (Critical)
- Vector:
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Mitigation and recommended actions
- Immediate: Upgrade
libre/reto version 4.8.1 or later, which adds an explicit overflow guard (hdr->len > SIZE_MAX - 4) before the vulnerable addition, fixed via commit718b92615c7963670d26c1a2b246968b58d782e8(PR #1584). - If immediate patching is not possible:
- Restrict or firewall network access to any WebSocket listener exposed by baresip/libre-based services to trusted networks only.
- Disable WebSocket transport support in baresip/libre deployments if it is not required for operation.
- Monitor for abnormal crashes or memory errors in processes using libre’s WebSocket server, which may indicate exploitation attempts.

