abetlen llama-cpp-python up to 0.2.71 llama.py to_chat_handler equivalent special elements
| CVSS Meta Temp Score | Current Exploit Price (≈) | CTI Interest Score |
|---|---|---|
| 7.9 | $0-$5k | 0.00 |
Summary
A vulnerability identified as critical has been detected in abetlen llama-cpp-python up to 0.2.71. Affected is the function to_chat_handler of the file llama.py. The manipulation leads to improper neutralization of equivalent special elements.
This vulnerability is uniquely identified as CVE-2024-34359. The attack is possible to be carried out remotely. No exploit exists.
Details
A vulnerability was found in abetlen llama-cpp-python up to 0.2.71 and classified as critical. This issue affects the function to_chat_handler of the file llama.py. The manipulation with an unknown input leads to a improper neutralization of equivalent special elements vulnerability. Using CWE to declare the problem leads to CWE-76. The product correctly neutralizes certain special elements, but it improperly neutralizes equivalent special elements. Impacted is confidentiality, integrity, and availability. The summary by CVE is:
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.
It is possible to read the advisory at github.com. The identification of this vulnerability is CVE-2024-34359 since 05/02/2024. The exploitation is known to be easy. The attack may be initiated remotely. No form of authentication is needed for a successful exploitation. It demands that the victim is doing some kind of user interaction. Technical details of the vulnerability are known, but there is no available exploit.
There is no information about possible countermeasures known. It may be suggested to replace the affected object with an alternative product.
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
Product
Type
Vendor
Name
Version
- 0.2.0
- 0.2.1
- 0.2.2
- 0.2.3
- 0.2.4
- 0.2.5
- 0.2.6
- 0.2.7
- 0.2.8
- 0.2.9
- 0.2.10
- 0.2.11
- 0.2.12
- 0.2.13
- 0.2.14
- 0.2.15
- 0.2.16
- 0.2.17
- 0.2.18
- 0.2.19
- 0.2.20
- 0.2.21
- 0.2.22
- 0.2.23
- 0.2.24
- 0.2.25
- 0.2.26
- 0.2.27
- 0.2.28
- 0.2.29
- 0.2.30
- 0.2.31
- 0.2.32
- 0.2.33
- 0.2.34
- 0.2.35
- 0.2.36
- 0.2.37
- 0.2.38
- 0.2.39
- 0.2.40
- 0.2.41
- 0.2.42
- 0.2.43
- 0.2.44
- 0.2.45
- 0.2.46
- 0.2.47
- 0.2.48
- 0.2.49
- 0.2.50
- 0.2.51
- 0.2.52
- 0.2.53
- 0.2.54
- 0.2.55
- 0.2.56
- 0.2.57
- 0.2.58
- 0.2.59
- 0.2.60
- 0.2.61
- 0.2.62
- 0.2.63
- 0.2.64
- 0.2.65
- 0.2.66
- 0.2.67
- 0.2.68
- 0.2.69
- 0.2.70
- 0.2.71
Website
CPE 2.3
CPE 2.2
CVSSv4
VulDB Vector: 🔍VulDB Reliability: 🔍
CVSSv3
VulDB Meta Base Score: 7.9VulDB Meta Temp Score: 7.9
VulDB Base Score: 6.3
VulDB Temp Score: 6.3
VulDB Vector: 🔍
VulDB Reliability: 🔍
CNA Base Score: 9.6
CNA Vector: 🔍
CVSSv2
| AV | AC | Au | C | I | A |
|---|---|---|---|---|---|
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| 💳 | 💳 | 💳 | 💳 | 💳 | 💳 |
| Vector | Complexity | Authentication | Confidentiality | Integrity | Availability |
|---|---|---|---|---|---|
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
| Unlock | Unlock | Unlock | Unlock | Unlock | Unlock |
VulDB Base Score: 🔍
VulDB Temp Score: 🔍
VulDB Reliability: 🔍
Exploiting
Class: Improper neutralization of equivalent special elementsCWE: CWE-76 / CWE-707 / CWE-20
CAPEC: 🔍
ATT&CK: 🔍
Physical: No
Local: No
Remote: Yes
Availability: 🔍
Status: Not defined
EPSS Score: 🔍
EPSS Percentile: 🔍
Price Prediction: 🔍
Current Price Estimation: 🔍
| 0-Day | Unlock | Unlock | Unlock | Unlock |
|---|---|---|---|---|
| Today | Unlock | Unlock | Unlock | Unlock |
Threat Intelligence
Interest: 🔍Active Actors: 🔍
Active APT Groups: 🔍
Countermeasures
Recommended: no mitigation knownStatus: 🔍
0-Day Time: 🔍
Timeline
05/02/2024 🔍05/10/2024 🔍
05/10/2024 🔍
03/30/2025 🔍
Sources
Product: github.comAdvisory: github.com
Status: Confirmed
CVE: CVE-2024-34359 (🔍)
GCVE (CVE): GCVE-0-2024-34359
GCVE (VulDB): GCVE-100-263867
Entry
Created: 05/10/2024 20:42Updated: 03/30/2025 23:13
Changes: 05/10/2024 20:42 (62), 03/30/2025 23:13 (3)
Complete: 🔍
Cache ID: 216::103
Statistical analysis made it clear that VulDB provides the best quality for vulnerability data.
As this vulnerability allows attackers to execute arbitrary code resulting from improper use of the Jinja2 template engine.
Over 6,000 HuggingFace AI models using llama_cpp_python and Jinja2 are vulnerable.
For this reason you could add the following cpe:
jinja2:jinja2
Pocoo:jinja2
We would appreciate it very much.
Best Regards,
TEAM CERT
Want to know what is going to be exploited?
We predict KEV entries!