The runtime flips on an environment variable.
NocoBase's ScriptInstruction.ts exposes a single workerScript getter that the Worker constructor consumes:
static get workerScript() {
const hasModules = process.env.WORKFLOW_SCRIPT_MODULES?.split(',').filter(Boolean).length > 0;
return path.join(__dirname, hasModules ? 'Vm.js' : 'IsolatedVm.js');
}
IsolatedVm.js runs the user-supplied script in an isolated-vm V8 isolate: a separate V8 instance with no shared object graph, no shared prototype chain back to the host, no require. The post-condition the file's comment claims (no require, no Node.js APIs) is mechanically true; the script the operator's user supplies has no primitive that reaches the host process.
Vm.js runs the user-supplied script in new (require('node:vm').Script)(code).runInNewContext(context). The contract is different. node:vm is a same-process construct that swaps out the global object for a fresh one but reuses the host realm's prototype graph. Any object the host hands into the context carries its prototype chain with it. The Node.js documentation page for the vm module, paragraph one, says, verbatim: "The node:vm module is not a security mechanism. Do not use it to run untrusted code."
Vm.js is the runtime selected whenever WORKFLOW_SCRIPT_MODULES is set to a non-empty list of allowed module names. Operators set the variable when their workflow scripts need require('crypto') or require('path') or anything else. The configuration knob is documented in NocoBase's plugin README; it is the operator-facing way to make the Script node useful for any work that needs library calls. Setting it flips the runtime to the one the codebase's own comment marks unsafe; not a security boundary.
The escape is two short lines.
The PoC's payload, in full:
const escape = console._stdout.constructor.constructor("return process")();
const child_process = escape.mainModule.require("child_process");
child_process.execSync(`<cmd>`, {encoding: "utf8"});
console._stdout, in any Node.js worker context, is a WritableWorkerStdio stream (the worker_threads stdout implementation). Object.getPrototypeOf(console._stdout).constructor is Writable. Writable.constructor is the host realm's Function, because the stream's prototype chain runs WritableWorkerStdio → Writable → Stream → EventEmitter → Object, and every link in that chain is a constructor whose own .constructor is the host's Function. Function("return process")() evaluates the string in the host realm and returns the host process. process.mainModule.require is the unconstrained require, not the plugin's allowlisted wrapper. child_process.execSync is RCE.
The chain is what Node's own documentation warns about. Any object handed across the node:vm boundary with its prototype chain intact is a Function-constructor reach.
The PoC is delivered to /api/flow_nodes:test, the workflow-node test endpoint:
exploit_data = {
"type": "script",
"config": {
"script": js_payload
},
"upstreamResult": {}
}
resp = session.post(f"{base_url}/api/flow_nodes:test", json=exploit_data, ...)
flow_nodes:test runs ScriptInstruction.test(config) directly. The script executes before any workflow is saved. The ACL snippet that gates the endpoint is pm.workflow.workflows: any role with workflow-management permission can call it. The CVE vector is AV:N/AC:L/PR:L, low privileges required.
The pre-patch sandbox tried to harden console by enumeration.
NocoBase's open-sourced Vm.js, the version that shipped with v2.0.26 and earlier, was already doing console-hardening. The author had seen the threat. The implementation:
function createSafeConsole(originalConsole) {
const safe = Object.create(null);
Object.defineProperty(safe, 'constructor', { value: null, /* ... */ });
const allKeys = Reflect.ownKeys(originalConsole);
for (const key of allKeys) {
const descriptor = Object.getOwnPropertyDescriptor(originalConsole, key);
if (!descriptor) continue;
const wrap = (fn) => {
const bound = fn.bind(originalConsole);
Object.defineProperty(bound, 'constructor', { value: null, /* ... */ });
return bound;
};
if (typeof descriptor.value === 'function') {
descriptor.value = wrap(descriptor.value);
}
if (typeof descriptor.get === 'function') {
descriptor.get = wrap(descriptor.get);
}
if (typeof descriptor.set === 'function') {
descriptor.set = wrap(descriptor.set);
}
descriptor.configurable = false;
Object.defineProperty(safe, key, descriptor);
}
return Object.freeze(safe);
}
Read it carefully. Reflect.ownKeys(originalConsole) returns every own key on the host console. The author iterates each key, fetches its descriptor, wraps the function values, and installs the descriptor on safe. Function values are wrapped to null out their .constructor. Accessor functions are wrapped.
Object values are not wrapped. The if (typeof descriptor.value === 'function') check is the gate, and console._stdout does not pass it. The descriptor flows through to Object.defineProperty(safe, key, descriptor) with descriptor.value still pointing at the original host WritableWorkerStdio instance.
The createSafeConsole function exists. It runs. It nulls every function's constructor. It freezes the result. It is hardening that was specifically written to prevent prototype-chain escape, and it does not prevent the escape, because the threat model the author held in their head was "every property of console is a function." It is not. _stdout, _stderr, and _times are not.
The patch is one mental-model change.
Pull request #8967 (merged March 26, 2026, shipped in v2.0.28 on March 27) was authored by mytharcher, the same NocoBase team member who shipped the pre-patch version. The diff replaces Reflect.ownKeys(originalConsole) with an allowedMethods constant:
- const allKeys = Reflect.ownKeys(originalConsole);
- for (const key of allKeys) {
- const descriptor = Object.getOwnPropertyDescriptor(originalConsole, key);
- // wrap if descriptor.value is a function
- Object.defineProperty(safe, key, descriptor);
- }
+ const allowedMethods = [
+ 'log', 'info', 'warn', 'error', 'debug', 'trace',
+ 'dir', 'dirxml', 'table', 'time', 'timeEnd', 'timeLog',
+ 'count', 'countReset', 'group', 'groupCollapsed', 'groupEnd',
+ 'clear', 'assert',
+ ];
+ for (const key of allowedMethods) {
+ if (typeof originalConsole[key] === 'function') {
+ const bound = originalConsole[key].bind(originalConsole);
+ hardenFunction(bound);
+ Object.defineProperty(safe, key, { value: bound, /* ... */ });
+ }
+ }
The patch adds one comment, and the comment is the bug class named in one line:
// Internal properties like _stdout, _stderr, _times are NOT exposed to prevent
// prototype chain traversal attacks (CVE: sandbox escape via WritableWorkerStdio).
The pre-patch shape was "wrap everything; the unsafe shape is a raw host function." The post-patch shape is "allow nineteen logger methods; everything else is denied." Same author, twenty-eight days apart, on a file the author maintains. The fix is not a code change. The fix is a mental-model change: from "console's keys are functions" to "console has internal Writable streams whose constructor chain is the host Function."
The CHANGELOG entry for v2.0.28 lists this as Fix security issues (#8967). No CVE was assigned at that time. No vendor advisory was filed. The fix shipped silently in a Friday release with two other bug fixes.
The deeper fix lasted three days.
Twenty-three days after #8967, the same author shipped a second, deeper patch. Pull request #9084 (merged April 18, 2026, shipped in v2.0.40 on April 20) added more than six hundred lines to Vm.js and its security test suite. The commit message names the next class of bypass:
Extend the sandbox hardening to also sanitize objects returned by wrapped
module functions (including Promise resolutions), so that prototype-chain
traversal via return values (e.g. crypto.createHash().update.constructor)
cannot reach the host Function constructor.
The fix added a sanitizeReturnValue() helper that wrapped every value crossing back from a wrapped module function into the sandbox, a resolveProperty() helper to evaluate accessor descriptors safely, a sanitizeError() helper that re-wrapped errors thrown from host functions, and a MAX_PROTO_DEPTH=3 prototype walk that re-wrapped methods found anywhere on an object's prototype chain. The commit is co-authored by Claude Sonnet 4.6.
It lasted three days. Pull request #9176 (merged April 21, 2026, shipped in v2.0.41 on April 22) is titled Revert "fix(plugin-workflow-javascript): fix security issue (#9084)". The PR description is one sentence: This reverts commit f73f0d76cd4a1ec37acecf3e4ff8653714b4345f. Three files reverted, 669 deletions, 42 insertions. The 335-line security.test.ts returned to 39 lines, the same shape it had after #8967.
The CHANGELOG for v2.0.41 still lists, in its bug-fixes section: [Workflow: JavaScript] Fix security issue of script executing in node:vm mode (#9084) by @mytharcher. The CHANGELOG entry was generated from the merged-PR list and does not mention #9176. The release notes for the version that reverted the fix still describe shipping the fix.
The hardening the second patch added is the hardening that would have closed the next bypass class. The class is named in the commit message: prototype-chain traversal via the return values of wrapped module functions, demonstrated against crypto.createHash().update.constructor. With #9084 reverted, that bypass is currently unmitigated in v2.0.41 and every release after.
The CVE arrived sixty-seven days after the patch.
The fix shipped March 27, 2026. CVE-2026-34156 was assigned and published June 2, 2026, with CVSS 9.9 and the vector AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H. The PoC at Dhananjayasj/CVE-2026-34156-NocoBase-Sandbox-Escape-via-Workflow-Execution-Vulnerability- is dated the same day. The README is signed Author: Ashraf Zaryouh / 0xBlackash, the original PoC author whose handle the script links back to.
The CVE record is filed against versions ≤ 2.0.27. v2.0.28 has the fix. There are sixty-seven days between the patch shipping and the bug having a name a defender can grep their SCA feed for. NocoBase is open-source and self-hosted; operators are responsible for upgrading. The CHANGELOG entry for v2.0.28 says "Fix security issues" with no description, no impact statement, no upgrade urgency, and no link to a security advisory page. There is no security advisory page.
The runtime exists because operators asked for it.
The IsolatedVm.js runtime exists. The Vm.js runtime exists. The codebase author wrote both, ships both, and selects between them on a single environment variable. The reason both exist is that the safe runtime does not support require. Operators who want to call crypto.createHash or path.resolve or anything else from a workflow script have to flip to Vm.js. That is the supported configuration.
The supported configuration is the unsafe one. The comment on the supported configuration says unsafe; not a security boundary. The patches harden the unsafe configuration. The patches close specific instances of the prototype-chain bypass: console._stdout, the return-value reach, the accessor-property leak. The Node.js vm module's own documentation, paragraph one, says no patch closes the class. NocoBase wrote a patch that closed the class, in #9084. NocoBase reverted it three days later, in #9176.
This is the Unpatchable Primitive shape on its own author's source tree. The primitive is the use of node:vm as a sandbox. The same file is a Design Debt Driver: three security commits to Vm.js in two months, the deepest one reverted three days after shipping, with each patch closing the previous PoC's chain and leaving the next chain for the next PoC. The codebase calls one of its own files unsafe; the codebase is right. CVE-2026-34156 is the bug in the configuration the operator turned on when they wanted require.
The comment said unsafe. The CVE is what unsafe meant.
PoC: Dhananjayasj/CVE-2026-34156-NocoBase-Sandbox-Escape-via-Workflow-Execution-Vulnerability-
The comment said unsafe. The CVE is what unsafe meant.