CVE-2026-42203: LiteLLM Server-Side Template Injection Vulnerability

HIGH
Advisory Identifier: GHSA-xqmj-j6mv-4862
CWE-1336
Published
Advisory Summary

CVE-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

CVE Identifier CVE-2026-42203
GHSA Identifier GHSA-xqmj-j6mv-4862
Severity HIGH
CVSS v3.1 Base Score N/A
CWE Classification CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine
Affected Product LiteLLM
Package Ecosystem PyPI
Published Date
Last Updated

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.

litellm fixed: 1.83.7
pip install litellm>=1.83.7
Verify Direct and Transitive Dependencies

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

### 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: 1. Block `POST /prompts/test` at your reverse proxy or API gateway. 2. Review and rotate API keys that should not have access to prompt management routes.

CVE-2026-42203 Affected LiteLLM Versions

1 component(s)
Fixed Versions:
1.83.7
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?
CVE-2026-42203 is a security vulnerability in LiteLLM involving Server-Side Template Injection in /prompts/test endpoint under CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine.
Which LiteLLM versions are affected?
Affected versions include releases prior to 1.83.7 across affected packages: litellm.
What version fixes CVE-2026-42203?
Upgrading to 1.83.7 (or the latest patched release for your respective branch) resolves the vulnerability.
Is litellm affected?
Yes, litellm is affected in releases prior to 1.83.7. Upgrade your dependency to 1.83.7 or later.
What CWE is associated with CVE-2026-42203?
CVE-2026-42203 is classified under CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine (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.).
How can I check PyPI dependencies for CVE-2026-42203?
Run the dependency tree command: 'pip show litellm'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "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"
  }
}