ni8mare Unauthenticated Rce In n8n Cve 2026 21858
A content-type confusion flaw in n8n's form webhook handling let an unauthenticated attacker supply a crafted JSON body that was treated as file upload metadata, enabling arbitrary file read. By reading the SQLite database and config file, an attacker could forge an admin session and then use an Execute Command node to run OS commands.
Published on infosecwriteups.com
In early 2026, security researchers revealed a critical vulnerability in n8n, a popular automation platform, that allows attackers to completely take over unpatched servers — no credentials needed. Codenamed “Ni8mare” (CVE-2026–21858), this bug earned a CVSS 10.0 rating and put an estimated 100,000 self-hosted n8n…
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The form webhook handler called a file-copying function without first checking that the request Content-Type was multipart/form-data, so attacker-controlled JSON could populate the files field with arbitrary server paths.
Impact
An unauthenticated attacker could read any file the n8n process can access, forge an admin session, and then run OS commands on the host; the text notes this requires a reachable instance running a vulnerable version with an exposed form webhook.
What the attacker needed
N8n version below 1.121.0; an exposed form webhook endpoint; network reachability to the instance
The fix
n8n was fixed in version 1.121.0 by correcting the request handling so content-type spoofing can no longer override file paths.
How it was found
- Send a request to an exposed n8n form webhook endpoint with a Content-Type that is not multipart/form-data.
- Include a JSON body containing a files field whose path points to a target file on the server.
- The server copies that file into the workflow output, disclosing its contents.
- Read the SQLite database and the n8n config file to obtain the admin password hash and the instance secret key.
- Forge a valid admin session cookie using the leaked secret and log in as administrator.
- Create and run a workflow with an Execute Command node to run arbitrary shell commands on the host.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
n8n is a tool that runs automated workflows, and some workflows start when an outside service sends it a web request (a webhook). The code that handled form submissions assumed any request containing a 'files' field really was a file upload, so an attacker could send a normal JSON request with a fake 'files' entry pointing at any file on the server. That let them read sensitive files, log in as the administrator, and then run commands on the machine.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.