CVE-2024-58400llama.cpp before b3701 Out-of-Bounds Read in llama_decode via Token IDs
llama.cpp before b3701 contains an out-of-bounds read vulnerability in llama_decode_internal and llama_encode_internal that allows remote unauthenticated attackers to read memory by supplying unvalidated token IDs. Attackers can send integer-array prompts to the llama-server /completion endpoint with IDs outside 0 to n_vocab to read embedding memory out of bounds or crash the process.
What to do
Ubuntu has not shipped a fix for every release yet.
Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.
curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \ -H "Content-Type: text/plain" --data-binary @inventory.txt
Vendor status at a glance
Status by vendor and release
From each vendor's own security data and VEX statements. "Fixed" means a fixed build is published for that release.
| Release | Package | Status | Fixed version | Advisory |
|---|---|---|---|---|
| Ubuntu 26.10 | llama.cpp | Fix pending | UBUNTU-CVE-2024-58400 | |
| Ubuntu 26.04 | llama.cpp | Under investigation | UBUNTU-CVE-2024-58400 |
What the vendor says
As published in the CVE record by VulnCheck, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.
- ggml-org llama.cpp: affected: before b3701
Vendor advisories:
- https://github.com/ggml-org/llama.cpp/pull/9359 (patch)
- https://github.com/ggml-org/llama.cpp/commit/faf69d4237c9ae4d7f572b4674d1002463e8acd3 (patch)
- https://github.com/ggml-org/llama.cpp/commit/eae597182cb61bbde0b26e7cec5999d28b9327fe (patch)
- https://github.com/ggml-org/llama.cpp/releases/tag/b3701 (release-notes)
References
- https://github.com/ggml-org/llama.cpp/pull/9359
- https://github.com/ggml-org/llama.cpp/commit/faf69d4237c9ae4d7f572b4674d1002463e8acd3
- https://github.com/ggml-org/llama.cpp/commit/eae597182cb61bbde0b26e7cec5999d28b9327fe
- https://github.com/ggml-org/llama.cpp/blob/b3681/examples/server/server.cpp#L789
- https://github.com/ggml-org/llama.cpp/releases/tag/b3701
- https://www.vulncheck.com/advisories/llama-cpp-before-b3701-out-of-bounds-read-in-llama-decode-via-token-ids
About this page
Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.