Ni8mare: A Public n8n Form Exposed Host Files Through a RAG Chat and Led to a Forged Admin Session
n8n lets teams build automated workflows, including forms that add documents to a knowledge base. In a controlled test, Cyera found that an affected public form could mistake a file on the server for an upload. The researchers used the knowledge-base chat to retrieve sensitive files, then showed that an administrator session could be forged. n8n fixed the form flaw in 1.121.0.
Data ExfiltrationAuthentication BypassAI Deployment SecurityRAG SecurityAI Infrastructure
What the public form is for. n8n's Form trigger publishes a web page whose submissions start a workflow, and it can be set to require no login. A common use is document intake. Cyera's example is a company knowledge base: employees upload files through a form, the workflow indexes them for retrieval-augmented generation (RAG), and staff ask questions through a chat interface built on the same content. The form is an intentionally public entry point into a workflow that writes into an AI system.
Where the check failed. n8n picks a request parser from the content type the client declares: a multipart upload goes to a file-upload parser, other bodies to an ordinary parser. In versions 1.65.0 up to, but not including, 1.121.0, the Form trigger's file handling read file details from the request without confirming that the upload parser had produced them. A visitor who sent an ordinary body could therefore supply those details, and n8n copied a file the visitor named, one that already sat on its own host, into the workflow as if it were the upload. This is CVE-2026-21858, a public vulnerability identifier, scored CVSS 3.1 10.0 in its CVE record. Every node after the form received the host file.
How the AI workflow carried the file out. In Cyera's demonstration the knowledge-base workflow indexed the copied file like any document, and asking the chat interface about it returned its contents. Cyera used the route three times: for an operating-system file; for n8n's own database, from which the chat returned the administrator's user ID, email address and password hash; and for n8n's configuration file, from which it returned the instance's encryption key. Horizon3 points out that any public form can trigger the copy, but an attacker also needs a way to see the copied file; without an output such as this chat, it stays in workflow data that outsiders cannot view.
From file read to administrator. n8n's session cookie is a signed value built from a user's ID and a hash tied to that user's login credentials, and Cyera describes the key from the configuration file as what signing needs. With the administrator's record and that key, Cyera produced a cookie that n8n accepted and was logged in as the administrator without knowing the password. An administrator can build workflows with the Execute Command node, which runs operating-system commands on the n8n host, and Cyera did so to show command execution. n8n also encrypts the credentials it stores for integrations with this key, so anyone holding both the database and the key should be assumed able to decrypt them.
Fixes, related flaws and real-world evidence. Cyera reported the flaw on 9 November 2025 and n8n shipped 1.121.0 on 18 November; the advisory and Cyera's post followed on 7 January 2026, with no official workaround beyond restricting or disabling public form and webhook endpoints until upgrading. Rapid7 grouped Ni8mare with four other n8n flaws from the same period, all of which need a logged-in user. One of them, CVE-2025-68613, is the expression flaw that a public third-party proof of concept uses in place of the Execute Command step, and 1.121.0 itself is still listed as affected by it. Another, N8scape (CVE-2025-68668), is a sandbox bypass in the Python Code node fixed only in 2.0.0. CISA's assessment of 8 January 2026 recorded no exploitation. The one reported real-world use is a May 2026 attempt in which a threat actor's AI agent ran that public proof of concept against exposed n8n servers; Palo Alto Networks Unit 42 reports that it failed because the forms it found required a login. Cyera estimated about 100,000 affected servers; Horizon3 counted roughly 70,000 n8n instances on Shodan, of which 76 exposed the chat component.
Deployed AI Software Vulnerability Remediation Lifecycle
Very High
Version 1.121.0 fixes the form's file handling, which closes the first two steps of this chain: the parsing mismatch and the copy of a host file. Upgrade every instance and every n8n process type, and prefer a current supported release over exactly 1.121.0, which is still listed as affected by CVE-2025-68613 and lacks the fixes in 1.121.3 and 2.0.0. Confirm by reading the running version back from each instance, not from the deployment file. The upgrade does not invalidate a key, password hash or session copied before it. When an instance cannot be upgraded yet, n8n's advisory names the temporary measure: restrict or disable publicly reachable form and webhook endpoints. Deactivate the public form workflows or block the form path at the reverse proxy, record an owner and an end date, and keep the vulnerability open until the upgrade is verified. Anyone still allowed to reach a form can exploit it.
Require authentication both to submit documents and to query the knowledge base. Use the authentication option available in each deployed node version. Older Form Trigger versions support Basic Auth with a shared password. Newer versions can also require n8n user login. Where supported, require permission to run the workflow. A signed-in user may still exploit an unpatched form.
A forged administrator cookie is only useful against the n8n editor and REST API. If the reverse proxy publishes only the form path to the Internet and the editor and API are reachable only from the administrators' network, an outside attacker holding the cookie has nowhere to present it. Hosts on the administrator network, and an attacker who reaches one, can still use it.
Requiring the organization's identity provider, with MFA, at a proxy in front of the editor and REST API adds a login the forged cookie cannot satisfy: n8n issues its own cookie after its own login, while the proxy checks a separate session on every request. In this chain that stops an outsider who has only the forged n8n cookie. A user who already passes the identity provider, such as an employee, can still present a forged administrator cookie behind it.
Once the database and the key have been read, every secret they protect is exposed: user password hashes, and every integration credential n8n encrypts with that key, which a holder of both should be assumed able to decrypt. If a vulnerable instance had a public form, replace those credentials at the services that issued them and revoke the old values, and reset user passwords. n8n cannot change the encryption key on an existing database; its documentation says a compromised key means moving the workflows and credentials to a new instance and database with a new key, so enter the new credential values there. Prove each old value is refused. Rotation does not end sessions already issued; that is a separate step.
A forged cookie stays valid until n8n stops trusting what it was signed with. Set a new session signing secret through n8n's configuration so that every cookie signed before the change is refused, then present a cookie saved from before the change to confirm it fails. This ends sessions already in use, legitimate ones included; it does not remove workflows or credentials an attacker created while logged in.
After patching, check which host files are still indexed by the knowledge base. Preserve evidence in restricted storage and remove those entries from retrieval. Confirm in the live search index that the copies are excluded and that the chat no longer returns them. Treat any credentials already exposed as a separate incident response.
Cyera's route read n8n's database and the configuration file that holds N8N_ENCRYPTION_KEY, and the forged administrator session could create and change workflows. n8n's documentation says that key cannot be changed on an existing database, so an instance whose key was read is recovered by moving to a new database and instance with a new key. Run that recovery in a fixed order and stop if any step fails its check: revoke and rotate the upstream credentials first, build the new instance from a patched image with a newly generated key, import only workflows that passed review, enter the new credential values, recreate users, and only then switch traffic and retire the old instance, database, backups and key. The result is an instance whose key and secrets the attacker never saw. Users, execution history and settings do not move in n8n's export and must be rebuilt, and the order only helps if each step is actually verified.
What Defenders Should Do Now
Find every n8n instance and upgrade. Read the running version from each instance and every n8n process, including containers. Anything from 1.65.0 up to, but not including, 1.121.0 is exposed to Ni8mare. Move it to a current supported release rather than exactly 1.121.0, which is still affected by CVE-2025-68613 and predates the fixes in 1.121.3 and 2.0.0. If the upgrade has to wait, deactivate public form workflows or block the form path at the reverse proxy, with an owner and an end date for the exception.
Require a login on forms and chats that start AI workflows. List every active workflow that starts from a Form trigger or a Chat trigger and check its authentication setting. Triggers that write to or read from an internal knowledge base should use n8n user login (for chats, together with the execute-permission check) or at least Basic Auth. From a browser with no n8n session, open each one and confirm it asks for credentials.
Keep the editor and API off the networks the public form faces. Publish only the form path through the reverse proxy, and require the organization's identity-provider login with MFA before any request reaches the n8n editor or REST API. From outside the administrator network, request the editor and an API route with a valid n8n cookie but no identity-provider session, and confirm the proxy refuses both.
If a vulnerable instance had a public form, treat its secrets as taken. Set a new session signing secret so existing cookies stop working, reset user passwords, replace and revoke every credential stored in n8n at the service that issued it, and, because n8n cannot change the encryption key on an existing database, move the workflows and credentials to a new instance and database with a new key. Confirm that a cookie from before the change and each old credential are refused.
Clean the knowledge base. Search the vector store behind any form-fed knowledge base for entries that are really host files, n8n's database or its configuration file. Preserve them as evidence, remove them from retrieval and block them from being indexed again, then ask the chat for that content and confirm nothing comes back.
1 additional consideration
Keep n8n's user records and keys out of the files one read can reach
In Cyera's demonstration a single file-read route returned both the user table and the key that session signing needs, because a default local deployment keeps n8n's database and its settings file in the same data folder on the host.
Recommendation: The platform team can run n8n against an external database server that is not reachable from outside, and supply the encryption key and the session signing secret through environment variables or a secrets manager instead of letting n8n generate and keep them in its local settings file. Afterwards, confirm that the data folder no longer contains the user database or the key. This narrows what one file read can return; the n8n process still has to read these values, so it complements rather than replaces the upgrade and credential rotation.
Conclusion
Updating n8n stops new copies of host files from entering through the form. AIDEFEND ↗ also points to requiring authentication at the form and chat, limiting access to the editor, and removing any copies already indexed. If the exposed files included credentials, revoke them and verify that old sessions no longer work.