-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 NEFARIOUSPLAN-CANONICAL-V1 {"body_md":"> Three handlers had been reading `req.body.files` for years on the same assumption. The patch is the assumption written down, three times, one per handler.\n\nThat is from [CVE-2026-21858: n8n's req.body.files Was Formidable's Output. The JSON Parser Used the Same Name.](/posts/n8n-cve-2026-21858-req-body-files-was-formidables-name). Read it as a file by itself and it is a webhook bug. Read it after the other three n8n files and it is a habit.\n\nThat is the shape in all four files. The fix that would have closed the class lives one level up, in a helper, a dispatcher, a parser config, a middleware. The fix that shipped lives at the handler. Every handler has to be told the rule one at a time. Every new handler is a new place the rule could go missing.\n\n## The helper was already in the repository\n\n[CVE-2026-21877: The Helper That Stops This Bug Was Already in n8n](/posts/n8n-git-cve-2026-21877-helper-was-already-there):\n\n> The Git node was the one node that bypassed it.\n\n`isFilePathBlocked` was in `packages/core/src/execution-engine/node-execution-context/utils/file-system-helper-functions.ts` before the CVE existed. It wrapped `createReadStream`. It wrapped `writeContentToFile`. Every node that reached the filesystem through `this.helpers.createReadStream` or `this.helpers.writeContentToFile` got the check for free, because the helper did not expose a bypass. Read Binary File called the helpers. Write Binary File called the helpers. Read/Write Files From Disk called the helpers. The Git node called `simpleGit({ baseDir: repositoryPath })` and did not.\n\nThe patch is one `if` statement, eight lines, at one call site. The helper did not move. The patch did not move the helper. The author of the Git node was handed a toolbox where every tool had a safety on it, used a different tool, and shipped. The toolbox is still there. The next file-writing node someone adds will be a tool chosen, or not chosen, from the same drawer.\n\nA patch that could have been a one-line edit at the helper interface, requiring every node that wants filesystem access to go through it, is instead a one-line edit at the consumer. Multiply by every node in `nodes-base` that touches disk.\n\n## The assertion is written down three times\n\nThe Form Trigger handler reads `context.getBodyData().files`, assumes Formidable wrote it, iterates each entry, and calls `copyBinaryFile` on each `filepath`. Shipping an `application/json` body with a crafted `files` key reaches the same code path, because Express dispatches to the handler on URL, not on content type.\n\nThe patch adds `import * as a from 'node:assert'` and one line: `a.ok(req.contentType === 'multipart/form-data', 'Expected multipart/form-data')`. It adds the same line in `Form/utils/utils.ts`. It adds the same line in `ChatTrigger.node.ts`. It adds the same line in `Webhook.node.ts`. Three files. Three identical assertions.\n\n`getBodyData()` is a framework method that returns whatever parser wrote, with no record of which parser ran. That is the chokepoint. A single assertion inside `getBodyData()`, or a two-method API where the caller asks for the multipart parser's output by name, closes the bug for every present and future handler. The patch does not do that. It teaches three handlers to say the same sentence. The next handler to call `getBodyData()` will be the fourth place the sentence is missing. Cannot be prevented upstream is the maintainer's choice, not the framework's constraint.\n\n## The library made its fix. n8n made it again.\n\n[CVE-2026-42231: xml2js Used defineProperty So __proto__ Wouldn't Mutate. The Property It Wrote Is The Pollution.](/posts/n8n-xml2js-defineproperty-was-the-fix):\n\n> The fix sits at every consumer. The library has not moved.\n\nxml2js had already been patched for prototype pollution. Direct assignment of `obj['__proto__']` invokes the inherited setter and mutates the prototype chain. The library stopped doing direct assignment and switched to `Object.defineProperty`, which bypasses the setter and writes an own data property. The parse-time pollution route closed.\n\nThe property the library writes is still called `__proto__`. `JSON.stringify` walks own enumerable keys, so it serializes the property. `JSON.parse` recreates it on reload. `Object.assign` reads via `[[Get]]` and writes via `[[Set]]`, and `[[Set]]` on the key `__proto__` is the inherited setter. The pollution happens three function calls after xml2js is done. No step along the way is wrong on its own.\n\nxml2js's issue #721, filed March 2026, is still open. n8n's patch does not change xml2js. It adds `tagNameProcessors` and `attrNameProcessors` to the parser config in `packages/cli/src/middlewares/body-parser.ts` that rewrite `__proto__`, `constructor`, and `prototype` before `assignOrPush` runs. Any other consumer of xml2js that reads network XML will have to ship the same six-line function in its own body parser. The library will still produce the smuggled property.\n\nIn the first two files, the chokepoint was inside n8n and n8n chose the handler over the helper. Here the chokepoint is outside n8n. The vendor cannot patch xml2js from this repository. But the shape, that the fix lives in the consumer rather than the primitive, is the shape the vendor has been shipping to itself.\n\n## The existence check is the function name\n\n[CVE-2026-42228: n8n's Chat WebSocket Treated Existence As Authorization](/posts/n8n-chat-existence-was-the-gate):\n\n> The next chat-shaped endpoint n8n ships will land on the same surface, with the same need for the same kind of token, and whoever writes that endpoint will have to remember.\n\nThe handler called `checkIfExecutionExists(executionId)`. The function name is what the function does. It returned a boolean. The caller treated the boolean as authorization. There was no other authorization in the code path, and the function it called did not load the data field where a credential could have been stored.\n\nA function named `checkIfExecutionExists` returning a boolean that gates access to a public endpoint is not a slip. It is a fucking policy. The code says what it does. The architect read what it does. The code shipped. Five independent reporters filed it. The handler is fifteen lines, and the bug is in the function name.\n\nThe patch adds a `token` URL parameter and compares it with `timingSafeEqual`. It switches the lookup from `checkIfExecutionExists` to `findExecution`, because the old lookup did not retrieve the data field the new credential has to live in. It collapses missing-execution and bad-token into one generic reply, closing the oracle the scanner was walking. The CVE record names one of these fixes. The patch ships two.\n\nBoth fixes are at the handler. The upgrade path that registers the WebSocket is in `chat-server.ts`, outside Express's middleware pipeline. That is the layer where a per-connection authorization decision would live if one existed. There is not one. The next WebSocket upgrade n8n registers starts with the same blank page.\n\n## Where the charge does not reach\n\nn8n gets several things right, and they are in the files.\n\nThe Git node's threat model for `git` is precise. `safe.bareRepository=explicit` closes an attack on bare-repository semantics. `core.hooksPath=/dev/null` disables repository hooks. `GIT_TERMINAL_PROMPT=0` closes the credential-prompt hang. Someone sat down and asked what `git` the binary can be made to do, and they answered. They did not ask what `git` the write primitive can be made to do, but the work inside git's own threat model was serious.\n\nFormidable's contract is real. Multipart parsing does write `/tmp/` paths. The handler built on that contract was correct under its intended content type. The failure is that Express dispatches on URL and the framework method did not label which parser wrote the body. `getBodyData()` is a framework method, not a bug.\n\nxml2js's `defineProperty` is correct. It closes the parse-time pollution route the library had. The downstream chain travels through spec-correct behavior at `JSON.stringify`, `JSON.parse`, and `Object.assign`. No single owner has the intersection, and asking n8n to own it alone is not fair.\n\nThe Chat endpoint's exemption from user auth is intentional. `isPublic=true` workflows are a product feature. Public WebSockets are a product feature. The vendor did not forget to authenticate the user. The vendor made a design decision that user auth is the wrong gate for this endpoint. That design decision is not the bug. The bug is that no other gate was installed in its place.\n\nFour files, four bugs, and in each of them n8n wrote at least one thing most vendors of this kind of product do not write. The charge is not that n8n is careless. The charge is that n8n puts the careful work inside the handler and then writes the handler one at a time.\n\n## Where to look for the next one\n\nThe four patches tell you where to open the repository.\n\nAny file in `packages/nodes-base` whose node writes to a user-supplied path and whose handler calls a filesystem primitive directly, rather than going through `this.helpers.createReadStream`, `this.helpers.writeContentToFile`, or now `this.helpers.isFilePathBlocked`. The helper interface was extended in CVE-2026-21877. The nodes extended before it are the audit list.\n\nAny handler that calls `context.getBodyData()` or reads `req.body` without `a.ok(req.contentType === ...)` in the first few lines. Three handlers got the assertion. Any other handler in `nodes-base` or `cli` that reads body data as if it came from a specific parser is a fourth.\n\nAny body parser registered in `packages/cli/src/middlewares` that sits in front of serialization. XML has `tagNameProcessors` now. YAML, CSV, form-url-encoded, and any custom parser do not have the same denylist written into n8n's config. The chain the xml2js file documents, own-property to `JSON.stringify` to `JSON.parse` to `Object.assign`, is reachable from any parser that produces own `__proto__` keys and any execution-data store that round-trips through JSON.\n\nAny WebSocket upgrade handler. `chat-server.ts` registers one directly on `HttpServer.on('upgrade')`. Any new real-time endpoint n8n adds lands outside Express's middleware pipeline the same way. The questions to ask the handler are: what is the URL-supplied identifier, is it enumerable, and is the only check against it a lookup that returns a boolean.\n\n## The prediction\n\nThe next n8n security advisory ranked HIGH or CRITICAL will patch one of these three shapes.\n\nA node in `packages/nodes-base` that writes to a user-supplied filesystem path and does not call `isFilePathBlocked`. The patch will add the same `if` statement the Git node now has, in a new file, authored by someone who did not read CVE-2026-21877.\n\nA handler in `packages/nodes-base` or `packages/cli` that reads `getBodyData()` or `req.body` and does not assert `req.contentType === 'multipart/form-data'` or an equivalent. The patch will add a fourth copy of the assertion CVE-2026-21858 added three copies of.\n\nA public endpoint whose only authorization is a lookup returning a boolean. The patch will add a token to the URL and a check inside the handler.\n\nAny of the three will count. The vendor will fix it at the handler. The chokepoint will not move.","closing_line":"You built the helper. You already know where it belongs. Install it on the door, not on the invitation.","hook_md":"Four n8n CVEs in a year. Every patch adds a check at the handler where the bug landed. The chokepoint that would have closed the class sits one layer above the handler in all four files, and n8n has not moved toward it once.","post_id":864,"slug":"the-nefarious-plan-of-n8n","title":"The Nefarious Plan of n8n","type":"editorial","unreadable_sentence":"It is a fucking policy."} -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQRf0htP5+SjynlxywneZjl4jgkQJgUCavqM+gAKCRDeZjl4jgkQ Jl8hAQDXaZbzErXPiJMeQhspb7tpZmEELWkyh29iNrFR7P0xQAD/aD9wBi5gOWbB LHJST4SUdGu8VfRyd2hd74vaIZAAvwk= =mXmk -----END PGP SIGNATURE-----