CVE-2024-2952CWE-76

Server-Side Template Injection in BerriAI/litellm

Critical · published April 10, 2024

CVSS v3.0
9.8
EPSS
1%
Percentile
69.5
In the wild
Unconfirmed
What it is

🔥 Who knew that a seemingly harmless template could turn into a full-blown disaster? A Server-Side Template Injection (SSTI) vulnerability in BerriAI/litellm allows malicious attackers to execute arbitrary code through the `/completions` endpoint! 🚨 Think of it like a restaurant that doesn’t check the ingredients of the meals it serves. A sneaky chef could swap in toxic ingredients, turning a delightful dish into a health hazard! In this case, the `chat_template` parameter is processed without proper sanitization, leaving the kitchen wide open for trouble. This vulnerability could lead attackers straight into the server, allowing them to run arbitrary code — potentially altering, deleting, or stealing sensitive data at will. The consequences could be absolutely devastating, jeopardizing not just the application but also the safety of users' information.

Put simply

Think of it like a restaurant that doesn’t check the ingredients of the meals it serves. A sneaky chef could swap in toxic ingredients, turning a delightful dish into a health hazard! In this case, the `chat_template` parameter is processed without proper sanitization, leaving the kitchen wide open for trouble. This Server-Side Template Injection vulnerability arises from the `hf_chat_template` method processing the `chat_template` parameter from the `tokenizer_config.json` file via the Jinja template engine without proper sanitization, making it susceptible to code injection.

What to do

This vulnerability could lead attackers straight into the server, allowing them to run arbitrary code — potentially altering, deleting, or stealing sensitive data at will. The consequences could be absolutely devastating, jeopardizing not just the application but also the safety of users' information. Immediate action is crucial! Patch to the latest version as soon as it's available and ensure that the `tokenizer_config.json` file is properly sanitized before processing to mitigate risks. Review your server’s template handling practices to tighten security further. Don't fret! You can fix this by following the steps above and locking down your application — security hero status: activated! 🛡️

The record
Technical detail
CVSS v3.0
9.8 · CRITICAL
Vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.01267 · 69.5th percentile
Weakness
CWE-76 · Improper Neutralization of Equivalent Special Elements
Published
2024-04-10T17:07Z
EPSS history
Timeline
  • 10 APR 17:07Z
    Server-Side Template Injection in BerriAI/litellm
    cvelistv5