# CVE-2024-52811: Acks not validated before logged to qlog leads to buffer overflow in ngtcp2

> An integer underflow in ngtcp2's qlog logging leads to a heap buffer overflow, potentially allowing code execution or denial of service when qlog is enabled.

- **Severity:** High 8.2 (`CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:L/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 25 Nov 2024
- **Updated:** 25 Nov 2024
- **Also known as:** GHSA-4gmv-gf46-r4g5, UBUNTU-CVE-2024-52811, openSUSE-SU-2025:14766-1

## What is CVE-2024-52811?

CVE-2024-52811 is a high-severity vulnerability in ngtcp2, published on 25 Nov 2024. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

The ngtcp2 project is an effort to implement IETF QUIC protocol in C. In affected versions acks are not validated before being written to the qlog leading to a buffer overflow. In `ngtcp2_conn::conn_recv_pkt` for an ACK, there was new logic that got added to skip `conn_recv_ack` if an ack has already been processed in the payload. However, this causes us to also skip `ngtcp2_pkt_validate_ack`. The ack which was skipped still got written to qlog. The bug occurs in `ngtcp2_qlog::write_ack_frame`. It is now possible to reach this code with an invalid ack, suppose `largest_ack=0` and `first_ack_range=15`. Subtracting `largest_ack - first_ack_range` will lead to an integer underflow which is 20 chars long. However, the ngtcp2 qlog code assumes the number written is a signed integer and only accounts for 19 characters of overhead (see `NGTCP2_QLOG_ACK_FRAME_RANGE_OVERHEAD`). Therefore, we overwrite the buffer causing a heap overflow. This is high priority and could potentially impact many users if they enable qlog. qlog is disabled by default. Due to its overhead, it is most likely used for debugging purpose, but the actual use is unknown. ngtcp2 v1.9.1 fixes the bug and users are advised to upgrade. Users unable to upgrade should not turn on qlog.

Weakness: CWE-670 (Always-Incorrect Control Flow Implementation)

## Which versions are affected by CVE-2024-52811?


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `ngtcp2` | openSUSE:Tumbleweed | All versions | 1.10.0-1.1 |

## How do I fix CVE-2024-52811?

Upgrade to a fixed version.

## Is CVE-2024-52811 being exploited?

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

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2024-52811 and fix it if it is affected.

What it is: CVE-2024-52811 is a high-severity vulnerability in ngtcp2, published on 25 Nov 2024. 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-2024-52811 in the wild and no public exploit code.

Affected product: ngtcp2. 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-2024-52811/ (Markdown: https://insights.sbomify.com/CVE-2024-52811/index.md)
```

## Sources

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

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