Vulnerability · Published Apr 10, 2024 · Assigned by @huntr_ai
CVE-2024-2952Server-Side Template Injection in BerriAI/litellm
Critical 9.8
In plain English
A critical-severity security flaw in berriai/litellm from berriai. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 1.3% (higher than 70% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.
Official description
BerriAI/litellm is vulnerable to Server-Side Template Injection (SSTI) via the `/completions` endpoint. The vulnerability arises from the `hf_chat_template` method processing the `chat_template` parameter from the `tokenizer_config.json` file through the Jinja template engine without proper sanitization. Attackers can exploit this by crafting malicious `tokenizer_config.json` files that execute arbitrary code on the server.
Affected packages & fixed versions
| Ecosystem | Package | Fixed in | Advisory |
|---|---|---|---|
| PyPI | litellm | 1.34.42 | GHSA-46cm-pfwv-cgf8 |
| PyPI | litellm | 1.34.42 | PYSEC-2026-387 |
Affected products (as reported)
| Vendor | Product | Versions |
|---|---|---|
| berriai | berriai/litellm | unspecified – before 1.34.42 |
Weakness: CWE-76 · Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H