# CVE-2026-27940: llama.cpp has a Heap Buffer Overflow via Integer Overflow in `mem_size` Calculation — Bypass of CVE-2025-53630 Fix

- Severity: High 7.8 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.21%, higher than 12% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-03-12T16:39:37.463Z
- Modified: 2026-06-17T10:27:56.667Z
- Weaknesses: CWE-122, CWE-190
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact total
- Assigned by: GitHub_M

## Description

llama.cpp is an inference of several LLM models in C/C++. Prior to b8146, the gguf_init_from_file_impl() in gguf.cpp is vulnerable to an Integer overflow, leading to an undersized heap allocation. Using the subsequent fread() writes 528+ bytes of attacker-controlled data past the buffer boundary. This is a bypass of a similar bug in the same file - CVE-2025-53630, but the fix overlooked some areas. This vulnerability is fixed in b8146.

(As written by CVE List.)

## Affected

- ggml-org llama.cpp: < b8146
- ggml llama.cpp: before b8146

## References

- <https://github.com/ggml-org/llama.cpp/security/advisories/GHSA-3p4r-fq3f-q74v> (exploit, vendor-advisory)

## Sources

- CVE List: [CVE-2026-27940](https://www.cve.org/CVERecord?id=CVE-2026-27940), CVE Terms of Use, modified 2026-03-14
- NVD: [CVE-2026-27940](https://nvd.nist.gov/vuln/detail/CVE-2026-27940), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2026-27940 · Whole record: https://cve.day/CVE-2026-27940.json · Rebuilt by cve.day 2026-11-25T22:59:15.831Z
