A series of critical vulnerabilities in n8n, the widely adopted open-source workflow automation and AI orchestration platform, has brought to light systemic issues in sandbox design and remote execution isolation. These security flaws allow authenticated users to bypass sandbox protections, achieve remote code execution (RCE), take full control of n8n instances, and potentially compromise all integrations and credentials stored within. The impact spans self-hosted deployments and multi-tenant cloud environments that host mission-critical automation pipelines.
Introduction and Background
n8n (short for “node-everything”) is a popular workflow automation engine written in Node.js that enables developers and platform integrators to connect applications, APIs, and services into automated sequences. Workflows often combine third-party integrations, internal systems, and AI services — including generative models — into single orchestration pipelines.
What makes n8n unique is its expression engine: user-provided JavaScript that is evaluated at run-time inside an internal sandbox. This allows workflow builders to write code like:
={{ $json.email.toLowerCase() }}
and even more complex transformations using built-in variables such as $input, $env, and $now.
Because workflows often handle credentials, API keys, and system access, the sandbox is critically important — it must prevent potentially malicious code from escaping and executing at the host level.
The Vulnerabilities at a Glance
The research published by Pillar Security and independent security teams revealed two core vulnerabilities that share a fundamental root cause: an incomplete and bypassable sandbox.
1. AST Sanitization Bypass – CVE-2026-25049
- Severity: CVSS 10.0 (Critical)
- Impact: Authenticated users can craft expressions that bypass JavaScript sandbox protections and execute arbitrary system code.
- Core flaw: The sandbox uses an Abstract Syntax Tree (AST) sanitizer to filter dangerous constructs, but fails to sanitize all syntactic forms.
- Specifically, constructs such as template literals, arrow functions, and calls to
Object.definePropertycan reach dangerous hooks likeError.prepareStackTrace— resulting in full RCE.
Unlike simple token filtering, AST sanitization must inspect all syntactic nodes — including call arguments, expressions, and nested constructs. When the sanitizing logic assumes only limited patterns (e.g., MemberExpression), attackers find ways to express the same intent through alternate syntax — effectively slipping past the filters.
2. Python Code Node Sandbox Escape – CVE-2026-0863
- Severity: CVSS 8.5 (High)
- Impact: Users with rights to create or modify workflows can exploit the Python Code Node to escape the Pyodide sandbox, invoking native system calls.
- Mechanism: The Python sandbox provided by Pyodide was designed for isolation but did not effectively restrict system-level accesses under certain inputs.
n8n’s Python Code Node allows workflow authors to execute Python code on demand. Because Pyodide runs CPython bytecode inside a WebAssembly sandbox, any bypass of this sandbox grants arbitrary host access.
Root Cause: Incomplete Sandbox Isolation
Both vulnerabilities trace back to a deeper architectural flaw:
- Expression evaluation sandboxing is inherently difficult.
Attempting to secure a rich language like JavaScript through ACL-style sanitization (allowlists/denylists) is brittle — small syntactic differences can bypass checks. - Pyodide sandboxing provides insufficient defense against code escapes.
Safely confining Python execution inside a browser-oriented Python interpreter requires strong controls that were not fully implemented in the early versions of the Code Node. - Multi-tenant cloud environments amplify blast radius.
In n8n Cloud, one compromised workflow author with a sandbox escape could pivot to internal services — such as secret stores, hook APIs, and container infrastructure — potentially affecting all tenants.
Technical Breakdown: How RCE Is Achieved
A typical exploit chain discovered by researchers proceeds as follows:
- The attacker embeds a crafted expression in a workflow node.
- The expression parser transforms it into an AST.
- The sanitizer attempts to strip dangerous constructs but fails on certain syntactic forms.
- Using JavaScript quirks (e.g., arrow functions inheriting
this, unfiltered method arguments), the malicious expression reassigns critical internals likeError.prepareStackTrace. - This undermines sandbox isolation, allowing system modules (like
child_process) to be invoked. - Once native execution is possible, arbitrary commands can be run with the privileges of the n8n process.
Here’s the core insight: the attacker need not be an administrator — workflow creation privileges are sufficient. In many enterprise contexts, developers and SRE staff commonly have workflow edit permissions.
Impact: From Credentials to Platform Takeover
Once an attacker achieves RCE, the consequences are severe:
- Database credential extraction: n8n stores encrypted credentials for all third-party services. With host filesystem and environment access, attackers can extract and decrypt these.
- AI API key theft: Keys for AI providers (OpenAI, Anthropic, Azure, etc.) stored in workflows can be exfiltrated.
- Internal service access: In cloud instances, pivoting to other internal Kubernetes services is possible.
- Workflow poisoning: Existing automation pipelines can be tampered with to exfiltrate data, redirect logic, or deploy backdoors.
The result is not merely infrastructure compromise, but full takeover of orchestration control — effectively the nerve center of enterprise automation.
Mitigation, Patches, and Best Practices
Addressing these vulnerabilities requires both immediate remediation and long-term architectural hardening:
Immediate Actions
- Upgrade n8n: Apply the latest patched versions (e.g., >= 2.4.5).
- Rotate stored credentials: Change all API keys, tokens, and secrets stored in n8n after patching.
- Review user permissions: Restrict workflow edit capabilities to trusted users.
Best Practices
- Implement defense-in-depth: Use network segmentation, firewall rules, and isolated execution environments.
- Monitor for anomalous workflows: Scan for suspicious expressions or nodes that interact with system resources.
- Separate AI credentials: Consider dedicated instances for AI workflows with minimal access scopes.
Long-Term Architectural Lessons
- Sanitization is not isolation: True sandboxing requires separate runtime processes (e.g., isolated interpreters, V8 isolates).
- Comprehensive AST coverage: Security logic must analyze all syntax nodes and not assume specific patterns.
- Ongoing fuzzing and research: Supply chain tools that accept user code must be tested against synthetic and real-world attack vectors.
Conclusion
The n8n sandbox escape vulnerabilities highlight a fundamental truth: any platform that executes user-provided code is only as secure as its isolation mechanisms. In modern enterprise environments where automation workflows anchor AI services, data pipelines, and critical integrations, a sandbox escape is tantamount to full system compromise.
Though patches are available, operators must take proactive steps to harden their deployments, rotate secrets, and reevaluate privilege models to ensure that an automation platform doesn’t become the weakest link in a complex security posture.
