CVE-2026-51886: Langflow Remote Code Execution Vulnerability
HIGHCVE-2026-51886 is a HIGH (CVSS 8.8) remote code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Langflow libraries in the PyPI ecosystem. The issue involves title authenticated remote code execution in validate_code via malicious decorators description. Remediation is available by upgrading affected packages to version 1.10.1.
CVE-2026-51886 at a Glance
Security Impact
CVSS: 8.8
The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).
How to Fix CVE-2026-51886
To remediate this vulnerability, upgrade all affected Langflow dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
pip install langflow>=1.10.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
pip show langflow
How to Check if You Are Affected
To determine whether your Python environment is affected by CVE-2026-51886, inspect your installed packages using pip:
pip show langflow
Analyze the terminal output to locate any version of Langflow in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.10.1), your application is affected.
Note: The pip show langflow command checks currently installed packages in your active Python environment.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Langflow, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-51886 Affected Langflow Versions
1 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
langflow
|
PyPI |
≥ 1.7.2
< 1.10.1
|
1.10.1
|
References
Frequently Asked Questions
What is CVE-2026-51886?
Which Langflow versions are affected?
What version fixes CVE-2026-51886?
Is langflow affected?
What is the CVSS score of CVE-2026-51886?
What CWE is associated with CVE-2026-51886?
How can I check PyPI dependencies for CVE-2026-51886?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-w584-2h2r-2hvf",
"modified" : "2026-10-05T22:31:00Z",
"published" : "2026-10-05T22:31:00Z",
"aliases" : [ "CVE-2026-51886" ],
"summary" : "Langflow: Title Authenticated Remote Code Execution in validate_code via Malicious Decorators Description",
"details" : "###Summary:\nA critical Authenticated Remote Code Execution (RCE) vulnerability exists in the validate_code function of Langflow. The` /api/v1/validate/code` endpoint, meant to validate user-supplied code, leverages Python's exec() function. While it attempts to restrict execution to function definitions, it fails to account for decorators, which are evaluated at definition time. This allows any authenticated user to execute arbitrary code on the server, resulting in a full system compromise.\n\n\n\n### Details\nThe vulnerability is located in `src/lfx/src/lfx/custom/validate.py(exposed via src/backend/base/langflow/api/v1/validate.py`).\n\nThe validate_code function parses user input using ast. When it encounters a FunctionDef node, it compiles and executes it to check for extensive errors:\n\n```\n# src/lfx/src/lfx/custom/validate.py\nif isinstance(node, ast.FunctionDef):\n code_obj = compile(ast.Module(body=[node], type_ignores=[]), \"<string>\", \"exec\")\n # ...\n # exec_globals creates a restricted-looking scope, but standard builtins are available\n exec(code_obj, exec_globals)\n```\n\nBy design, executing a function definition (def func(): ...) does not execute the function body. However, Python immediately evaluates decorators attached to the function definition. An attacker can supply a malicious decorator (e.g., a lambda or function call) to achieve immediate code execution during the \"validation\" phase.\n\n### Affected Versions\n\n- **`/api/v1/validate/code` had no authentication at all** until commit `3fed9fe1b5` (\"fix: Add authentication to various endpoints\", #10977), first released in **v1.7.2**. Before that release, this same `exec()` sink was reachable **unauthenticated**.\n- From **v1.7.2 through v1.10.0**, the endpoint required a valid session but the `exec()` sink was untouched, so any authenticated user (or any user at all under `AUTO_LOGIN`) could trigger RCE via a malicious decorator as described below.\n- Fixed in **v1.10.1** — see Fix section.\n\n### PoC\n- Authenticate as any user (acquire a valid access token or API key).\n- Send a POST request to /api/v1/validate/code with the following JSON payload:\n```\n{\n \"code\": \"@lambda x: (__import__('os').system('touch /tmp/pwned'), x)[1]\\ndef pwned():\\n pass\"\n}\n```\nCurl Example\n```\ncurl -X POST \"http://<TARGET_HOST>/api/v1/validate/code\" \\\n -H \"Authorization: Bearer <YOUR_TOKEN>\" \\\n -H \"Content-Type: application/json\" \\\n -d '{\"code\": \"@lambda x: (__import__(\\\"os\\\").system(\\\"echo RCE_SUCCESS > /tmp/pwned\\\"), x)[1]\\ndef pwned():\\n pass\"}'\n```\nVerify: Check the server file system. The file /tmp/pwned will be created.\n\n### Impact\nThis vulnerability results in Remote Code Execution (RCE).\n\nImpacted Parties: Any user with access to the Langflow instance (Authenticated Users).\nConsequence: An attacker can execute arbitrary commands with the privileges of the process running Langflow. This allows reading sensitive environment variables (API keys, DB credentials), modifying files, or launching further attacks on the internal network.\n\n### Fix\nFixed in **v1.10.1** by PR [#13696](https://github.com/langflow-ai/langflow/pull/13696) (commit `e7c33dbaad`, tracked as **GHSA-2wcq-pvw2-xh7v**): `validate_code()` in `src/lfx/src/lfx/custom/validate.py` no longer `exec()`s submitted `FunctionDef` nodes. It now only `compile()`s them to surface syntax/compile errors, which never evaluates decorators or default-argument expressions, closing this sink entirely.\n\nThis same fix independently resolves the different exploitation technique reported in duplicate advisory **GHSA-xjq8-cqrm-7m4x** (RCE via default-argument evaluation instead of a decorator). Both advisories share the exact same root-cause sink — the unconditional `exec()` in `validate_code()` — and differ only in which Python construct (decorator vs. default argument) is used to trigger execution at definition time. Credit for this finding is accordingly shared with the reporter of that duplicate.",
"severity" : [ {
"type" : "CVSS_V3",
"score" : "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "PyPI",
"name" : "langflow"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.7.2"
}, {
"fixed" : "1.10.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/langflow-ai/langflow/security/advisories/GHSA-w584-2h2r-2hvf"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-51886"
}, {
"type" : "WEB",
"url" : "https://github.com/langflow-ai/langflow/issues/13336"
}, {
"type" : "WEB",
"url" : "https://github.com/langflow-ai/langflow/pull/13696"
}, {
"type" : "WEB",
"url" : "https://github.com/langflow-ai/langflow/commit/e7c33dbaade20b5295c7fa26bf83cc1ff68fba02"
}, {
"type" : "WEB",
"url" : "https://gist.github.com/Ro1ME/c11b1e63e4e8fca6b25275144f25ec2a"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/langflow-ai/langflow"
}, {
"type" : "WEB",
"url" : "https://github.com/langflow-ai/langflow/releases/tag/v1.10.1"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-10-05T22:31:00Z",
"nvd_published_at" : null
}
}