---
title: "LiteLLM Guardrails Check (CVE-2026-40217)"
canonical: https://trickest.com/library/litellm-guardrails-check-cve-2026-40217
description: "Auth-posture check for the LiteLLM proxy: a status-code-only read of the guardrails test endpoint, fixed version cited from X41's advisory, no code sent."
---

# LiteLLM Guardrails Check (CVE-2026-40217)

## Overview

This workflow checks LiteLLM proxies for CVE-2026-40217, the bytecode-rewriting code execution at the /guardrails/test_custom_code endpoint that CISA's KEV entry describes as an unprotected alternate channel. The gateway holds provider API keys and every downstream integration's traffic, which is exactly the compromise the KEV listing describes. Exploitation normally sits behind proxy-admin credentials, which is consistent with the 8.8 score rather than 9.8, so the workflow's real question is authentication posture: is the dangerous endpoint reachable without credentials. The answer comes from status codes only, never a submitted body, because submitting any code to the guardrails endpoint, valid or not, is bytecode execution on the target. A 200-class answer is a CRITICAL configuration finding on its own. The fixed version is cited from advisory x41-2026-001 rather than guessed. Field context: about 1,718 LiteLLM proxies observed on the standard port. Each host comes back with a verdict you can feed into [exposure management](/use-cases/exposure-management).

## Pipeline

1. Read the target list and send at most three spaced GETs per host: the proxy root for FastAPI-class fingerprint markers, /docs only when the root was inconclusive, and the guardrails test endpoint only after a confirmed LiteLLM fingerprint.
2. The endpoint request is deliberately empty and unauthenticated, and only its status code is read: 401 or 403 means the endpoint exists with proxy-admin auth enforced, a 200-class answer means the unprotected alternate channel condition, and a 404 means the endpoint is absent on this build, which is never claimed as patched.
3. No code is ever submitted, no request body is sent, and no credentials are attempted, because the exploit is a code submission and the admin gate is not this workflow's to test.
4. Fail closed elsewhere: unreachable hosts are error rows, a 5xx is an error row and the scan stops, and hosts without LiteLLM markers are not_litellm.
5. Reconcile one verdict per target and write results plus summary counts, with the KEV and advisory citation carried on the summary.

## Inputs

- **Target list.** LiteLLM proxy addresses, with optional ports, that you are authorized to test. The default file ships a sample host; bind your own.

## Outputs

- **results.jsonl.** One row per host: target, the fingerprint evidence, the status-code observation, verdict, severity, and the advisory citation.
- **summary.json.** One object with the total, verdict counts, the KEV context, and the no-code-submission note.

## Integrations

- HTTP. At most three GETs per host with at least 1.1 seconds of spacing, no bodies, no retries.

## Sample output

The records below are illustrative and do not come from a real run. They show a proxy with the guardrails gate enforced, one where the endpoint answers open, and one where the endpoint is absent.

```jsonl
{"target": "llm-a.example.com", "port": 4000, "guardrails_status": 401, "verdict": "exposed", "detail": "endpoint present, proxy-admin auth enforced; fix per x41-2026-001", "error": null}
{"target": "llm-b.example.org", "port": 4000, "guardrails_status": 200, "verdict": "unprotected", "detail": "CRITICAL configuration finding: the alternate channel answers unauthenticated", "error": null}
{"target": "llm-c.example.net", "port": 4000, "guardrails_status": 404, "verdict": "endpoint_absent", "detail": "endpoint absent on this build: verify against x41-2026-001, never claim patched", "error": null}
```

```json
{"cve": "CVE-2026-40217", "product": "BerriAI LiteLLM proxy", "total_targets": 3, "verdict_counts": {"exposed": 1, "unprotected": 1, "endpoint_absent": 1}, "kev": true, "kev_added": "2026-11-18", "advisory": "x41-2026-001", "field_context": "about 1,718 proxies observed on port 4000"}
```

## FAQ

### Why is a status code enough?

Because the question is authentication posture, and the status code of an unauthenticated GET answers it: 401 or 403 is the gate working, 200 is the unprotected channel, 404 is the endpoint missing. No request body is needed, and a body would be the exploit.

### What does a 200-class answer mean?

It means the guardrails test endpoint answers without credentials, which is the condition CISA's KEV wording calls the unprotected alternate channel. The workflow labels it a CRITICAL configuration finding on its own, independent of the version question, because an open code-execution endpoint is a finding before any exploit touches it.

### Why is 404 never claimed as patched?

Because an absent endpoint is ambiguous: it can mean a fixed or removed route, or a build that predates the guardrails feature. Neither is verifiable from a status code, so the row stays endpoint_absent with the out-of-band verification step.

### What is CVE-2026-40217?

Arbitrary code execution in LiteLLM through bytecode rewriting at the guardrails test endpoint, scored 8.8 by MITRE and the CISA coordinator. KEV-listed 2026-11-18 with exploitation in the wild and EPSS 20.2 percent. The fixed version is cited from advisory x41-2026-001 rather than guessed here.

## Related workflows

- [Langflow Auto-Login RCE Check (CVE-2026-110186)](/library/langflow-autologin-rce-check-cve-2026-110186). Reach for it when the next AI-infrastructure flag is an agent builder instead of an LLM gateway.
- [AWS Loom Exposure Check (CVE-2026-103956)](/library/aws-loom-exposure-check-cve-2026-103956). Reach for it when the next agent-estate flag is a control plane.
- [Full Network Port and Service Assessment](/library/full-network-port-and-service-assessment). Map which hosts expose LLM gateways across the estate first.

---
_Markdown source of https://trickest.com/library/litellm-guardrails-check-cve-2026-40217._
