CVE-2026-59821: LiteLLM: Custom Code Guardrails production endpoints bypass code safety checks

Published Jul 8, 2026
·
Updated

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:

1. Restrict access to POST /guardrails and PUT /guardrails/{guardrailid} to trusted administrators only. 2. Ensure LITELLMMASTERKEY is configured. 3. Avoid enabling Custom Code Guardrails for untrusted users.

Other sources

LiteLLM is a proxy server (AI Gateway) to call LLM APIs in OpenAI (or native) format. Prior to 1.82.0-stable, LiteLLM's Custom Code Guardrails production create and update paths did not apply the same sandboxing and validation used by the test endpoint, allowing a privileged user with access to create or update guardrails to submit custom Python code that executed in the LiteLLM proxy environment and could expose secrets available to the process. This issue is fixed in version 1.82.0-stable.

MITRE

Affected Software

4 affected componentsFixes available
LiteLLM<1.82.0-stable
LiteLLM LiteLLM<1.82.0
LiteLLM LiteLLM=1.82.0-nightly
pip/litellm<1.82.0
1.82.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade pip/litellm to a version that resolves this vulnerability.

    Fixed in 1.82.0
  2. Upgrade

    Upgrade LiteLLM to a version that resolves this vulnerability.

    Fixed in 1.82.0-stable
  3. Configuration

    Avoid enabling Custom Code Guardrails for untrusted users.

    LiteLLM Custom Code Guardrails Custom Code Guardrails (enable/disable) = disabled
  4. Configuration

    Ensure LITELLM_MASTER_KEY is configured.

    LiteLLM LITELLM_MASTER_KEY = configured
  5. Compensating control

    Restrict access to POST /guardrails and PUT /guardrails/{guardrail_id} to trusted administrators only.

Event History

Jul 8, 2026
CVE Published
via MITRE·07:14 PM
Data Sourced
via MITRE·07:14 PM
DescriptionWeakness
Data Sourced
via NVD·08:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jul 22, 2026
Advisory Published
via GitHub·10:38 PM
Data Sourced
via GitHub·10:38 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-59821?

The severity of CVE-2026-59821 is classified as low with a CVSS score of 4.0.

2

How do I fix CVE-2026-59821?

To fix CVE-2026-59821, update LiteLLM to version 1.82.0-stable or later.

3

What are the potential risks associated with CVE-2026-59821?

The potential risks include bypassing code safety checks, which could lead to code injection vulnerabilities.

4

Which software is affected by CVE-2026-59821?

CVE-2026-59821 affects LiteLLM versions prior to 1.82.0-stable.

5

What component of LiteLLM is impacted by CVE-2026-59821?

CVE-2026-59821 impacts the Custom Code Guardrails production endpoints in LiteLLM.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203