If you run a self-hosted automation stack, this is the kind of advisory you treat as an emergency change window. A newly disclosed issue widely referred to as Ni8mare links CVE-2026-21858 (arbitrary file read) with CVE-2025-68613 (sandbox bypass → remote code execution), potentially allowing attackers to take full control of vulnerable n8n servers under certain workflow conditions.

In this guide, we explain what the Critical n8n Vulnerability CVE-2026-21858 (Ni8mare) means in plain English. We also show how the end-to-end attack chain works at a high level, identify the affected versions, and outline how you can fix and harden your deployment quickly, without turning the article into an exploitation tutorial.

Watch the explainer video

Ni8mare n8n vulnerability exploit chain showing file read token forge sandbox bypass and RCE
Visual summary of the Ni8mare vulnerability chain combining CVE-2026-21858 and CVE-2025-68613 in n8n.

What is the Ni8mare Vulnerability in n8n?

Ni8mare is a critical vulnerability chain that affects certain self-hosted n8n deployments. At a high level, the issue combines two distinct weaknesses:

  • A pre-auth weakness that can lead to arbitrary file read (CVE-2026-21858), and
  • A post-authentication weakness in which attackers bypass expression or sandbox controls to achieve remote code execution (CVE-2025-68613).

In practice, the risk goes far beyond “someone running a command.” More importantly, attackers can access sensitive data stored within the n8n environment, including configuration files, credentials, tokens, and workflow secrets. As a result, they may gain full control of the server, depending on how administrators expose the instance and which workflow patterns they use.

Definition

Critical n8n Vulnerability CVE-2026-21858 (Ni8mare) refers to a critical n8n security issue in which attackers abuse specific request-handling patterns to read files and then escalate privileges to gain admin access and remote code execution through a chained weakness.


Why CVE-2026-21858 Is Rated Critical (CVSS 10.0)

A CVSS 10.0 rating represents the most severe, worst-case security outcomes. In the case of Ni8mare, several factors combine to justify this critical classification:

  • No credentials required in the initial step (unauthenticated exposure in vulnerable conditions).
  • High impact: sensitive data exposure can enable authentication bypass, and chaining can lead to full takeover.
  • Operational blast radius: n8n often sits at the center of automation, connected to email, chat, CRMs, cloud storage, databases, CI/CD, and internal APIs. A compromise can quickly pivot into your broader infrastructure.

Also important: exposure is often version-based plus configuration-based. Many systems are not exploitable unless they have certain endpoints publicly reachable and a workflow pattern that makes the chain possible. That nuance matters for risk assessment, but it does not reduce the urgency of patching.


Full Exploit Chain Breakdown

This section explains the chain conceptually so you can understand the risk and validate defenses, without providing step-by-step exploitation instructions.

Arbitrary File Read via Content-Type Confusion

The chain begins with the ability to trick a vulnerable request-handling path into treating attacker-controlled input “as if” it were a legitimate file upload reference. In this scenario, the application processes the file path incorrectly, which allows attackers to read arbitrary files from the server’s disk.

Why this matters:

  • If an attacker can read local files, they may be able to access configuration and stored secrets.
  • In self-hosted deployments, those secrets often unlock additional escalation paths.

Forging Admin JWT Tokens

Once attackers obtain sensitive configuration data, they move to the next step in the chain: an authentication bypass. At this stage, they use stolen secrets to create a valid admin session token or cookie.

At this stage, the problem is no longer “just” data exposure. Admin session access can allow:

  • Viewing and editing workflows
  • Reading stored credentials (depending on protections)
  • Changing endpoints and triggers
  • Creating new automations that execute actions

Sandbox Bypass Leading to Remote Code Execution

The final step uses a second issue (CVE-2025-68613) described as an expression injection / sandbox bypass that can lead to remote code execution in vulnerable versions. In simple terms: an attacker with admin-level control can craft workflow logic that escapes intended isolation controls and executes commands on the host.

This “file read → admin session → RCE” progression is what turns a serious bug into a complete server compromise story.

n8n Ni8mare vulnerability proof of concept showing escalation to admin access
Lab demonstration output validating the impact of the Ni8mare vulnerability in a controlled environment.

Affected n8n Versions

Based on the provided disclosure details, the vulnerable ranges and fixed versions are described as follows:

  • CVE-2026-21858 (AFR): affected ≤ 1.65.0, fixed in 1.121.0
  • CVE-2025-68613 (RCE): affected ≥ 0.211.0, fixed in 1.120.4+

Version matrix (quick reference)

ComponentVulnerabilityAffectedFixed
Arbitrary File ReadCVE-2026-21858≤ 1.65.01.121.0
Sandbox bypass / RCECVE-2025-68613≥ 0.211.01.120.4+

How to self-check (safely)

  • Check your running n8n version in your deployment method (container tag, package version, or admin UI version info).
  • If you are behind the fixed versions listed above, treat it as an urgent patch.

How to Fix Ni8mare Immediately

If you are worried that your instance could be exposed. First, reduce your n8n instance’s internet exposure. Then, apply the required patches as quickly as possible.

Step 1: Update to fixed versions (preferred)

Update n8n to a version that includes the fixes referenced:

  • Patch the arbitrary file read issue (target the fixed version noted for CVE-2026-21858).
  • Patch the RCE/sandbox bypass issue (target the fixed version noted for CVE-2025-68613).

If you are already newer than the fixed releases, still review your configuration and restrict exposure where possible.

Step 2: Reduce exposure while you patch

If you must stay online during upgrade work:

  • Restrict access to n8n UI and webhook/form endpoints (firewall, VPN, reverse-proxy auth, IP allowlists).
  • Disable or unpublish workflows that accept file uploads from unauthenticated public users until patched.

Step 3: Rotate secrets after upgrading (defense-in-depth)

Because the chain involves reading sensitive configuration and forging sessions, assume secrets could be at risk if the instance were exposed:

  • Rotate relevant environment secrets and keys tied to your n8n deployment.
  • Review credential stores connected to n8n (API keys, OAuth tokens, database creds) and rotate where applicable.

Public PoC reference (for defenders)

Quick recap: Ni8mare is dangerous because the chain can move from unauthenticated access to sensitive file reads, then to admin session access, and finally to remote code execution; so the safest path is to patch, restrict public exposure, and rotate secrets after upgrading.


Proof of Concept and Responsible Disclosure

A public proof-of-concept (PoC) is available, and the disclosure details include a full-chain description connecting the two CVEs. PoCs can help defenders validate risk and pressure rapid patch adoption, but they can also be misused.

If you are responsible for a production instance:

  • Use PoCs only in a controlled lab or with explicit authorization.
  • Prioritize patching and monitoring over “trying it out” on live systems.
Ni8mare N8n Vulnerability Proof Of Concept Demonstration
Ni8mare N8n Vulnerability Proof Of Concept Demonstration

Detection, Logs, and Hardening Recommendations

Even if you patch immediately, it’s smart to treat this as an incident-readiness moment. Here’s what to do next.

Indicators to review

  • Unusual access patterns to public endpoints (especially form/webhook style endpoints).
  • Sudden creation or modification of workflows you did not authorize.
  • Unexpected admin sessions or authentication anomalies.
  • Any spike in outbound connections from your n8n host that doesn’t match normal workflow behavior.

Network and deployment hardening

  • Put n8n behind a reverse proxy with strong access controls (SSO, basic auth, IP restrictions).
  • Avoid exposing sensitive endpoints directly to the internet unless strictly required.
  • Segment the host: run n8n with least privilege, and restrict filesystem access where feasible.

Workflow hygiene (often overlooked)

  • Audit workflows that accept file uploads from anonymous users.
  • Prefer patterns that don’t return raw file content directly to the requester unless necessary.
  • Keep a change log / approval flow for production workflow changes.

Related Security Best Practices and Further Reading


Frequently Asked Questions

What is Ni8mare in n8n?

Ni8mare is a name used to describe a critical vulnerability chain involving CVE-2026-21858 (file read) and CVE-2025-68613 (sandbox bypass/RCE) that can lead to server takeover in vulnerable self-hosted setups.

Is CVE-2026-21858 remotely exploitable?

It can be, depending on exposure and workflow configuration. The risk increases when relevant endpoints are publicly accessible, and the instance is within the affected versions.

Does this affect cloud-hosted n8n?

Some write-ups note that architecture and file access differences can reduce impact in cloud-hosted environments, but you should rely on your vendor’s advice and still apply updates promptly.

Which n8n versions are vulnerable?

The provided disclosure notes affected/fixed ranges for both CVEs (file read and RCE portions). Use the version table above and patch to the fixed versions or later.

How do attackers gain admin access?

The chain describes exfiltration of sensitive data (like keys), which can enable forging a valid admin session cookie/token, resulting in admin-level access.

Is authentication required?

The initial weakness is described as “unauthenticated” in the vulnerable chain scenario, meaning the attacker does not need credentials at the start, again, depending on exposure and workflow conditions.

Can this lead to data theft?

Yes. If files and secrets are exposed, and workflows/credentials are accessible, data exfiltration and lateral movement become realistic concerns.

How do I patch n8n safely?

Upgrade to fixed versions, restrict exposure while patching, and rotate secrets afterward. If you can’t patch immediately, temporarily disable public-facing workflows that accept file uploads.

Is there a temporary workaround?

A temporary risk-reduction approach is to restrict access (VPN/IP allowlist), reduce public endpoints, and disable risky public workflows until patched. Workarounds are not substitutes for upgrading.

Has this been exploited in the wild?

Public exposure tracking suggests there are internet-accessible instances that could be at risk, but “confirmed exploitation” claims require careful verification. Treat it as urgent regardless.


Immediate Actions for n8n Users

Ni8mare (CVE-2026-21858) represents a worst-case vulnerability scenario due to its potential for unauthenticated access, privilege escalation, and remote code execution when chained with CVE-2025-68613.

For this reason, administrators should treat this issue as a patch-now priority. Update to fixed n8n versions, restrict public access to sensitive endpoints, and rotate exposed secrets after upgrading. At the same time, review workflow designs that accept untrusted input to reduce future risk.

Ultimately, timely patching and disciplined workflow hygiene remain the most effective defenses against high-impact automation platform vulnerabilities.

Experience Note (optional)

If you’re running n8n as a core automation hub, patching quickly here is less about “one CVE” and more about protecting every connected system n8n can reach.

Disclaimer

This article is for defensive security awareness and incident response guidance. Do not use these concepts to access systems you do not own or have explicit permission to test. Always follow applicable laws and responsible disclosure practices.