NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · LiteLLM

CVE-2026-37004: LiteLLM vulnerable to server-side template injection in the /prompts/test endpoint

criticalCVSS 3.1 9.8GHSA-6wvf-77m9-58rm

LiteLLM, the Python LLM gateway, has a server-side template injection in the `/prompts/test` endpoint. A remote attacker can send a crafted `dotprompt_content` value and run OS commands on the proxy host. The advisory describes it as unauthenticated and rates it 9.8. Upgrade the `litellm` package to 1.83.7.

Published Aug 27, 2026 · Updated Sep 8, 2026 · Analysis Oct 25, 2026

What an attacker can do

The /prompts/test endpoint renders a prompt template that the caller supplies in dotprompt_content. The proxy rendered it with a plain jinja2.Environment, which has no sandbox. A Jinja expression can walk Python object attributes (for example through __class__ and __mro__) and reach functions that start processes. The result is arbitrary command execution as the user running the LiteLLM proxy.

The advisory says the attacker needs no account and no user interaction, only network access to the proxy. A LiteLLM proxy usually holds the upstream provider API keys, the master key and the database connection string. Code execution on it exposes all of them, and lets the attacker read or alter every prompt and response that passes through. An internet-exposed proxy is the worst case. Teams that run it behind an internal network are exposed to anyone who can reach it from there.

Who is affected

The litellm pip package is affected in versions below 1.83.7. The advisory text names <=1.82.4, but the package data lists everything below 1.83.7, so treat any older release as vulnerable. Only deployments that run the proxy server and expose /prompts/test matter in practice.

Check the installed version:

pip show litellm

If you run the proxy from a container image, check the version the image ships.

litellm

Ecosystem
PyPI
Affected
< 1.83.7
Fixed in
1.83.7
Check
pip show litellm

How to fix it

Upgrade to 1.83.7:

pip install --upgrade "litellm>=1.83.7"

The fix commit switches the prompt manager to Jinja's ImmutableSandboxedEnvironment, with a code comment that templates can arrive from user input through /prompts/test. The same commit also restricts setting allowed_routes on a key to proxy admins and validates logo_url and favicon_url values. The advisory lists no workaround. Until you upgrade, block access to /prompts/test at your reverse proxy or firewall, and rotate provider keys and the master key if the proxy was reachable by untrusted clients.

How to tell if you were hit

Look in your proxy access logs for requests to /prompts/test, especially POST bodies whose dotprompt_content contains Jinja syntax such as {{, {%, __class__, __mro__, __subclasses__ or os.popen. Legitimate use of this endpoint is rare, so any request from an unexpected source is worth checking.

On the host, look for child processes of the LiteLLM server (shells, curl, wget), new outbound connections, and unexpected files in the working directory. If you suspect a hit, treat every secret in the proxy environment as exposed.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

BerriAI litellm <=1.82.4 is vulnerable to Server-Side Template Injection (SSTI), which allows unauthenticated remote attackers to execute arbitrary OS commands via a crafted dotprompt_content parameter in the /prompts/test endpoint due to use of an unsandboxed jinja2.Environment.

Questions

Does CVE-2026-37004 need authentication?

The advisory says unauthenticated remote attackers can exploit it. The fix commit page does not state what authentication the endpoint requires, so assume any client that can reach the proxy can try it.

Which LiteLLM version fixes CVE-2026-37004?

Version 1.83.7. It replaces the unsandboxed Jinja environment in the prompt manager with an immutable sandboxed one.

Is CVE-2026-37004 exploited in the wild?

Not as far as the sources say. It is not in CISA's Known Exploited Vulnerabilities catalog, and the advisory reports no exploitation. A public write-up is linked from the references, so patch promptly.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More LiteLLM vulnerabilities

All LiteLLM entries