Summary
Flowise's MCP adapter allowed authenticated users to configure stdio servers with arbitrary underlying commands, enabling operating system command execution despite attempted input sanitization.
When a user created a "Custom MCP" using stdio, they could combine nominally safe binaries (such as npx) with hostile arguments to execute arbitrary commands on the host running Flowise.
Affected context
This vulnerability appears in Flowise deployments that:
- Expose the Flowise UI (e.g., at
http://localhost:3000/canvas) to authenticated users who can create or modify Custom MCP configurations - Use the MCP stdio adapter to launch local processes based on user-supplied command strings and arguments
- Rely on application-level input validation (e.g.,
validateCommandInjection,validateArgsForLocalFileAccess, and allowlists of binaries) without fully constraining the final executed command line
The issue is most relevant where the Flowise instance runs with access to sensitive files, network resources, or elevated privileges on the host.
Exploit preconditions
- Attack surface: Flowise web UI / API for configuring Custom MCPs (MCP stdio adapter).
- Required access: Valid authenticated access with permission to create or edit Custom MCP configurations.
- Trigger point: Saving or invoking a Custom MCP stdio configuration that specifies a "safe" command (e.g.,
npx) paired with malicious arguments (e.g., shell-style execution flags or command-chaining constructs). - Why exploitation is possible: The system treats the user-supplied command and arguments as trusted, and the validation logic focuses on blocking obvious injection patterns or disallowed binaries but does not enforce strict composition of the full command line. This allows attackers to craft argument combinations that result in arbitrary OS commands executed by the underlying process launcher.
Why this happens
The root cause is an OS command injection pattern where untrusted input controls the command and arguments ultimately executed on the operating system.
In the MCP adapter, the "Custom MCP" stdio configuration accepts a command and its parameters from the user. Although there are validation helpers and a predefined list of "safe" commands, these checks are insufficiently strict. They do not fully model how the command plus arguments are interpreted by the OS or runtime (e.g., via npx or similar wrappers), allowing an attacker to smuggle execution flags and payloads within permitted arguments.
This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where user-controlled data influences the structure or behavior of the executed command instead of being treated as inert parameters. The underlying pattern is constructing or launching commands based on partially trusted input without enforcing a hardened execution model or strict, context-aware escaping.
Potential impact
- Execution of arbitrary OS commands with the privileges of the Flowise process
- Reading, modifying, or deleting files accessible to the Flowise host account
- Lateral movement within the host environment or connected internal network
- Data exfiltration of credentials, configuration secrets, or other sensitive information
- Use of the compromised host as a pivot for further attacks (e.g., installing backdoors or running malware)
General mitigation guidance
Effective mitigation focuses on eliminating direct command construction from user input and reducing the privileges of any spawned processes:
- Replace free-form command configuration with strict, predefined actions or templates that map to fixed binaries and fixed argument structures.
- Enforce strong allowlists at the abstraction level of "operations" rather than binaries, preventing users from directly specifying executables and arbitrary flags.
- Use parameterized process execution APIs where arguments are passed as discrete, typed parameters and are never interpreted by a shell.
- Avoid shell invocation entirely when launching MCP stdio servers; call specific binaries directly with validated, constrained argument sets.
- Apply least-privilege principles: run Flowise and its spawned processes under dedicated, low-privilege accounts with restricted filesystem and network access.
- Segregate high-risk functionality (e.g., local tool execution) into isolated sandboxes or containers to limit blast radius if a misconfiguration or bypass occurs.
How teams detect issues like this
Detection can combine code-level and runtime approaches:
- Static analysis and code review:
- Flag any use of APIs that execute OS commands based on user-configurable strings (e.g.,
child_process.spawn,exec, or similar) in the MCP adapter code. - Look for logic that partially validates commands (e.g., basic regex checks or simple allowlists) but still passes user-controlled arguments into execution calls.
- Review configuration-related code paths where UI inputs are serialized into runtime command definitions without strict schema constraints.
- Configuration and policy checks:
- Monitor application configuration for Custom MCPs that use stdio with user-defined commands, especially generic wrappers like
node,npx,bash, orsh. - Enforce security policies disallowing arbitrary "Custom MCP" definitions in production, or limiting this feature to tightly controlled environments.
- Runtime monitoring:
- Collect process creation logs from the host and alert on unexpected command lines spawned by the Flowise service.
- Use host-based intrusion detection to flag suspicious child processes (e.g., unusual shells, download utilities, or file-manipulation commands) originating from the Flowise context.

