# CVE-2026-50161: libre: Integer overflow in websock_decode() masked frame length check leads to heap buffer overflow

> An integer overflow in libre's WebSocket decoder allows heap buffer overflows, potentially leading to code execution or denial of service in WebSocket servers.

- **Severity:** Critical 9.3 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 18 Aug 2026
- **Updated:** 19 Aug 2026
- **Also known as:** DEBIAN-CVE-2026-50161, GHSA-hvxv-v2gp-v93h, UBUNTU-CVE-2026-50161

## What is CVE-2026-50161?

CVE-2026-50161 is a critical vulnerability in baresip re, published on 18 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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.

Weakness: CWE-787 (Out-of-bounds Write), CWE-190 (Integer Overflow or Wraparound)

## Which versions are affected by CVE-2026-50161?


## How do I fix CVE-2026-50161?

Upgrade to a fixed version.

## Is CVE-2026-50161 being exploited?

There is no known exploitation of CVE-2026-50161 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-50161 and fix it if it is affected.

What it is: CVE-2026-50161 is a critical vulnerability in baresip re, published on 18 Aug 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-50161 in the wild and no public exploit code.

Affected product: baresip re. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-50161/ (Markdown: https://insights.sbomify.com/CVE-2026-50161/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-50161
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-50161
- OSV: https://osv.dev/vulnerability/CVE-2026-50161

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-50161/
Summaries are generated and may contain mistakes; the official description above is the record.
