Ni8mare: Critical n8n Flaw Exposes 100,000 AI Workflow Servers

A CVSS 10.0 vulnerability in n8n lets attackers hijack self-hosted AI workflow instances without authentication. Patch and exposure scope.

Updated October 12, 2026

If you’re running AI agents or LLM-powered automations on a self-hosted n8n instance, you may have a critical problem: CVE-2026-21858, codenamed “Ni8mare,” carries a perfect 10.0 CVSS score and allows complete takeover of vulnerable servers without any authentication.

The flaw was publicly disclosed by Cyera Research Labs on January 7, 2026, and affects approximately 100,000 self-hosted n8n instances globally. While a patch has been available since November 2025, Censys scanning data shows over 26,000 instances remain exposed to the internet - many of them powering AI workflows.

Why n8n Matters for AI

n8n has become the go-to platform for building AI agent workflows. The open-source tool - with over 100 million Docker pulls - lets users wire up LLM integrations, build autonomous agents, and connect AI systems to 400+ apps and services.

According to n8n’s documentation, the platform supports direct integrations with OpenAI, Anthropic Claude, Google Gemini, Cohere, HuggingFace, and local models via Ollama. It’s increasingly used by enterprises to build production AI automations that combine reasoning models with deterministic business logic.

That makes this vulnerability particularly dangerous. An attacker who compromises an n8n instance gains access to whatever those workflows can access: API keys, database credentials, internal systems, and the AI models themselves.

How Ni8mare Works

The vulnerability exploits a subtle content-type confusion in n8n’s webhook handling.

When n8n receives a file upload request, it checks the Content-Type header to decide how to parse the data. If the header says multipart/form-data, the system uses a file upload parser. If it says something else, like application/json, it uses a regular body parser.

The problem: the Form webhook node calls file-handling functions without verifying that the content-type actually matches what was sent. An attacker can exploit this by sending a request with Content-Type: application/json that includes a crafted payload referencing arbitrary local files.

Instead of processing an uploaded file, the system copies whatever local file the attacker specifies.

From File Read to Full Takeover

The initial file read is devastating on its own, but the attack chain goes further.

Stage 1: Extract credentials. Attackers target n8n’s SQLite database at /home/node/.n8n/database.sqlite, which contains admin user IDs, emails, and hashed passwords. They also grab /home/node/.n8n/config, which holds the encryption secret key used to sign session cookies.

Stage 2: Forge admin sessions. Armed with the encryption key and user data, attackers forge valid administrator session cookies. Since n8n signs sessions using JWT with the instance-specific secret, possession of that secret means complete authentication bypass.

Stage 3: Execute commands. With admin access, attackers create workflows containing the “Execute Command” node - a legitimate n8n feature for running shell commands. Game over.

The entire attack requires no authentication. If your n8n instance accepts webhook requests from the internet, you’re vulnerable.

Scope of Exposure

Censys identified 26,512 exposed n8n instances globally. Separately, Shadowserver scanning data initially tallied over 105,000 vulnerable instances out of 230,000+ total, dropping to about 59,500 as patching spread.

These counts cover only the instances directly accessible from the internet. The actual number of vulnerable deployments - including those behind VPNs or internal networks where an attacker might already have a foothold - is likely much higher.

Not Just One Flaw

Ni8mare isn’t n8n’s only recent security crisis. According to Rapid7’s analysis, Ni8mare is one of five n8n CVEs published between December 19, 2025 and January 7, 2026 that can be chained with it for code execution or arbitrary file write. Rapid7 lists NVD scores for each; the others include:

  • CVE-2025-68613 (CVSS 8.8): Authenticated expression-language injection
  • CVE-2025-68668 (CVSS 9.9): N8scape, a Pyodide sandbox bypass
  • CVE-2026-21877 (CVSS 9.9): Authenticated RCE via file write
  • CVE-2025-68697: Another authenticated flaw in the same chain

The pattern suggests systemic security issues in n8n’s architecture rather than isolated bugs.

What You Need to Do

If you’re running a self-hosted n8n instance, here’s your checklist:

Immediate:

  1. Upgrade to version 1.121.0 or later. The Ni8mare patch has been available since November 18, 2025.
  2. Check whether your instance is exposed to the internet. If Forms or webhooks are publicly accessible without authentication, assume you may already be compromised.
  3. Rotate all credentials stored in n8n workflows, including API keys, database passwords, and service tokens.

Longer term: 4. Require authentication on all Form nodes. 5. Avoid exposing n8n to the internet unless absolutely necessary. Put it behind a VPN or zero-trust network. 6. Monitor for suspicious workflow creations, particularly any containing the Execute Command node.

The Bigger Picture

This vulnerability highlights a growing security challenge in the AI automation space. Platforms like n8n, Langchain, and OpenClaw are becoming critical infrastructure for AI agent deployments. When they have security flaws, attackers gain access to AI systems that may have broad permissions across enterprise environments.

The attack surface is expanding faster than the security tooling. AI agents that can read files, execute code, and access APIs are inherently powerful - and that power works just as well for attackers who compromise the underlying platform.

Self-hosted tools offer privacy benefits over cloud services, but they also shift the security burden entirely onto operators. Many organizations running n8n for AI workflows may not have the security expertise to properly harden their deployments.

The Bottom Line

If you’re running n8n for AI automation, patch immediately and audit your exposure. A perfect 10.0 CVSS score isn’t marketing - it means unauthenticated attackers can completely take over your instance, extract your AI credentials, and run arbitrary commands on your server.

The patch has been available for months. Every day you wait is a day your AI workflows remain exposed.