/

CVE-2026-46442

Severity:

CRITICAL RISK

(9.9)

Code Injection (CWE-94) in Flowise Custom JS Function

CVE-2026-46442

Analyzed

Vulnerability type

Category:

Code Injection

CWE:

CWE-94

Impact:

Authenticated Remote Code Execution

Severity:

CRITICAL RISK

(9.9)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

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_APIKEY is 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 process object and dangerous modules like child_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.

Sources

SourceLink
github.comgithub.com/FlowiseAI/Flowise/releases/tag/flowise%403.1.2
github.comgithub.com/FlowiseAI/Flowise/security/advisories/GHSA-9rvc-vf7m-pgm2

Frequently asked

questions

Exploitation is limited to actors who already possess valid Flowise authentication or an API key, but in many environments these may include low-privilege users or service accounts; once exploited, the impact extends to full control of the hosting server.

No. The weakness is that the POST /api/v1/node-custom-function route lacks route-level authorization, so any authenticated user or API key allowed to reach this endpoint can attempt to exploit it, regardless of their role.

The most robust pattern is to eliminate or sharply restrict arbitrary code execution by authenticated users: enforce strict authorization and role checks on any endpoint that runs user-provided code, and, where possible, move code execution into a strongly isolated component with narrowly defined capabilities.

Treat "execute user-supplied code" as an architectural smell requiring dedicated isolation, minimal privileges, and explicit access controls; favor declarative configuration or limited scripting models over full language execution, and ensure security reviews specifically scrutinize any new feature that evaluates user-controlled code.

Find out what's already
exploitable in your codebase.