Skip to main content

Command Palette

Search for a command to run...

Security Disaster on the n8n Automation Platform (January 2026)

Updated
5 min read
Security Disaster on the n8n Automation Platform (January 2026)

In January 2026, the open-source and DevOps communities were shaken by the disclosure of two critical security vulnerabilities in n8n—currently the world's most popular workflow automation platform. The combination of these flaws creates a "doomsday" scenario for unpatched systems: ranging from unauthenticated attacks to privilege escalation that grants total server control.

Below is a detailed technical breakdown of these two security nightmares: "Ni8mare" (CVE-2026-21858) and the Sandbox Escape (CVE-2025-68668).

1. CVE-2026-21858: "Ni8mare" – Unauthenticated RCE (CVSS 10.0)

Discovered by Cyera Research Labs, this vulnerability scored a perfect 10.0/10 on the CVSS scale. This rare score is reserved for vulnerabilities that allow Remote Code Execution (RCE) without authentication, without user interaction, and with low attack complexity.​

Technical Mechanism: Parsing Logic Flaw

The core of this vulnerability lies in how n8n processes heterogeneous HTTP requests, specifically involving Content-Type confusion.

  1. Middleware Mismatch: The n8n application uses middleware to handle file uploads (typically multipart/form-data). However, an attacker can send a specially crafted HTTP request where the body contains file data, but the Content-Type header is spoofed (e.g., declared as application/json despite the structure being different).​

  2. Parameter Injection: Due to this confusion, the system fails to process the file through the standard secure pipeline, allowing the attacker's input to directly overwrite the internal req.body.files object in n8n's backend code.

  3. Path Traversal: Once req.body.files is controlled, the attacker manipulates the file path parameter (filepath). Instead of pointing to a temporary uploaded file, they point this path to sensitive system files on the server.​

Kill Chain: From Stranger to Admin

Attackers exploit this vulnerability via a 4-step process to achieve "Full Instance Takeover":​

  • Step 1: Data Exfiltration: Leveraging the Path Traversal flaw, the attacker forces n8n to read configuration files (config) or the internal database (typically SQLite at /home/node/.n8n/database.sqlite).

  • Step 2: Credential Theft: From the exposed database, they extract user lists, password hashes, and most importantly, authentication secrets/encryption keys.

  • Step 3: Session Forgery: Using the stolen secrets, the attacker cryptographically signs a valid authentication cookie, impersonating the system Administrator.

  • Step 4: Remote Code Execution (RCE): Once logged in as Admin, the attacker simply creates a new workflow, adds an "Execute Command" node (a native n8n feature), and runs any Linux command they desire (e.g., installing backdoors, crypto mining, or wiping data).


2. CVE-2025-68668: Sandbox Escape – The Insider Threat (CVSS 9.9)

If "Ni8mare" is the external threat, CVE-2025-68668 demonstrates that even valid users can be dangerous. This is a privilege escalation vulnerability achieved by breaking out of the isolated environment.​

Context: Python in n8n

n8n allows users to write custom code using JavaScript or Python. For security, this Python code is executed within an isolated environment called a Sandbox (using Pyodide—a Python port running on WebAssembly) to prevent user code from accessing the host operating system.​

Exploitation Mechanism

  • Pyodide Implementation Flaw: The Pyodide integration in n8n versions v1.0.0 up to (but not including) v2.0.0 contains a flaw in its access control mechanism.

  • System Command Execution: An authenticated user (who has permissions to create workflows) can write a specific Python script in the "Code Node." This script exploits the flaw to "jump" out of the WebAssembly/Pyodide boundary and interact directly with the host operating system's Shell.​

  • Impact: The attacker can execute commands with the privileges of the n8n process (often root inside a Docker container or the n8n user).


3. Why is n8n a "Golden Target" for Hackers?

Compromising an n8n server is far more dangerous than hacking a standard website due to the nature of the tool:

  1. Central Connectivity Hub: n8n is designed to connect everything. A single n8n server often stores API Keys, OAuth Tokens, and Database Credentials for dozens of other services like Google Sheets, Slack, AWS, OpenAI, Salesforce, etc.

  2. Pivot Point: From n8n, an attacker can easily conduct lateral movement attacks into other internal systems that n8n has access to.

  3. Sensitive Data Stream: Workflows often process critical business data (orders, customer PII, internal emails) passing through n8n in real-time.


4. Remediation and Defense Strategy

To combat the severity of these vulnerabilities, system administrators must implement a multi-layered defense strategy immediately.

A. Upgrade (Mandatory)

This is the only way to permanently resolve the issues:

  • Upgrade immediately to n8n v2.0.0 or later.

  • Version 2.0.0 changes the architecture, making the "Task Runner" the default for Python, which completely isolates code execution and prevents CVE-2025-68668.​

  • Patches for CVE-2026-21858 (the parser flaw) are also included in the latest updates (from 1.121.0 onwards).​

B. Mitigation (If Upgrade is Delayed)

If production environments cannot be upgraded immediately, apply the following environment variables to lock down vulnerable features:​

  1. Disable Code Node completely (If unused):

     bashexport NODES_EXCLUDE="[\"n8n-nodes-base.code\"]"
    
  2. Disable Python in Code Node (Blocks CVE-2025-68668):

     bashexport N8N_PYTHON_ENABLED=false
    
  3. Manually Enable Task Runner (For v1.x):

     bashexport N8N_RUNNERS_ENABLED=true
     export N8N_NATIVE_PYTHON_RUNNER=true
    

C. Network Security

  • No Public Exposure: Never expose the n8n Dashboard directly to the public Internet.

  • Use VPN/Tunnel: Only allow access via internal VPNs or Zero Trust solutions (like Cloudflare Tunnel, Tailscale).

  • Basic Auth/Reverse Proxy: Place an additional authentication layer (e.g., Nginx Basic Auth) in front of n8n to block exploit requests from strangers, even if n8n itself remains unpatched.​


5. Reference

  1. New n8n Vulnerability (9.9 CVSS) Lets Authenticated Users Execute System Commands

  2. Critical unauthenticated RCE in n8n (CVE-2026-21858, CVSS 10.0) allows full instance takeover

  3. Ni8mare  -  Unauthenticated Remote Code Execution in n8n (CVE-2026-21858)

More from this blog

F

FPT IS Security

755 posts

Dedicated to providing insightful articles on cybersecurity threat intelligence, aimed at empowering individuals and organizations to navigate the digital landscape safely.