CVE-2026-59821 — litellm
Fix: BerriAI/litellm@e50b448CVE-2026-59821 is a Code Injection vulnerability in litellm. A fix is available for litellm — see the affected versions and patch details below.
LiteLLM: Custom Code Guardrails production endpoints bypass code safety checks
Exploitation Status
No confirmed exploitation observed yet
- CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.
Exploitation and automatability from CISA’s SSVC triage for CVE-2026-59821.
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
Real-World Exposure
litellmReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects PyPI packages — download data is not available via public APIs for these ecosystems.
Description
Impact
LiteLLM's Custom Code Guardrails production create/update paths did not apply the same sandboxing and validation used by the test endpoint.
A privileged user with access to create or update guardrails could submit custom Python code that executed in the LiteLLM proxy environment. In deployments without a configured master key, callers could be treated as proxy administrators, making this reachable without intended administrative authorization.
This could allow arbitrary code execution in the LiteLLM proxy container and exposure of secrets available to the process.
Patches
The issue is fixed in 1.82.0-stable.
LiteLLM recommend upgrading to 1.82.0-stable or later.
Workarounds
If upgrading is not immediately possible:
- Restrict access to
POST /guardrailsandPUT /guardrails/{guardrail_id}to trusted administrators only. - Ensure
LITELLM_MASTER_KEYis configured. - Avoid enabling Custom Code Guardrails for untrusted users.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 🐍PyPI | litellm | all versions | 1.82.0pip install --upgrade 'litellm==1.82.0' |
Affected Products
litellmlitellmDetection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for litellm, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update litellm to 1.82.0 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-59821 is resolved across your whole dependency graph.
Workarounds
Stop passing untrusted input into the interpreter or shell: call the affected binary with an argument array rather than a composed command string, reject anything outside a strict allowlist of expected values, and run the component under an account that cannot reach beyond the work it legitimately does.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
Red Hat rates this flaw with higher severity than the upstream GitHub Security Advisory (GHSA-72m8-9m7m-h278, CVSS v4.0 2.1, Low). Red Hat scored this CVSS:3.1/AV:N/AC:L/PR:H/UI:N/S:U/C:H/I:H/A:H (7.2, Important) because a successful exploit grants arbitrary Python code execution within the LiteLLM proxy process,…
Upgrade litellm to 1.82.0 or later, which enforces the same code-safety checks on the guardrail create/update endpoints as the test endpoint. If upgrading is not immediately possible, restrict access to POST /guardrails and PUT /guardrails/{guardrail_id} to trusted administrators only, ensure LITELLM_MASTER_KEY is configured so unauthenticated callers are not treated as proxy administrators, and avoid enabling Custom Code Guardrails for untrusted users.Source: Red Hat security advisory for CVE-2026-59821 (CC BY 4.0)
Frequently Asked Questions
Is CVE-2026-59821 in your dependencies?
Find it across PyPI, including transitive dependencies.