{
  "schemaVersion": "guard-threat-campaign/v1",
  "id": "HGTC-2026-65EEAEF3",
  "slug": "cve-2026-40217-litellm-guardrail-sandbox-escape-cisa-kev",
  "title": "Attackers are using a LiteLLM guardrail sandbox escape to take over the proxy that holds your AI keys (CVE-2026-40217, CISA KEV)",
  "aliases": [
    "CVE-2026-40217",
    "GHSA-wxxx-gvqv-xp7p",
    "PYSEC-2026-2601",
    "X41-2026-001"
  ],
  "summary": "LiteLLM's POST /guardrails/test_custom_code endpoint lets a proxy admin test a custom Python guardrail. In 1.81.8 to 1.83.9 the code ran in a hand-built sandbox that only scanned source text for banned names. X41 D-Sec showed that building those names from string pieces and rewriting a generator's bytecode reaches the real __import__ through a sandbox helper, giving arbitrary command execution in the proxy process. That exposes stored provider API keys, the master key and traffic. A full public exploit has been available since 2026-04-08; BerriAI replaced the sandbox with RestrictedPython in PR #25818 (merged 2026-04-15). GitHub's advisory text says fixed in 1.83.11 while its range and OSV say 1.83.10; HOL compared the PyPI wheels and found the same RestrictedPython sandbox in 1.83.9, 1.83.10 and 1.83.11, so 1.83.11 is the conservative floor. CISA added the CVE to KEV on 2026-11-18 with a 2026-12-02 due date.",
  "status": "published",
  "severity": "high",
  "confidence": "high",
  "uncertainty": "CISA has not published who is exploiting the bug or against whom; ransomware use is listed as unknown. Sources disagree on whether 1.83.10 or 1.83.11 is the first fixed release.",
  "firstObservedAt": "2026-02-13T00:00:00Z",
  "lastObservedAt": "2026-11-18T00:00:00Z",
  "publishedAt": "2026-11-18T19:49:51.042Z",
  "reviewedAt": "2026-11-18T19:49:43.066Z",
  "expiresAt": "2026-11-18T00:00:00Z",
  "reviewer": "HOL Guard Security Publishing",
  "sources": [
    {
      "id": "ghsa-wxxx-gvqv-xp7p",
      "label": "GitHub advisory GHSA-wxxx-gvqv-xp7p: LiteLLM has a sandbox escape in custom-code guardrail",
      "url": "https://github.com/BerriAI/litellm/security/advisories/GHSA-wxxx-gvqv-xp7p",
      "sourceType": "maintainer_advisory",
      "observedAt": "2026-05-11T16:17:23Z"
    },
    {
      "id": "x41-advisory",
      "label": "X41 D-Sec advisory X41-2026-001: Guardrail Sandbox Escape in LiteLLM",
      "url": "https://www.x41-dsec.de/lab/advisories/x41-2026-001-litellm/",
      "sourceType": "research",
      "observedAt": "2026-04-08T00:00:00Z"
    },
    {
      "id": "fix-pr-25818",
      "label": "BerriAI/litellm PR #25818: replace custom_code sandbox with RestrictedPython",
      "url": "https://github.com/BerriAI/litellm/pull/25818",
      "sourceType": "other_primary",
      "observedAt": "2026-11-18T00:00:00Z"
    },
    {
      "id": "release-1-83-10-stable",
      "label": "LiteLLM v1.83.10-stable release",
      "url": "https://github.com/BerriAI/litellm/releases/tag/v1.83.10-stable",
      "sourceType": "other_primary",
      "observedAt": "2026-11-18T00:00:00Z"
    },
    {
      "id": "nvd-40217",
      "label": "NVD: CVE-2026-40217",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-40217",
      "sourceType": "vulnerability_database",
      "observedAt": "2026-11-18T00:00:00Z"
    },
    {
      "id": "osv-ghsa",
      "label": "OSV: GHSA-wxxx-gvqv-xp7p",
      "url": "https://osv.dev/vulnerability/GHSA-wxxx-gvqv-xp7p",
      "sourceType": "vulnerability_database",
      "observedAt": "2026-11-18T00:00:00Z"
    },
    {
      "id": "cisa-kev",
      "label": "CISA Known Exploited Vulnerabilities catalog",
      "url": "https://www.cisa.gov/known-exploited-vulnerabilities-catalog",
      "sourceType": "government",
      "observedAt": "2026-11-18T00:00:00Z"
    },
    {
      "id": "hol-blog",
      "label": "HOL blog: LiteLLM CVE-2026-40217 on CISA KEV, how to fix",
      "url": "https://hol.org/blog/cve-2026-40217-litellm-guardrail-sandbox-escape-cisa-kev",
      "sourceType": "other_primary",
      "observedAt": "2026-11-18T19:43:00Z"
    }
  ],
  "artifacts": [
    {
      "id": "litellm-pypi-affected",
      "artifactClass": "package",
      "ecosystem": "PyPI",
      "name": "litellm",
      "version": ">=1.81.8, <1.83.10 (OSV range); upgrade to 1.83.11 or later per advisory text",
      "defanged": false
    }
  ],
  "indicators": [],
  "timeline": [
    {
      "id": "researcher-found-escape",
      "occurredAt": "2026-02-13T00:00:00Z",
      "eventType": "first_observed",
      "summary": "X41 D-Sec identifies the guardrail sandbox escape and builds a proof of concept.",
      "sourceIds": [
        "x41-advisory"
      ]
    },
    {
      "id": "x41-advisory-published",
      "occurredAt": "2026-04-08T00:00:00Z",
      "eventType": "disclosure",
      "summary": "Embargo expires; X41 publishes advisory X41-2026-001 with a full working exploit before a patch exists.",
      "sourceIds": [
        "x41-advisory"
      ]
    },
    {
      "id": "fix-merged-restrictedpython",
      "occurredAt": "2026-04-15T23:50:10Z",
      "eventType": "vendor_action",
      "summary": "BerriAI merges PR #25818 replacing the regex-filtered sandbox with RestrictedPython.",
      "sourceIds": [
        "fix-pr-25818"
      ]
    },
    {
      "id": "ghsa-published",
      "occurredAt": "2026-05-11T16:17:23Z",
      "eventType": "disclosure",
      "summary": "GitHub publishes reviewed advisory GHSA-wxxx-gvqv-xp7p.",
      "sourceIds": [
        "ghsa-wxxx-gvqv-xp7p",
        "osv-ghsa"
      ]
    },
    {
      "id": "cisa-kev-added",
      "occurredAt": "2026-11-18T00:00:00Z",
      "eventType": "other",
      "summary": "CISA adds CVE-2026-40217 to the Known Exploited Vulnerabilities catalog with a 2026-12-02 due date.",
      "sourceIds": [
        "cisa-kev"
      ]
    },
    {
      "id": "hol-blog-published",
      "occurredAt": "2026-11-18T19:43:00Z",
      "eventType": "other",
      "summary": "HOL publishes the operator write-up with version check, log check and workaround.",
      "sourceIds": [
        "hol-blog"
      ]
    }
  ],
  "coverage": [],
  "policies": [],
  "limitations": [
    "LiteLLM 1.81.7 and earlier do not have the vulnerable endpoint.",
    "LiteLLM 1.83.11 and later are fixed.",
    "Using litellm only as a Python SDK without running the proxy server is not affected.",
    "Callers with only team or user virtual keys cannot reach the endpoint; an attacker needs the master key or an admin account."
  ],
  "correctionHref": "/guard/security/campaigns/cve-2026-40217-litellm-guardrail-sandbox-escape-cisa-kev/corrections"
}
