Summary
Agentic-Flow's MCP server tooling interpolates attacker-controlled parameters directly into shell commands that are executed via execSync().
When hostile input reaches fields like agent, task, name, language, or agentdb, an attacker can cause arbitrary OS command execution with the privileges of the MCP server user.
Affected context
This vulnerability occurs in Agentic-Flow deployments where MCP server tools are exposed to inputs that are not strictly trusted or constrained.
It is most relevant when parameters such as agent, task, name, language, and agentdb can be influenced by external users, downstream systems, or dynamically generated workflows.
Environments that execute these tools on shared infrastructure or with elevated privileges face increased risk.
Exploit preconditions
- Attack surface: MCP server tools and endpoints that accept dynamic parameters (agent, task, name, language, agentdb).
- Required access: Ability to supply or alter tool parameters via APIs, orchestration flows, or integrated clients.
- Trigger point: Execution of shell commands via execSync() within src/mcp/standalone-stdio.ts and multiple fastmcp server/tool modules.
- Why exploitation is possible: User-supplied parameters are concatenated into shell command strings without neutralization, validation, or proper escaping, enabling injection of additional commands.
Why this happens
The core issue maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection').
Agentic-Flow builds command-line strings by directly interpolating parameters like agent, task, name, language, and agentdb into shell commands executed via execSync().
This pattern treats untrusted data as part of executable command syntax, allowing attackers to break out of intended arguments and append arbitrary OS instructions.
Conceptually, the bug arises from mixing data and command logic without a safe abstraction such as parameterized execution APIs or strict input normalization.
Potential impact
- Arbitrary OS commands may be executed under the MCP server user's privileges.
- Attackers could read, modify, or delete local files accessible to the service account.
- Host system configuration and runtime processes can be altered or disrupted.
- The vulnerable host may be used as a pivot point for further network compromise.
- Sensitive secrets, logs, or model artifacts could be exfiltrated or corrupted.
General mitigation guidance
Effective mitigation focuses on separating command construction from untrusted data and reducing the privileges of command executors.
Recommended patterns include:
- Avoid shell string concatenation; use safer process execution APIs that pass arguments as arrays without invoking a shell.
- Apply strict allowlists or schemas to parameters such as agent, task, name, language, and agentdb, rejecting unexpected values.
- Normalize and constrain all tool inputs before they are used in any system-level operation.
- Run MCP servers and tools under least-privilege accounts, with minimal filesystem and network access.
- Design orchestration flows so that dynamically supplied tool parameters are treated as data, never as executable instructions or command fragments.
How teams detect issues like this
Detection often combines code-level analysis with runtime monitoring:
- Static analysis rules can flag usage of execSync() or other shell-execution APIs that interpolate variables into command strings.
- Code reviews should look for manual string concatenation used to build commands, particularly around user- or workflow-controlled parameters.
- Enforce development policies that prohibit raw shell command construction where untrusted input is involved, backed by automated linters or security scanners.
- Runtime monitoring and audit logging can highlight unusual command patterns or spikes in shell invocation originating from MCP server processes.

