/

CVE-2026-58195

Severity:

HIGH RISK

(8.8)

OS Command Injection (CWE-78) in Agentic-Flow MCP

CVE-2026-58195

Deferred

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary OS Command Execution

Severity:

HIGH RISK

(8.8)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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.

Sources

SourceLink
github.comgithub.com/ruvnet/agentic-flow/commit/0c2ec967736a8b6b85832c6bae2a3e74989705ec
github.comgithub.com/ruvnet/agentic-flow/issues/169
github.comgithub.com/ruvnet/agentic-flow/pull/170
github.comgithub.com/ruvnet/agentic-flow/security/advisories/GHSA-vcv2-r9jh-99m5
github.comgithub.com/ruvnet/ruflo/issues/2414
github.comgithub.com/ruvnet/ruflo/pull/2415
github.comgithub.com/ruvnet/ruflo/releases/tag/v3.12.4

Frequently asked

questions

Exploitability depends on how MCP tools are exposed. If external users, integrated services, or automated flows can control parameters like agent or task, the issue can often be exploited remotely through those interfaces.

An attacker needs the ability to influence MCP tool parameters that reach the vulnerable execSync() calls. This might be through an API, SDK, orchestration script, or any integration that feeds data into Agentic-Flow's MCP tooling.

Replace shell-based command construction with safer process execution APIs that treat parameters as arguments rather than command text, and enforce strict validation or allowlisting on all tool inputs before execution.

Establish secure coding guidelines that forbid concatenating untrusted data into command strings, adopt static analysis rules to catch violations, and systematically design agent orchestration flows so that user-controlled values are never treated as executable command logic.

Find out what's already
exploitable in your codebase.