Advisory

PYSEC-2026-2601

Also known as: CVE-2026-40217, GHSA-wxxx-gvqv-xp7p

Summary

LiteLLM has a sandbox escape in custom-code guardrail

Details

Impact

The POST /guardrails/test_custom_code endpoint runs user-supplied Python inside a hand-rolled sandbox. The sandbox can be escaped using bytecode-level techniques, allowing arbitrary code execution in the proxy process — which runs as root in the default Docker image.

Reaching the endpoint requires a proxy-admin credential in default configurations.

Patches

Fixed in `1.83.11`. The hand-rolled sandbox has been replaced with RestrictedPython. Upgrade to 1.83.11 or later.

Workarounds

If upgrading is not immediately possible, block POST /guardrails/test_custom_code at your reverse proxy or API gateway.

References

Severity

High Basis: CVSS v3 score 8.8, vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Dates

Published
2026-07-13 15:15 UTC
Modified
2026-07-13 16:32 UTC

Affected packages and fixes

litellm

PyPI · All systems

Affected

  • introduced 1.81.8, fixed 1.83.10 (ecosystem)

Fixed versions

1.83.10

Fix

  • Fixed version 1.83.10
    pip install --upgrade litellm==1.83.10

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: PyPA Advisory Database · CC BY 4.0

Sources & licences