CyberSecBulletin
CVE-2024-2952NVD status: Analyzed

berriai/litellm: Improper Neutralization of Equivalent Special Elements

CVE-2024-2952 is a critical-severity improper neutralization of equivalent special elements vulnerability in berriai/litellm from BerriAI, with a CVSS 3.0 base score of 9.8 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. The record lists version 1.34.42 as the first without the flaw, so updating berriai/litellm to that release or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 1.27% chance of exploitation within 30 days, higher than 70% of scored CVEs.

Patch this week

Critical severity: a successful attack would have severe impact.

What to do

  1. Update berriai/litellm to 1.34.42 or a later version.
  2. Update litellm to 1.34.42 or a later version.
  3. Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.

Affected products and versions

VendorProductAffected versionsFixed in
Berriaiberriai/litellmbefore 1.34.421.34.42
Berriailitellm1.23.2 up to, but not including, 1.34.421.34.42

Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Attack vector
NetworkCan be exploited remotely over a network, including the internet.
Attack complexity
LowNo special conditions are needed; the attack works reliably.
Privileges required
NoneNo account or login is needed.
User interaction
NoneNo action by a victim is required.
Scope
UnchangedImpact stays within the vulnerable component.
Confidentiality
HighAll data handled by the component can be read.
Integrity
HighData or code can be modified at will.
Availability
HighThe component can be taken down completely.

Vector: CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H. Scored by CNA (huntr.dev).

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.

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Improper Neutralization of Equivalent Special Elements

The product correctly neutralizes certain special elements, but it improperly neutralizes equivalent special elements.

How developers prevent this class of flaw

  • Programming languages and supporting technologies might be chosen which are not subject to these issues.
  • Utilize an appropriate mix of allowlist and denylist parsing to filter equivalent special element syntax from all input.

More Improper Neutralization of Equivalent Special Elements vulnerabilities (CWE-76)

Timeline

  1. CVE record published.
  2. CISA published its SSVC assessment (exploitation: poc, automatable: yes, technical impact: total).
  3. Record last changed materially (score, affected products, status or references).

References

Technical write-ups (may include proof of concept)

Other vulnerabilities in berriai/litellm

All berriai/litellm vulnerabilities

Recent Improper Neutralization of Equivalent Special Elements vulnerabilities

Spotted an error? Tell us.