Critical Expression Injection Vulnerability in n8n (CVE-2025-68613)
A severe security flaw in n8n, a popular Node.js-based workflow automation tool, allows attackers to execute arbitrary JavaScript code with system-level privileges. Tracked as CVE-2025-68613, this expression injection vulnerability carries a CVSS score of 9.9, posing critical risks to confidentiality, integrity, and availability. While exploitation requires authentication, any authenticated user can trigger the attack, making it a high-priority concern for organizations using n8n.
Key Details
- Vulnerability Type: Expression Injection (CWE-94: Improper Control of Code Generation)
- CVSS Score: 9.9 (Critical)
- Affected Software: n8n (all versions prior to patched releases)
- Disclosure Date: December 19, 2025
- Exploitability: Requires authentication but can be triggered by any authenticated user
- Attack Vector: Malicious expressions submitted via n8n’s evaluator
Root Cause: How the Vulnerability Works
Inadequate Input Sanitization
n8n processes user input wrapped in double curly braces {{ }} as executable JavaScript code. The flaw stems from:
- No sandboxing: Expressions execute in the same context as the n8n process.
- No module restrictions: Attackers can access dangerous Node.js modules like
child_processorfs. - No input validation: Curly-brace-wrapped expressions are trusted by default.
Critical Insight: User-controlled expressions should never have direct access to Node.js’s module system. This violates the principle of least privilege.
Missing Context Isolation
The expression evaluator lacks proper isolation, enabling attackers to:
- Escape the intended evaluation sandbox.
- Access Node.js core modules (e.g.,
child_process,fs). - Execute system commands with the privileges of the n8n process.
Exploitation: How Attackers Abuse the Flaw
Attack Flow
- Payload Submission: An authenticated user submits a malicious expression via n8n’s interface.
- Sandbox Escape: The payload bypasses the evaluator’s intended scope.
- Code Execution: Arbitrary JavaScript runs with n8n’s process privileges.
- Impact: Attackers achieve remote code execution (RCE), data theft, or privilege escalation.
Proof-of-Concept (PoC) Example
The following payload demonstrates how an attacker could execute system commands (e.g., id to retrieve user information):
{{ (function(){ return this.process.mainModule.require('child_process').execSync('id').toString() })() }}
Note: A public exploit is available at wioui/n8n-CVE-2025-68613-exploit.
Impact and Risks
| Impact Area | Description |
|---|---|
| Confidentiality | Attackers can access sensitive data processed by n8n or stored on the system. |
| Integrity | Malicious code can modify workflows, data, or system configurations. |
| Availability | Exploits may crash the n8n process or disrupt automation workflows. |
| Privilege Escalation | If n8n runs with elevated privileges, attackers can gain full system control. |
Mitigation and Remediation
Immediate Actions
- Upgrade n8n to the latest patched version (if available).
- Restrict access to n8n instances to trusted users only.
- Monitor logs for suspicious expressions (e.g.,
child_processusage).
Long-Term Fixes
- Implement strict sandboxing (e.g., using VM2 or similar libraries).
- Disable dangerous modules in the expression evaluator.
- Add input validation to reject or sanitize curly-brace-wrapped expressions.
Best Practices for Secure Workflow Automation
- Principle of Least Privilege: Run n8n with minimal necessary permissions.
- Network Segmentation: Isolate n8n instances from critical systems.
- Regular Audits: Review workflows and expressions for suspicious patterns.
- Dependency Updates: Keep Node.js and n8n dependencies up to date.