Back www.securityjoes.com Security Joes: Breaking the Sandbox Again
n8n is one of the most popular open-source workflow automation platforms in the world, with over 200,000 GitHub stars and deployments ranging from solo developers to enterprise AI pipelines. It lets users connect APIs, databases, LLMs and cloud services using a visual workflow editor. At the heart of each workflow is an expression evaluator - a JavaScript sandbox that lets users write dynamic logic like ={{ $input.first().json.name }} directly inside node parameters. That sandbox is the attack surface.
n8n has had a long history of sandbox escapes. The chain starts with CVE-2025-68613 (late 2025): researchers discovered that (function(){ return this })() leaked the real Node.js process object, yielding full RCE. n8n patched it with a ThisSanitizer that binds this to an empty object in all function expressions. Then came CVE-2026-25049 (February 2026, CVSS 9.9): a destructuring bypass using template literal keys - { [\constr${'uct'}o]: c } - bypassed the sanitizer entirely. Patched again. Then CVE-2026-27577 (February 25, 2026, CVSS 9.4): researchers found that {...process} inside a SpreadElement was never rewritten by VariablePolyfill , exposing the real process global. n8n's fix added a visitSpreadElement hook in expression-sandboxing.ts that replaces bare identifier spread arguments with a safe conditional. Each time: a patch. Each time: another way in. We looked for the one.
We cloned n8n HEAD (version 2.31.0, commit 2fc48bdf ) and focused on the expression sandbox in packages/workflow/src/expression-sandboxing.ts and @n8n/tournament 's VariablePolyfill.ts . The CVE-2026-27577 fix was clean for its stated case. visitSpreadElement correctly rewrites {...process} . But reading VariablePolyfill.ts carefully revealed something the fix didn't address: The jsVariablePolyfill function rewrites free identifiers (like process , Reflect , globalThis ) to safe data-context lookups - but only for specific AST parent types. When the parent type is ArrowFunctionExpression , the switch statement hits an explicit break (a no-op). This is by design: identifiers in the signature or body position of arrow functions aren't polyfilled. That means () => process - an arrow function that returns process - escapes the rewriter entirely . Calling it immediately with (() => process)() yields the real Node.js process object inside new Function -based evaluation.
The second piece: n8n's property denylist ( getBuiltinModule , binding , dlopen , etc.) is enforced via visitMemberExpression , which inspects static property names. Reflect.get(obj, 'getBuiltinModule') passes a string argument - not a property name - so the denylist never fires. Reflect itself is accessible the same way: (() => Reflect)() .
Combining both: you can get a live handle to process.getBuiltinModule and call child_process.execSync .
={{ ((R,p)=>R.get(p,'getBuiltinModule'))((()=>Reflect)(),(()=>process)())('child_process').execSync('id').toString() }} Step by step:
(()=>Reflect)() - arrow captures real Reflect , bypasses polyfill
(()=>process)() - arrow captures real process , bypasses polyfill
R.get(p,'getBuiltinModule') - Reflect.get bypasses MemberExpression denylist
('child_process').execSync('id') - host OS command execution
We verified two ways:
Using the same n8n-workflow package shipped with the published release.
Spinning up npx n8n locally, placing the expression in a Set node parameter, and executing the workflow — the output field returned the host id result. Both verified on n8n 2.30.4 , which was released after the CVE-2026-27577 patch line.
Any authenticated user with workflow create or edit permissions achieves host-level RCE as the n8n process user. In cloud-hosted environments this means:
Reading process.env for API keys, OAuth tokens, N8N_ENCRYPTION_KEY
Decrypting every stored credential in n8n's vault
Lateral movement to internal services, databases, and cloud metadata endpoints reachable from the n8n host
The exploit requires a login with workflow edit rights ( PR:L ). Expected CVSS in the same band as CVE-2026-27577 (~9.4 Critical).
July 14, 2026 - Sandbox escape residual identified on n8n HEAD and 2.30.4 July 15, 2026 - Reported via n8n Vulnerability Disclosure Program July 15, 2026 - Report ID issued: th_01KXJHJJ3WEK3R84HHHHF4F50K July 22, 2026 - n8n confirmed: vulnerability accepted, fix deployed, CVE awaiting assignment.
Link to advisory:
Most n8n sandbox research targets one gadget at a time. What this bypass needed was two independent rewriter blind spots working together: the arrow-function polyfill gap (structural) and the Reflect.get string-argument denylist gap (semantic). Neither alone is sufficient. Neither was covered by tests. The fix for CVE-2026-27577 added 15 lines to visitSpreadElement . It closed the spread vector completely.
But it didn't ask a broader question: what other AST parent types does the polyfill skip? Answering that question is what found this bypass. Responsible Disclosure We reported directly to n8n's VDP before publishing anything. No live instances were tested. All research was conducted on a local self-hosted instance running the published npm package. We waited for confirmation and fix before writing this. Fix n8n has confirmed the fix is deployed. If you are self-hosting, update immediately. As a short-term mitigation: set N8N_EXPRESSION_ENGINE=vm or restrict workflow creation to fully trusted users only. Rotate N8N_ENCRYPTION_KEY and all stored credentials if you were running an affected version with untrusted workflow editors.
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
