CVE-2026-42203: LiteLLM Server-Side Template Injection Vulnerability
HIGHCVE-2026-42203 is a HIGH server-side template injection vulnerability (CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine) affecting LiteLLM libraries in the PyPI ecosystem. The issue involves server-side template injection in /prompts/test endpoint. Remediation is available by upgrading affected packages to version 1.83.7.
CVE-2026-42203 at a Glance
How to Fix CVE-2026-42203
To remediate this vulnerability, upgrade all affected LiteLLM dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install litellm>=1.83.7
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show litellm
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-42203, inspect your installed packages using pip:
pip show litellm
Analyze the terminal output to locate any version of LiteLLM in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.83.7), your application is affected.
Note: The pip show litellm command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine, where the product uses a template engine to insert or process externally-influenced input, but it does not neutralize or incorrectly neutralizes special elements or syntax that can be interpreted as template expressions or other code directives when processed by the engine. In LiteLLM, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-42203 Affected LiteLLM Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
litellm
|
PyPI |
≥ 1.80.5
< 1.83.7
|
1.83.7
|
References
Frequently Asked Questions
What is CVE-2026-42203?
Which LiteLLM versions are affected?
What version fixes CVE-2026-42203?
Is litellm affected?
What CWE is associated with CVE-2026-42203?
How can I check PyPI dependencies for CVE-2026-42203?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-xqmj-j6mv-4862",
"modified" : "2026-05-12T13:27:01Z",
"published" : "2026-04-24T16:02:42Z",
"aliases" : [ "CVE-2026-42203" ],
"summary" : "LiteLLM: Server-Side Template Injection in /prompts/test endpoint",
"details" : "### Impact\nThe `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.\n\nThe 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.\n\nProxy deployments running an affected version are in scope.\n\n### Patches\nThe 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.\n\nLiteLLM recommends upgrading to `1.83.7-stable` or later.\n\n### Workarounds\nIf upgrading is not immediately possible:\n\n1. Block `POST /prompts/test` at your reverse proxy or API gateway.\n2. Review and rotate API keys that should not have access to prompt management routes.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:N/SC:N/SI:N/SA:N"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "litellm"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.80.5"
}, {
"fixed" : "1.83.7"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/BerriAI/litellm/security/advisories/GHSA-xqmj-j6mv-4862"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-42203"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/BerriAI/litellm"
}, {
"type" : "WEB",
"url" : "https://github.com/BerriAI/litellm/releases/tag/v1.83.7-stable"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-1336" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-04-24T16:02:42Z",
"nvd_published_at" : "2026-05-08T04:16:19Z"
}
}