Summary
Flowise's Custom MCP Server feature contains OS command injection flaws that let attackers bypass command-flag blocklists and local file access restrictions.
Any user with a Flowise account, or API client with chatflow view/update permissions, can configure a malicious MCP server and trigger arbitrary command execution on the Flowise host when affected flows are run.
Affected context
This vulnerability occurs in Flowise deployments that enable the Custom MCP Server feature and allow users or API clients to create or modify chatflows incorporating MCP server configurations.
Risk is present where command validation relies on partial blocklists and regex-based filters for arguments, rather than strict allowlists and robust sanitization.
The issue is most relevant in multi-tenant or shared environments where users can define MCP endpoints that ultimately invoke shell commands on the Flowise host.
Exploit preconditions
- Attack surface: Flowise web UI and API endpoints that create, update, or execute chatflows using the Custom MCP Server integration.
- Required access: Any Flowise account (regardless of role) or API access with view/update permissions for chatflows; no direct host access is needed.
- Trigger point: Execution of a chatflow that uses a configured MCP server, causing Flowise to run the underlying system command with insufficient validation of flags and arguments.
- Why exploitation is possible: Command validation relies on an incomplete blocklist (
validateCommandFlags) and a regex-based filter for local file access (validateArgsForLocalFileAccess) that can be bypassed. As a result, attacker-controlled command strings and arguments are passed to the OS shell with inadequate constraints.
Why this happens
The root cause is improper neutralization of special elements in OS commands, aligning with CWE-78: OS Command Injection.
Flowise's validation logic attempts to block dangerous command flags and restrict file access using pattern matching, but these controls are partial and easily circumvented.
Instead of enforcing a strict allowlist of safe commands and arguments, the implementation trusts user-supplied command lines and relies on fragile regex checks, allowing adversaries to craft MCP configurations that execute arbitrary commands on the host.
Potential impact
- Attackers may execute arbitrary OS commands on the Flowise server.
- Compromise of the Flowise application, including chatflows, stored prompts, and connected credentials.
- Unauthorized access to or modification of local files on the host system.
- Data exfiltration from the server or connected data sources.
- Use of the compromised host for lateral movement within the infrastructure.
- Potential full system takeover depending on the privileges of the Flowise process.
General mitigation guidance
Effective mitigation focuses on eliminating opportunities for user-controlled command strings to reach the OS without strict constraints.
Recommended patterns include:
- Replace generic shell invocation with explicit, parameterized APIs that do not interpret composite command strings (e.g., using child process libraries with fixed executables and argument schemas).
- Implement strict allowlists of supported commands and flags for MCP servers, rejecting any configuration outside predefined safe operations.
- Avoid regex-only validation for command arguments; instead, use structured parsing and validation aligned with expected types, paths, and formats.
- Isolate command execution in hardened sandboxes or containers with reduced privileges and constrained filesystem access, limiting impact even if misuse occurs.
- Apply least-privilege to the Flowise runtime account so that OS commands, if abused, have minimal system-level capabilities.
How teams detect issues like this
Detection typically involves both code-centric and operational approaches:
- Use static analysis or security linters to flag dynamic command construction, shell invocations, and reliance on blocklists or regex filters around
exec,spawn, or shell wrappers. - During code review, look for features that allow users to configure commands, scripts, or endpoints that eventually touch the OS, and verify they are strictly constrained to safe, predefined operations.
- Establish security policies that prohibit passing raw, user-controlled strings directly to OS command execution APIs, and enforce these policies via CI checks or automated code scanners.
- Monitor application logs and host telemetry for unusual command patterns initiated from Flowise processes, such as unexpected
docker, package manager, or filesystem commands originating from MCP-related workflows.

