PT-2024-25816 · Unknown+1 · Llama Cpp Python+1
Retr0Reg
·
Published
2024-05-10
·
Updated
2025-04-11
·
CVE-2024-34359
CVSS v3.1
9.6
Critical
| AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H |
Name of the Vulnerable Software and Affected Versions
llama-cpp-python (affected versions not specified)
Description
The issue is related to a Server Side Template Injection vulnerability in the
llama-cpp-python package, which allows for remote code execution. This is due to the use of jinja2.Environment without proper sandboxing, enabling an attacker to inject malicious code. The vulnerability is exploited by modifying the chat template in the model's metadata, which is then rendered by the Jinja2ChatFormatter class. This allows an attacker to execute arbitrary code, potentially leading to system compromises. The estimated number of potentially affected devices is not specified, but it is mentioned that over 6,000 AI models on Hugging Face are vulnerable.Recommendations
To resolve the issue, update
llama-cpp-python to version 0.2.72 or later, which includes a fix for the vulnerability. As a temporary workaround, consider disabling the use of jinja2 templates or restricting access to the Jinja2ChatFormatter class until a patch is available. Avoid using the chat template parameter in the affected API endpoint until the issue is resolved.Exploit
Fix
RCE
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Jinja2
Llama Cpp Python