N8n Type Confusion Rce
A gap in n8n's AST-based expression sanitizer allowed a user who could create or modify workflows to run arbitrary system commands on the n8n host. The flaw bypassed earlier hardening and was fixed in versions 1.123.17 and 2.5.2.
hetmehta.com
Published on hetmehta.com
If you’ve been following the automation space, you know n8n: the open-source workflow automation tool that many teams self-host as an alternative to Zapier. Flexible, extensible, and it usually holds a lot of credentials.
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 expression sanitizer skipped its blocklist check for destructured keys it could not resolve to a plain string, such as computed keys built from template literals.
Impact
An authenticated user with workflow edit permission could run arbitrary commands on the n8n host, potentially reading stored credentials and pivoting to internal systems.
What the attacker needed
Authenticated user; permission to create or modify workflows
The fix
The issue was fixed in n8n versions 1.123.17 and 2.5.2.
How it was found
- Create or modify a workflow in n8n.
- Insert an expression that uses a computed destructuring key to access Object's constructor.
- Use the resulting Function constructor to build and run a command string at runtime.
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 lets people build automations by writing small expressions. Those expressions are supposed to be safely evaluated, but a mistake in the safety checker let a user break out and run commands on the server. This matters because the server often holds many passwords and keys.
What is RCE?
Running the attacker's code on the target's servers: through command or code injection, unsafe deserialisation or template injection.