Summary
Flowise's Custom JS Function node allows authenticated users or API keys to submit arbitrary JavaScript without route-level authorization checks.
In common deployments where code runs inside a NodeVM sandbox, attackers can escape the sandbox, access the host process, and achieve authenticated remote code execution on the Flowise server.
Affected context
This vulnerability arises in Flowise deployments that expose the Custom JS Function capability via POST /api/v1/node-custom-function to authenticated users or API keys.
The risk is most pronounced in setups where:
E2B_APIKEYis not configured, so user-supplied JavaScript runs in a NodeVM sandbox on the Flowise server- The same Flowise instance is shared among multiple users or tenants
- Application-level permissions do not distinguish between low-privilege users and administrators
Under these conditions, a low-privilege authenticated actor can submit crafted JavaScript that breaks out of the sandbox and interacts directly with the host Node.js process.
Exploit preconditions
- Attack surface: HTTP API endpoint
POST /api/v1/node-custom-function - Required access: Any valid Flowise authentication context (user session or API key) with permission to call this endpoint
- Trigger point: Submitting specially crafted JavaScript payloads through the Custom JS Function node so they are executed by NodeVM
- Why exploitation is possible: The endpoint lacks route-level authorization and trusts authenticated callers to provide JavaScript, while the NodeVM sandbox can be bypassed, exposing the
processobject and dangerous modules likechild_process
Why this happens
The root cause is the combination of unrestricted script execution and insufficient authorization on a high-risk endpoint.
At a design level, Flowise accepts arbitrary JavaScript from authenticated clients and executes it in a sandbox, assuming the isolation boundary is strong enough to prevent host access.
However, sandboxed execution environments like NodeVM can have escape paths, especially when user code can reach internal objects or prototype chains.
This matches CWE-94: Improper Control of Generation of Code ('Code Injection'), where untrusted input is interpreted and executed as code.
The absence of fine-grained authorization on POST /api/v1/node-custom-function broadens the set of principals who can supply dangerous code, turning a trusted extension mechanism into a remote code execution vector.
Potential impact
- Authenticated attackers can execute arbitrary system commands on the Flowise server host
- Complete compromise of the Flowise application, including flows, credentials, and configuration stored by the instance
- Lateral movement within the hosting environment, potentially accessing neighboring services, networks, or data stores
- Deployment of persistent malware, web shells, or cryptominers on the server
- Data exfiltration of sensitive information processed or stored by Flowise
- Disruption of service availability through destructive commands or resource exhaustion
General mitigation guidance
Effective mitigation focuses on reducing who can supply executable code, and hardening how such code is handled:
- Constrain the code execution surface: Treat any feature that runs user-provided JavaScript as inherently high risk. Introduce strict role-based access controls so only highly trusted operators can configure or invoke custom code nodes.
- Separate trust tiers: Isolate custom code execution from the main application process using process-level or container-level boundaries rather than relying solely on in-process sandboxes.
- Apply least privilege to runtime environments: Run Flowise and any auxiliary execution components with minimal OS and network privileges, removing unnecessary capabilities and file system access.
- Validate and restrict code capabilities: Where possible, expose higher-level, declarative configurations or limited scripting APIs instead of full JavaScript evaluation, and avoid exposing dangerous modules or globals.
- Harden shared deployments: In multi-tenant or shared environments, avoid enabling generic custom code execution for untrusted tenants; provide pre-approved modules or controlled extension points instead.
- Security-by-default configurations: Default deployments should assume low trust in authenticated users and disable or heavily constrain arbitrary code execution features unless explicitly enabled by an administrator.
How teams detect issues like this
Detection can target both the codebase and runtime behavior:
- Static analysis and code review:
- Flag any use of generic JavaScript execution mechanisms (e.g.,
vm,NodeVM,eval,Function) that process data from HTTP endpoints. - Highlight routes that accept code-like input without explicit, strict authorization checks and justification.
- Use security review checklists that treat "user-supplied code execution" as a critical pattern requiring architectural justification and isolation.
- Policy and configuration checks:
- Enforce secure defaults through configuration policies that disable or restrict dynamic code features in lower environments or shared instances.
- Integrate linters or automated review rules into CI to detect introduction of new endpoints that execute user-supplied code.
- Runtime monitoring and logging:
- Log usage of custom function endpoints, including caller identity and high-level metadata about submissions, and alert on unusual volume or low-privilege actors invoking them.
- Monitor process behavior (e.g., child process creation, unexpected file system or network access) tied to Flowise, and alert on anomalous activity patterns.
- Tooling support:
- Consider application security testing tools that focus on server-side JavaScript injection and sandbox escape patterns to exercise these endpoints during testing.

