Server-Side Prototype Pollution
Prototype pollution in a Node.js process. A request body, query string or parsed document writes to the server’s shared
Object.prototype, and that state persists across every later request until the process restarts.
How it works
-
Sources. Express
express.json()/body-parser,qs-style query parsing, cookies, upload metadata, GraphQL variables and WebSocket messages (InfoSec Write-ups). Less obvious sources include XML bodies (xml2js), upstream GraphQL incremental responses, and protobuf schemas. -
Sinks.
Object.assign(user, req.body)_.merge(defaultConfig, userConfig)- lodash
defaultsDeep(CVE-2019-10744) flat- ad-hoc
obj[userKey] ??= {}; obj[userKey][k] = v
Sources for this list: InfoSec Write-ups, JFrog, Koeck.
-
Why it is worse than client side. One process serves every user. A single request poisons all later objects, so impact runs from logic bypass (
isAdmin) to denial of service to RCE (Tib3rius). The same persistence makes careless testing destructive.
Techniques / payloads
Payload-shape matrix for JSON bodies (InfoSec Write-ups):
{"__proto__":{"polluted":"yes"}}
{"constructor":{"prototype":{"polluted":"yes"}}}
{"a":{"__proto__":{"polluted":"yes"}}}
{"__proto__.polluted":"yes"}Confirm the pollution through a side channel: the inherited key appears in an unrelated JSON response, or an authorization decision changes.
Parser-specific primitives
-
xml2js (n8n CVE-2026-42231). A top-level
<__proto__>is blocked (CVE-2023-0842), but a nested<test><__proto__/></test>returns{ test: { ['__proto__']: [ [Object: null prototype] {}, '' ] } }. This is a live reference to the prototype, which later workflow steps can write through.- Root cause: CoffeeScript
key not of objcompiles to!(key in obj), andinwalks the prototype chain. - Constraint: injected values arrive wrapped in arrays.
(dexpose)
- Root cause: CoffeeScript
-
graphql-tools
mergeIncrementalResult(CVE-2026-114604, versions 10.10.1–12.0.2).setObjectKeyPathblocks'__proto__'/'constructor'/'prototype'with===. A path segment["__proto__"]is an array, so it passes the check, thencurrent[key]coerces it to"__proto__".- Attacker position: a malicious, compromised or MITM’d upstream sending
@defer/@streamparts to a gateway. - Fixed in 12.0.2.
-
React Flight (React2Shell, CVE-2025-55182). The decoder resolves
$id:prop:propreferences with attacker-supplied property names and no own-property check. Paths such as__proto__:thenandconstructor:constructortherefore reachPromisemachinery and theFunctionconstructor through a fake Chunk object (Seqrite, OffSec). Also see Insecure Deserialization. -
Workflow and integration nodes. n8n GSuiteAdmin used a user
schemaNameas a plain-object key, so"__proto__"makes the??=a no-op and the next assignment writesObject.prototype[fieldName]. Koeck found the bug by greppingnodes-basefor missing__proto__/constructor/prototypechecks, which is a reusable source-review technique (Koeck).
Black-box gadget fingerprinting. Setting Object.prototype.pendingContent to a marker string makes it appear in Handlebars output, which confirms both the pollution and the engine (po6ix). For escalation see Prototype Pollution Gadgets.
Tooling.
- Server-Side Prototype Pollution Scanner (hackvertor), a Burp extension for Burp ≥2021.9 (awesome-burp-extensions)
- Prototype Pollution Gadgets Finder BApp (BApp Store)
- The “Server Side Prototype Pollution” BCheck (BChecks)
Testing hygiene. Pollution in n8n crashed the instance after each workflow run, because the stats update touched the polluted object. TypeORM’s for...in in buildWhere threw on every query until restart. Use unique, harmless key names, and reset keys to undefined where the app lets you (dexpose, Koeck).
Notable cases
- n8n CVE-2026-33696 (9.4). An editor-level user goes from GSuiteAdmin pollution to
GIT_SSH_COMMANDto RCE as the n8n user. That user holds the credential encryption key. Fixed in 2.14.1, 2.13.3 and 1.123.27 (Koeck, THN). - n8n CVE-2026-42231. An xml2js webhook body leads to unauthenticated RCE (dexpose).
- React2Shell. Affects React 19.0.0–19.2.0 and Next.js 16.0.0–16.0.6, giving unauthenticated RCE. Exploitation was seen from 5 Dec 2025 on Windows and Linux, and most follow-on payloads were coin miners (Microsoft, Resecurity).
- graphql-tools CVE-2026-114604 (CVSS 8.4) (CVE Brief).
Defenses
- Use
Object.create(null)orMapfor user-keyed containers. Reject__proto__/constructor/prototypeafter checking that the key is a primitive. Route all merges through one guardeddeepMerge, since n8n had one and a node bypassed it (Koeck, GitLab advisory). - Use own-property lookups (
Object.hasOwn) wherever a decoder resolves property names it received from the wire (Seqrite). - Treat upstream GraphQL responses, XML and schemas as untrusted input (CVE Brief).
- Patch the source libraries and remove gadgets, which is defense in depth (JFrog).
Related
- Prototype Pollution (main guide)
- Client-Side Prototype Pollution · Prototype Pollution Gadgets
- Remote Code Execution · Insecure Deserialization · Mass Assignment · GraphQL Security · Server-Side Parameter Pollution
Sources
- JavaScript Prototype Pollution Deep Dive: Reconnaissance, Exploitation & Bug Bounty Guideline · original
- Where Severity Scores Go Wrong: "Just Add Prototype Pollution" · original
- CVE-2026-33696: From a Schema Name to RCE in n8n · original
- n8n: From Parsing Bug to Remote Code Execution aka CVE-2026-42231 · original
- ThreatsDay: Gogs 10.0 RCE, n8n Workflow-to-RCE, and More · original
- Web AppSec Interview Questions · original
- GraphQL Tools prototype pollution advisory · original
- CVE-2026-114604: GraphQL Tools prototype pollution · original
- GraphQL Tools utils prototype pollution in incremental result merge (CVE-2026-114604) · original
- graphql-tools prototype pollution in mergeIncrementalResult (CVE-2026-114604) · original
- React2Shell (CVE-2025-55182): RSC Flight Decoder Remote Code Execution · original
- CVE-2025-55182: React Server Components RCE via Flight Payload Deserialization · original
- Defending Against React2Shell in React Server Components · original
- React2Shell Explained: From Vulnerability Discovery to Exploitation · original
- AST Injection: Prototype Pollution to RCE in Handlebars · original
- snoopysecurity/awesome-burp-extensions · original
- BApp Store - PortSwigger · original
- PortSwigger/BChecks · original