AIDEFEND in Action AIA-0159 Validated Research

RufRoot: One Unauthenticated Request to Ruflo's MCP Bridge Ran Shell Commands in the Container

Ruflo is an open-source platform for running groups of AI agents (swarms) with persistent memory and tool calling through the Model Context Protocol (MCP). Noma Labs found that its MCP Bridge, the server every tool call passes through, executed POST /mcp requests without authentication, on a port the default Docker Compose file published on all network interfaces. One request to the built-in terminal tool ran shell commands in the container. Noma's eight-step proof of concept then read the model-provider API keys, started swarms on the victim's keys, wrote a false policy into agent memory, copied every conversation and left a script that survives a restart. The flaw, CVE-2026-59726, is fixed in ruflo 3.16.3. No public source reviewed here reports use in a real attack.

Remote Code ExecutionAuthentication BypassAI Deployment SecurityTool AuthorizationMCP Security
12 applicable AIDEFEND defenses

Threat Analysis

  • An MCP endpoint with no authentication, published by default. Every tool call, agent action and memory operation in Ruflo passes through its MCP Bridge, an Express.js server. Noma Labs found that POST /mcp handed tool calls straight to the execution function with no token, API key, header check or address allowlist, and that the default docker-compose.yml published the bridge port, 3001, on all network interfaces. How far that reaches depends on the firewall, security groups and segmentation around the host.
  • One request for a shell, then seven more steps. One of the bridge's 233 tools, ruflo__terminal_execute, runs a caller-supplied command in the container as the node user (UID 1000). Noma's automated proof of concept listed the tools, ran a command, and printed the environment to collect the provider keys (OpenAI, Anthropic, Google, OpenRouter and others), which the Compose file passes in and every tool backend inherits. It then started attacker-controlled swarms on the victim's keys; stored a fake SOC2 compliance policy in the AgentDB pattern store (the agents' long-term memory), telling the AI to add an attacker-controlled URL to generated deployment scripts; copied every conversation from a MongoDB that had no authentication; wrote /app/beacon.js to load at startup and forced a restart; and cleared the shell history.
  • How far the evidence goes. Noma reports that every step was confirmed on a default deployment it ran on AWS EC2. The maintainers verified the claims against the source code and state that they did not run the exploit. The CISA assessment attached to the CVE record on 9 July 2026 lists exploitation as none, and no public source reviewed here reports use in a real attack. Noma says that later conversations produce attacker-influenced output once the pattern is stored; the reviewed sources include no sample of such output.
  • A blocklist on the wrong path, and three ways in. Ruflo had listed terminal_execute in a blocklist, but the check ran only in the autopilot flow and POST /mcp never called it. The maintainers also sorted the steps by what each one needs: key theft, the conversation copy, the startup script and the cleanup require the shell, while swarm creation and pattern-store poisoning need only the unauthenticated endpoint. Removing the terminal tool alone would therefore have left two paths open.
  • What the fix changes, and what stays with the operator. ruflo 3.16.3, released on 1 July 2026, binds the bridge and MongoDB to loopback, refuses a public bind without MCP_AUTH_TOKEN, keeps terminal_execute off unless MCP_ENABLE_TERMINAL=true, requires a MongoDB password and makes the bridge filesystem read-only. All earlier versions are affected, and the advisory gives the flaw the maximum CVSS 3.1 score of 10.0. Redeploying does not remove a stored pattern or a planted script, and it does not invalidate keys that were already read. When the fix was merged, giving each backend only the keys it needs was left to a later release, and in loopback-only mode the bearer check and the allowlist for cross-origin requests (CORS) stay off unless they are configured.

Applicable AIDEFEND Defenses (12)

AID-H-034.001
MCP Server Deployment Profile, Transport & Exposure Baseline
Very High
The first step works because the bridge answers MCP requests from any address that can reach port 3001. Bind it to loopback and require authentication for every connection that is not local. Before 3.16.3, change the Compose mapping to 127.0.0.1:3001:3001 or put an authenticating reverse proxy in front; from 3.16.3 this is the default, and a public bind without MCP_AUTH_TOKEN refuses to start. In loopback-only mode the bearer check and the CORS allowlist stay off, so set MCP_AUTH_TOKEN and MCP_CORS_ORIGIN as well.
AID-H-003.010
Deployed AI Software Vulnerability Remediation Lifecycle
Very High
ruflo 3.16.3 is the maintainers' fix for CVE-2026-59726. Rebuilding and redeploying from it replaces the defaults the proof of concept used: loopback bindings, a terminal tool that is off, a required MongoDB password and a read-only bridge filesystem. Confirm from the running containers, because an edited local Compose file can outlive a code update. The upgrade does not remove a stored pattern or a planted script, and it does not revoke keys that were already read.
AID-H-034.003
Server-Side Tool Invocation Validation & Object-Level Authorization
Very High
The second step is one call to a tool that passes a caller-supplied string to a shell. Deny shell execution inside the server's own tool handler so that every route gets the same answer. Ruflo's blocklist was checked only in the autopilot flow; 3.16.3 moves the check into executeTool() and keeps the tool off unless MCP_ENABLE_TERMINAL=true. Before 3.16.3, the maintainers' record shows that the tool's group stays on unless MCP_GROUP_DEVTOOLS is set to false. Swarm creation and pattern-store writes use other tools in the same handler, which had no caller identity to check. Bind each call to an authenticated caller and decide per tool whether that identity may start agents or write to shared memory. In 3.16.3 the operator's lever is MCP_AUTH_TOKEN, a single shared token: everyone who holds it can still call both tools, so finer permissions need a change by the maintainers or a policy on a gateway in front of the bridge.
AID-I-001.001
Container-Based Isolation
Very High
Persistence needs a new file under /app and a change to what loads at startup. A read-only root filesystem with a memory-backed scratch path makes both writes fail, and scratch contents do not survive the restart this step relies on. The maintainers added read_only: true and tmpfs: /tmp to the bridge and note that the beacon.js write then fails. An older Compose file can take the same two settings.
AID-I-002.001
Internal AI Network Segmentation
High
Noma notes that exposure depends on the firewall, security groups and segmentation around the host. Allow ports 3001 and 27017 only from the sources that need them. This works even on releases without authentication, though every host inside the allowed range stays fully trusted. Test from outside, because Docker's own rules for published ports can bypass a host firewall. In the conversation-copy step, a shell in the bridge could reach MongoDB over the shared Docker network. Put the database on a network shared only with the service that stores conversations, and do not publish 27017 on the host. If the bridge itself needs the database, this does not apply and database authentication, on by default in the fixed release, has to carry the protection.
AID-E-001.001
Root & Long-Lived Credential Object Eviction
High
Keys printed by printenv work from anywhere until the provider stops accepting them; closing the port does not change that. Revoke each key that was in the bridge environment at its provider, issue replacements, update every consumer, and call the provider with the old key to confirm it is rejected. The advisory makes rotation mandatory for any instance that was exposed.
AID-E-005
Compromised Durable Application Session & Agent State Teardown
High
The advisory states that a patched redeploy does not undo poisoning: the stored pattern keeps shaping later output. Identify the entries written through agentdb_pattern-store while the bridge was exposed, remove exactly those records and what was derived from them, and confirm in a new session that they no longer load. The result depends on telling injected entries apart from learned ones.
AID-E-003.003
Confirmed Malicious Code & Persistence Eviction
High
The maintainers warn that an instance exploited before the patch can keep the beacon after a plain image pull. Preserve evidence, remove the planted file and the startup change from every place they can load from, rebuild the bridge from a clean image, and confirm that the running process no longer loads the script.
AID-I-002.002
Secure External AI Service Connectivity
High
The proof of concept downloaded a MongoDB client and uploaded the dump to an external endpoint. Denying the bridge's outbound connections except to the provider domains it uses blocks both. While the endpoint is open, the caller can still read command output in the HTTP response, so this only makes the copy harder. With the bridge's outbound connections limited to an allowlist of provider domains, the planted beacon.js cannot reach an arbitrary server, so it cannot keep sending keys after the way in is closed. The script itself remains, and an approved provider domain could still carry data.
AID-I-003.003
Resource, Token & Spend Budget Throttling
Medium
Swarms started by an attacker spend the victim's model budget. Per-key and per-agent limits reserved before dispatch, backed by hard caps at the provider, bound what a swarm can consume, and also bound the bill if dumped keys are used elsewhere before they are revoked. The swarm can still start and work within the cap.
AID-D-005.007
Token, Tool-Use, Request-Parameter & Cost Spike Detection & Alerting
Medium
A swarm started by someone else appears as token use and cost that the team's own work does not explain. Alert when usage per key rises sharply above its baseline, and treat an alert on a key used by Ruflo as a reason to check the bridge and replace the key. This is detection, visible only after consumption has begun.
AID-M-001.005
Public AI Endpoint & Agent-Service Exposure Discovery
Medium
Ruflo is usually set up by a developer or a business team, so the security team may not know an instance exists. An outside-in scan that covers port 3001 with a read-only MCP probe finds bridges that answer without credentials. Discovery only makes the exposure visible; closing it needs the binding, authentication or network controls.

What Defenders Should Do Now

  • Check what is actually listening. On every host that runs Ruflo, read the running version and the addresses bound to ports 3001 and 27017 from the running containers, then send a tools/list request with no credentials from a second machine. The check passes when the version is 3.16.3 or later, both ports are on loopback or limited to named sources, and the request gets no answer or a 401.
  • If you cannot upgrade today, close the path with configuration. Map the ports to 127.0.0.1:3001:3001 and 127.0.0.1:27017:27017, restrict their sources at the security group or firewall, and set MCP_GROUP_DEVTOOLS to false. Then repeat the outside test and a terminal_execute call and confirm that both fail.
  • After upgrading, set what the default leaves off. Set MCP_AUTH_TOKEN and an MCP_CORS_ORIGIN allowlist even for loopback-only use, and leave MCP_ENABLE_TERMINAL unset. Confirm that a call without the token is refused and that terminal_execute returns the disabled error on every request route.
  • Treat a reachable instance as compromised until it is checked. Revoke and replace every provider key that was in the bridge environment, and confirm that the old keys are rejected. Remove pattern-store entries you cannot account for, and confirm in a new session that they no longer load. Rebuild the bridge from a clean image and check MongoDB for changed data.
  • Limit what a shell in the bridge can reach. Give MongoDB a network shared only with the service that uses it, allow the bridge's outbound connections only to the provider domains in use, keep the filesystem read-only and cap spend on the keys. From inside the container, confirm that a database connection, a request to an arbitrary host and a write under /app all fail.

2 additional considerations

Give the deployment its own narrowly scoped provider keys

Every key placed in the Compose environment was readable from one shell, and the maintainers left per-backend scoping of those keys to a follow-up when they merged the fix.
Recommendation: Account owners can create keys used only by this Ruflo instance, configure only the providers it actually calls and, where the provider supports it, restrict each key to the models or project it needs. A dump then exposes less, and one key can be revoked without touching other systems. Any key that stays in the environment is still readable by a shell in the container.

Keep a request record outside the bridge container

The last step of the proof of concept cleared the shell history inside the container. Records written by a component the caller cannot reach are not affected by that step.
Recommendation: The operating team can route traffic to the bridge through a reverse proxy or load balancer that records the source address, time and size of every POST /mcp request, turn on network flow logs for ports 3001 and 27017, and send both to storage outside the host. Responders can then establish the exposure window and the calling addresses, which sets the scope of the pattern-store audit and the key rotation. This records requests without blocking them, and request bodies can contain secrets, so keeping them needs separate handling.

Conclusion

RufRoot shows that an MCP server is an API: whoever reaches it can use whatever stands behind it, here a shell, the provider keys, the agents and their shared memory. AIDEFEND  maps this attack path to methods at three positions: the MCP exposure baseline and the fixed release at the entry; server-side authorization of each tool call, with shell execution off by default; and segmentation, an outbound allowlist and a read-only container around the bridge. Key revocation, memory purge and persistence eviction deal with what an upgrade cannot undo.

Last updated: