Langflow Unauthenticated Remote Code Execution via `validate/code` Endpoint (CVE-2026-0770)
by Diamorphine · 2026-07-05
- Severity
- Critical
- CVE
- CVE-2026-0770
- Category
- web
- Affected product
- Langflow (AI workflow builder)
- Affected versions
- < 1.3.0 (tested against 1.2.0)
- Disclosed
- 2026-07-05
- Patch status
- patched
Archive entry
intelseclab/poc-archiveMetadata
| Field | Value |
|---|---|
| Date Added | 2026-07-05 |
| Last Updated | 2026-05 |
| Author / Researcher | Diamorphine |
| CVE / Advisory | CVE-2026-0770 |
| Category | web |
| Severity | Critical |
| CVSS Score | Not specified in source |
| Status | PoC |
| Tags | langflow, rce, unauthenticated, python, code-validation, exec, ai-platform, api |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | Langflow (AI workflow builder) |
| Versions Affected | < 1.3.0 (tested against 1.2.0) |
| Language / Platform | Python (PoC); Langflow server (Python/FastAPI backend) |
| Authentication Required | No (auto-login bypass supported; optional creds flow also included) |
| Network Access Required | Yes |
Summary
Langflow exposes an API endpoint (/api/v1/validate/code) that is meant to validate user-submitted Python “component” code before it runs inside a workflow. The endpoint evaluates the submitted code using exec() with an exec_globals context that is not sufficiently sandboxed, so arbitrary Python — including OS command execution via subprocess — runs on the server. The included PoC crafts a small Python snippet that shells out to run an operator-supplied command and smuggles the command’s stdout/stderr back to the attacker by raising it as a validation error message, which the API happily returns in its JSON response. Because Langflow ships an /api/v1/auto_login endpoint that hands out a valid access token with no credentials, the exploit works fully unauthenticated by default, with an optional username/password login path for locked-down instances.
Vulnerability Details
Root Cause
The /api/v1/validate/code endpoint passes attacker-controlled Python source to a code-execution/validation routine that calls exec() without isolating dangerous builtins or the import system. Wrapping a subprocess.run(..., shell=True) call inside a lambda default-argument trick lets the code execute immediately during function definition evaluation, and the result is exfiltrated through the validator’s own error-reporting field.
Attack Vector
- Attacker sends
GET /api/v1/auto_loginto obtain a valid bearer token without credentials (or authenticates normally if auto-login is disabled). - Attacker crafts a Python code string defining a function whose default argument executes
subprocess.run(<attacker command>, shell=True)and raises the captured stdout/stderr as an exception. - Attacker POSTs this code to
/api/v1/validate/codewith the bearer token. - The server executes the code via
exec(), the “exploit” function’s default-argument evaluation runs the command, and the resulting output is embedded in the validation error returned in the JSON response body. - Attacker parses
function.errors[0]from the response to read command output — full RCE as the Langflow server process (commonly root in container deployments).
Impact
Complete remote code execution on the Langflow host with no authentication required, exposing any credentials, API keys, or connected data sources configured in the platform.
Environment / Lab Setup
Target: Langflow < 1.3.0 (e.g. v1.2.0) reachable on TCP/7860
Attacker: Python 3 with httpx installed (pip install httpx)
Proof of Concept
PoC Script
See
CVE-2026-0770.pyin this folder.
| |
The script authenticates (via auto-login or supplied credentials), submits a crafted code-validation payload embedding the requested shell command, and prints the command output extracted from the API’s validation error message.
Detection & Indicators of Compromise
POST /api/v1/validate/code HTTP/1.1
GET /api/v1/auto_login HTTP/1.1
Signs of compromise:
- Unexpected POST requests to
/api/v1/validate/codecontainingsubprocess,os.system, or__import__in the request body. - Repeated or scripted
GET /api/v1/auto_logincalls from unfamiliar source IPs. - Unexplained child processes spawned by the Langflow server process (e.g.
sh -c,id,whoami).
Remediation
| Action | Detail |
|---|---|
| Primary fix | Upgrade to Langflow 1.3.0 or later, where the code-validation endpoint sandboxing/authentication was hardened |
| Interim mitigation | Disable or restrict /api/v1/auto_login, require authentication on all API endpoints, and place Langflow behind a network boundary not directly reachable by untrusted clients |
References
Notes
Mirrored from https://github.com/diamorphine666/CVE-2026-0770 on 2026-07-05.
| |