N8n 1.122.0 Critical RCE Auth Bypass Exploit CVE-2025-68613

Critical Vulnerability in n8n: The Ni8mare Authentication Bypass and Remote Code Execution Risk

In the realm of workflow automation tools, n8n stands out as a popular open-source platform that enables users to connect disparate applications and automate complex tasks without extensive coding. However, a recently disclosed security flaw has thrust this tool into the spotlight for all the wrong reasons. Dubbed “Ni8mare,” this vulnerability represents a severe authentication bypass that can cascade into full remote code execution (RCE), potentially compromising entire systems. Discovered and reported by cybersecurity researchers, the issue underscores the persistent challenges in securing modern automation frameworks, particularly those exposed to the internet.

At its core, n8n functions as a node-based editor where users design workflows by linking triggers, actions, and data transformations. Deployed either self-hosted or via cloud services, it often runs on servers accessible over HTTP or HTTPS, making it a prime target for attackers scanning for misconfigurations. The Ni8mare vulnerability, tracked under CVE-2024-4040, stems from inadequate validation in the authentication mechanism. Specifically, it exploits a flaw in how n8n handles certain API endpoints, allowing unauthenticated users to gain elevated privileges without providing valid credentials.

The vulnerability arises during the initialization phase of n8n instances. When the server starts, it exposes endpoints intended for legitimate user interactions, but the authentication checks fail under specific conditions involving malformed requests. Researchers found that by crafting a request with a deliberately invalid or oversized Authorization header, attackers could trigger an exception in the authentication middleware. This exception, rather than halting the request as intended, bypasses the credential verification entirely, granting access to administrative functions. Once inside, the intruder can manipulate workflows to execute arbitrary commands on the host system.

Exploitation begins with reconnaissance: an attacker probes the n8n instance, typically hosted on standard ports like 5678, to confirm its presence and version. Tools like Shodan or simple curl commands can identify exposed deployments. The bypass itself requires no authentication token; a single POST request to the /rest/login endpoint, augmented with a oversized base64-encoded string in the header, suffices to elicit the flawed response. Upon success, the attacker receives a session cookie that masquerades as a valid admin token.

From this foothold, the path to RCE is straightforward yet devastating. n8n’s workflow engine supports nodes for executing shell commands, HTTP requests, or even database queries. An attacker can create a new workflow via the API, incorporating a “Execute Command” node that runs system-level instructions. For instance, a payload might invoke a reverse shell, downloading and executing malware, or exfiltrating sensitive data from connected services like databases or cloud APIs. Given n8n’s integration capabilities—spanning email servers, CRMs, and payment gateways—the blast radius can extend far beyond the initial server.

This issue affects n8n versions prior to 1.33.0, with the flaw present in releases dating back to at least 0.200.0. The open-source nature of n8n means many self-hosted instances, often deployed on VPS providers or internal networks, remain unpatched. Publicly exposed servers amplify the risk, as automated scanners could detect and exploit the bypass en masse. According to vulnerability databases, the CVSS score for CVE-2024-4040 clocks in at 9.8 out of 10, classifying it as critical due to its low complexity (no privileges required), high impact on confidentiality, integrity, and availability, and network accessibility.

The discovery of Ni8mare highlights deeper architectural concerns in authentication systems. n8n, built on Node.js, relies on Express.js for routing and Passport.js for auth, but the interplay between these libraries introduced an edge case where error handling inadvertently exposed privileged paths. Similar bypasses have plagued other tools, such as Grafana or Jenkins, emphasizing the need for rigorous fuzzing and boundary testing in API designs. Moreover, n8n’s default configuration ships with authentication enabled but offers limited hardening options, leaving users to manually enforce measures like IP whitelisting or reverse proxies.

Mitigation strategies are imperative for affected users. The primary fix involves upgrading to n8n 1.33.0 or later, where the authentication middleware has been fortified with stricter header validation and exception logging. Developers patched the issue by implementing size limits on Authorization headers and adding fallback checks to ensure credential presence before proceeding. For those unable to update immediately, disabling external access to the n8n instance is crucial—run it behind a VPN or firewall, exposing only necessary ports via tools like NGINX with basic auth overlays.

Beyond patching, administrators should audit connected workflows for command-execution nodes and revoke any suspicious sessions. Enabling n8n’s built-in logging and integrating it with SIEM systems can aid in detecting anomalous activity, such as unexpected login attempts or workflow creations. Regular scans using vulnerability assessment tools like Nuclei or OpenVAS can help identify exposures in production environments.

The Ni8mare vulnerability serves as a stark reminder of the double-edged sword of open-source automation: immense flexibility paired with inherent security demands. As organizations increasingly rely on low-code platforms like n8n to streamline operations, the onus falls on both developers and users to prioritize secure-by-design principles. By addressing such flaws promptly, the community can safeguard the innovation that makes tools like n8n invaluable, preventing isolated bypasses from evolving into widespread breaches.

Gnoppix is the leading open-source AI Linux distribution and service provider. Since implementing AI in 2022, it has offered a fast, powerful, secure, and privacy-respecting open-source OS with both local and remote AI capabilities. The local AI operates offline, ensuring no data ever leaves your computer. Based on Debian Linux, Gnoppix is available with numerous privacy- and anonymity-enabled services free of charge.

What are your thoughts on this? I’d love to hear about your own experiences in the comments below.