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.

Severity (CVSS 3.0)9.8Critical
Exploit odds (30 days)1.3%top 30.1% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

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

EcosystemPackageFixed inAdvisory
PyPIlitellm1.34.42GHSA-46cm-pfwv-cgf8
PyPIlitellm1.34.42PYSEC-2026-387

Affected products (as reported)

VendorProductVersions
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

References