CVE-2024-34359abetlen llama-cpp-python
Critical 9.6 No auth needed
Follow: this CVE · abetlen · abetlen llama-cpp-python We alert you by email or Slack (account required).
- Priority
- 73
- CVSS 3.1
- 9.6
- EPSS
- 1.3% probability of exploitation in 30 days · percentile 72
- Auth required
- No
- Published
- May 14, 2024
- Updated
- Jun 17, 2026
- Category
- Application · Cross-platform
- Weakness (CWE)
- CWE-76
- SSVC (CISA)
- Exploitation: proof of concept · Automatable: no · Technical impact: total
- Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H
What happens
llama-cpp-python is the Python bindings for llama.cpp. `llama-cpp-python` depends on class `Llama` in `llama.py` to load `.gguf` llama.cpp or Latency Machine Learning Models. The `__init__` constructor built in the `Llama` takes several parameters to configure the loading and running of the model. Other than `NUMA, LoRa settings`, `loading tokenizers,` and `hardware settings`, `__init__` also loads the `chat template` from targeted `.gguf` 's Metadata and furtherly parses it to `llama_chat_format.Jinja2ChatFormatter.to_chat_handler()` to construct the `self.chat_handler` for this model. Nevertheless, `Jinja2ChatFormatter` parse the `chat template` within the Metadate with sandbox-less `jinja2.Environment`, which is furthermore rendered in `__call__` to construct the `prompt` of interaction. This allows `jinja2` Server Side Template Injection which leads to remote code execution by a carefully constructed payload.
What to do
- Apply the vendor's security update for llama-cpp-python.
- It can be exploited without authentication: if you cannot patch now, restrict Internet access to the affected service.
Affected packages
| Ecosystem | Package | Affected versions | Fixed in | How to upgrade |
|---|---|---|---|---|
| PyPI | llama-cpp-python |
≥ 0.2.30 < 0.2.72 |
0.2.72 |
pip install "llama-cpp-python>=0.2.72" |
| PyPI | llama-cpp-python |
≥ 0.2.30 < 0.2.72 |
0.2.72 |
pip install "llama-cpp-python>=0.2.72" |
Per OSV / GitHub Advisories (GHSA-56xg-wfcc-g829, PYSEC-2026-392). Check the version in your lockfile before upgrading.
Affected products
- abetlen · llama-cpp-python
As reported by the CNA that published the CVE. NVD has not added CPEs with versions yet.
Official sources
References
Links published by the sources. Open them with care.