CVE-2024-34359
llama-cpp-python vulnerable to Remote Code Execution by Server-Side Template Injection in Model Metadata
Also known as GHSA-56xg-wfcc-g829, PYSEC-2026-392
Mitigation
- Upgrade llama-cpp-python to 0.2.72 or later.
Who should check
- Projects that depend on PyPI package llama-cpp-python (>= 0.2.30, < 0.2.72)
- Anyone running abetlen llama-cpp-python >= 0.2.30, <= 0.2.71
Vulnerability facts
- Affected
- llama-cpp-python >= 0.2.30, < 0.2.72
- Fixed in
- 0.2.72
- Exploited in the wild
- Not in CISA KEV
- Public exploit / PoC
- None known
- Remote exploitation
- Remote, no login needed
- CVSS
- 9.7 (v3.1, CNA)CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:HOpen in CVSS calculator
Show all 8 CVSS metrics
- Attack vector: Network
- Attack complexity: Low
- Privileges required: None
- User interaction: Required
- Scope: Changed (impact reaches other components)
- Confidentiality impact: High
- Integrity impact: High
- Availability impact: High
- EPSS
- 1.35% chance of exploitation in 30 days (percentile 72, 2026-11-26)
- CWE
- CWE-76
- Modified
Description
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.
Affected and fixed versions
| Package / product | Affected | Fixed | Source |
|---|---|---|---|
| PyPI llama-cpp-python | >= 0.2.30, < 0.2.72 | 0.2.72 | osv |
| abetlen llama-cpp-python | >= 0.2.30, <= 0.2.71 | — | cvelist |
Check your systems with an agent
Paste this into Claude Code, Cursor or another coding agent. It only reads; it changes nothing.
Check whether anything I run is affected by CVE-2024-34359. Work read-only: do not install, upgrade, delete or change anything. Details: https://flawdb.com/CVE-2024-34359.md Affected: llama-cpp-python >= 0.2.30, < 0.2.72 Fixed in: 0.2.72 Steps: 1. Search this machine and project for llama-cpp-python (PyPI), abetlen llama-cpp-python: dependency manifests and lockfiles, installed packages, container images and running services. 2. For each match, note the installed version and whether it is inside the affected range. 3. Report a table: location, installed version, affected (yes / no / unsure), evidence. If affected, say which fixed version or mitigation from the details link applies, but don't apply it.
References
Vendor advisories
FAQ
Is CVE-2024-34359 being exploited?
There is no confirmed exploitation: CVE-2024-34359 is not in the CISA Known Exploited Vulnerabilities catalog. No public exploit code is known. EPSS estimates a 1.35% chance of exploitation in the next 30 days (as of 2026-11-26).
How serious is CVE-2024-34359?
Critical: CVSS 9.7 (v3.1, scored by CNA). Remote, no login needed. A user has to take an action, such as opening a link, for the attack to work.
Which versions are affected by CVE-2024-34359?
llama-cpp-python >= 0.2.30, < 0.2.72.
Is there a fix for CVE-2024-34359?
Yes. Fixed in 0.2.72. Upgrade llama-cpp-python to 0.2.72 or later.
How do I check if I'm affected by CVE-2024-34359?
Find where you use the affected software (dependency lockfiles, installed packages, container images, servers) and compare the installed version with the affected range above. The agent prompt on this page does this read-only.