CVE-2026-42203: LiteLLM: Server-Side Template Injection in /prompts/test endpoint
LiteLLM Proxy from 1.80.5 up to 1.83.6 renders user-supplied prompt templates unsandboxed at POST /prompts/test. Any caller with a valid proxy API key can run code inside the proxy process. The fix is 1.83.7 (1.83.7-stable).
Published Apr 24, 2026 · Updated May 12, 2026 · Analysis Oct 29, 2026
What an attacker can do
The POST /prompts/test endpoint takes a prompt template from the caller and renders it with no sandbox. A crafted template can reach Python internals and run arbitrary code inside the LiteLLM Proxy process. This is server-side template injection.
The endpoint only checks that the caller holds a valid proxy API key. It does not require an admin key. So a low-privilege key, such as one issued to a developer or an application, is enough. That is why the CVSS vector says low privileges and no user interaction.
The proxy is a gateway that holds the keys for every model provider behind it. Code execution in its process exposes provider API keys and database credentials in the environment, and lets the attacker run commands on the host. A team that gives many users or services keys to a shared LiteLLM gateway should treat each of those keys as a path to the gateway's secrets.
Who is affected
The pip package litellm is affected from 1.80.5 up to but not including 1.83.7. Only proxy deployments that expose the endpoint are in scope. Check the version:
pip show litellmFor Docker, check the image tag you run. The patched image is tagged v1.83.7-stable.
litellm
- Ecosystem
- PyPI
- Affected
- >= 1.80.5, < 1.83.7
- Fixed in
- 1.83.7
- Check
pip show litellm
How to fix it
Upgrade to 1.83.7-stable or later:
pip install --upgrade litellm==1.83.7The fix switches the prompt template renderer to a sandboxed environment that blocks the attributes the attack relies on.
If you cannot upgrade yet, the advisory gives two workarounds. Block POST /prompts/test at your reverse proxy or API gateway. Review and rotate API keys that should not reach prompt management routes. If a key could have been abused, also rotate the provider keys and database credentials the proxy holds.
How to tell if you were hit
Search proxy and reverse-proxy access logs for POST /prompts/test, especially from keys that have no reason to manage prompts. Inspect the request bodies for template syntax such as double braces and underscore attribute names, which a sandbox-escape payload needs. On the host, look for child processes started by the LiteLLM process and unexpected outbound connections. Rotate any secrets in the proxy environment if you find a suspicious call.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
Impact
The POST /prompts/test endpoint accepted user-supplied prompt templates and rendered them without sandboxing. A crafted template could run arbitrary code inside the LiteLLM Proxy process.
The endpoint only checks that the caller presents a valid proxy API key, so any authenticated user could reach it. Depending on how the proxy is deployed, this could expose secrets in the process environment (such as provider API keys or database credentials) and allow commands to be run on the host.
Proxy deployments running an affected version are in scope.
Patches
The issue is fixed in `1.83.7-stable`. The fix switches the prompt template renderer to a sandboxed environment that blocks the attributes this attack relies on.
LiteLLM recommends upgrading to 1.83.7-stable or later.
Workarounds
If upgrading is not immediately possible:
- Block
POST /prompts/testat your reverse proxy or API gateway. - Review and rotate API keys that should not have access to prompt management routes.
Questions
- Do I need an admin key to exploit the /prompts/test flaw?
No. The endpoint checks only that the caller has a valid proxy API key, so any authenticated user can reach it.
- Which LiteLLM versions are affected by CVE-2026-42203?
Versions from 1.80.5 up to but not including 1.83.7. The fix ships in 1.83.7-stable.
- Can I mitigate without upgrading?
Yes, partly. Block POST /prompts/test at your gateway and rotate keys that should not access prompt management routes. Upgrading is the real fix.
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 entriesCVE-2026-114612
LiteLLM: Privilege Escalation to Proxy Admin via Cross-Domain Reuse of the Salt Key
high9.9Oct 27, 2026GHSA-g5ff-637f-6q2m
LiteLLM: internal_user_viewer arbitrary local file read via `vertex_ai_credentials`
high8.1Oct 27, 2026GHSA-hhww-mrg2-969h
LiteLLM vulnerable to reflected XSS in /sso/debug/callback
medium6.8Oct 27, 2026CVE-2026-84377
LiteLLM: Authenticated SSRF and provider-credential exfiltration via unvalidated request-body routing parameters
medium6.5Sep 30, 2026CVE-2026-59823
LiteLLM Proxy has server-side request forgery via the `user_config` request parameter
medium5.3Sep 17, 2026CVE-2026-37004
LiteLLM vulnerable to server-side template injection in the /prompts/test endpoint
critical9.8Aug 27, 2026
