GHSA-vcv2-r9jh-99m5: Agentic-Flow: OS Command Injection in agentic-flow MCP server tools via unsanitized tool-parameter interpolation into execSync
The MCP server tools in agentic-flow 2.0.13 and earlier pass tool parameters such as `agent`, `task`, `name` and `language` into shell command strings run by `execSync()`. A crafted value breaks out of the quoted argument and runs OS commands as the user running the MCP server. Upgrade to agentic-flow 2.0.14.
Published Jun 19, 2026 · Analysis Oct 25, 2026
What an attacker can do
Many tools build a command string like npx --yes agentic-flow --agent "${agent}" --task "${task}" and hand it to execSync(), which uses /bin/sh -c. A task value of x"; touch /tmp/INJECTED; id > /tmp/rce.txt; echo " closes the quote and adds new commands. The advisory's proof of concept creates the marker file and writes id output.
The affected code is wide: 14 tools in src/mcp/standalone-stdio.ts (including agentic_flow_agent, agent_booster_edit_file and agentdb_pattern_store), the FastMCP servers, tools/agent/{execute,list,parallel}.ts, tools/swarm/orchestrate.ts and the depth path of tools/hooks/pretrain.ts. This was a partial-fix gap: an earlier commit, 6a06854, fixed CWE-78 elsewhere but missed the MCP files.
The attacker does not need host access. The AI agent treats these arguments as data, so a web page, file or third-party tool output that steers the agent's tool call can deliver the payload (the vector sets UI:R). The HTTP/SSE transports in http-sse.ts and http-streaming-updated.ts have the same sinks with no authentication and no Origin or Host validation. If they are bound to a reachable interface, a network client can send the payload directly. The result is code execution with the privileges of the MCP server user.
Who is affected
agentic-flow 2.0.13 and earlier. The downstream packages ruflo, claude-flow and @claude-flow/cli were bumped from 3.12.3 to 3.12.4 to pull in the fix, so 3.12.3 and earlier builds that bundle it are likely affected as well. Check:
npm ls agentic-flow
npm ls -g agentic-flow ruflo claude-flow @claude-flow/cliThe MCP server is the exposed part, so any host that runs it is in scope.
agentic-flow
- Ecosystem
- npm
- Affected
- <= 2.0.13
- Fixed in
- 2.0.14
- Check
npm ls agentic-flow
How to fix it
Upgrade to agentic-flow 2.0.14.
npm install [email protected]The fix (pull request 170) rewrites every affected call site to execFileSync(file, argv, { shell: false }). Argument values go straight to execve(2) without shell parsing. For the downstream tools, use [email protected], [email protected] or @claude-flow/[email protected]. npx ...@latest resolves to those. The advisory says no configuration mitigates the flaw without upgrading. If you cannot upgrade, do not bind the HTTP/SSE transports to a reachable interface.
How to tell if you were hit
Look at the process tree under the MCP server for sh -c children that run more than the expected npx --yes agentic-flow command, such as touch, curl or id. Search for the PoC marker files /tmp/INJECTED and /tmp/rce.txt. Check MCP tool-call arguments for "; sequences, backticks or $( inside agent, task, name or language. Beam records agent shell commands and MCP tool calls, and its rules flag risky ones, so injected commands and the tool call that carried them can be traced.
Original advisory
From the GitHub Advisory Database (CC BY 4.0).
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_statssrc/mcp/fastmcp/servers/claude-flow-sdk.tssrc/mcp/fastmcp/servers/stdio-full.tssrc/mcp/fastmcp/servers/http-streaming-updated.tssrc/mcp/fastmcp/servers/http-sse.tssrc/mcp/fastmcp/servers/poc-stdio.tssrc/mcp/fastmcp/tools/agent/{execute,list,parallel}.tssrc/mcp/fastmcp/tools/swarm/orchestrate.tssrc/mcp/fastmcp/tools/hooks/pretrain.ts(depth path only)
Proof of Concept
// 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:
{
"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 `[email protected]` — 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:
[email protected][email protected]@claude-flow/[email protected]
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.
Questions
- Is agentic-flow 2.0.13 affected by GHSA-vcv2-r9jh-99m5?
Yes. Every version up to and including 2.0.13 is affected. Version 2.0.14 is the fix.
- Does the attacker need access to my machine?
Not necessarily. Content the agent processes, such as a web page or file, can steer a tool call so its argument carries the payload. On HTTP/SSE transports with no authentication, a network client can send it directly.
- Do claude-flow and ruflo users need to update?
The advisory says
ruflo,claude-flowand@claude-flow/climoved to 3.12.4 to pull in the patched agentic-flow. Use those versions or newer.- Is there a workaround?
No. The advisory says no in-product configuration mitigates it without upgrading. Do not expose the HTTP/SSE transports to untrusted networks in the meantime.
References
How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology
More Other MCP servers and tools vulnerabilities
All Other MCP servers and tools entriesCVE-2026-77361
obsidian-tc : Symlink read-ACL scope bypass via lexical path checks
medium4.7Oct 23, 2026CVE-2026-114126
Storybook dev server vulnerable to code injection from the local network
high8.7Oct 22, 2026CVE-2026-113731
djust: Arbitrary absolute-path file read in the find_handlers_for_template MCP tool
low3.3Oct 21, 2026CVE-2026-114125
Storybook: Missing origin validation in Storybook preview allows code injection from malicious websites
critical9.4Oct 21, 2026CVE-2026-111770
MCP TypeScript server SDK: Shared transport or server instances delivered one HTTP client's messages to another
high7.7Oct 20, 2026GHSA-953h-535j-jg2v
agent-router: MCP session resume does not verify the embedded anti-hijacking subject; default Helm seed makes session IDs forgeable
medium6.8Oct 19, 2026
