# 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 ([[raw/infosecwriteups.com/javascript-prototype-pollution-deep-dive-reconnaissance-exploitation-b-8657|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: [[raw/infosecwriteups.com/javascript-prototype-pollution-deep-dive-reconnaissance-exploitation-b-8657|InfoSec Write-ups]], [[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035|JFrog]], [[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422|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 ([[raw/tib3rius.com/web-appsec-interview-questions-5906|Tib3rius]]). The same persistence makes careless testing destructive.
## Techniques / payloads
**Payload-shape matrix** for JSON bodies ([[raw/infosecwriteups.com/javascript-prototype-pollution-deep-dive-reconnaissance-exploitation-b-8657|InfoSec Write-ups]]):
```json
{"__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 obj` compiles to `!(key in obj)`, and `in` walks the prototype chain.
- Constraint: injected values arrive wrapped in arrays.
([[raw/dexpose.io/n8n-from-parsing-bug-to-remote-code-execution-aka-cve-2026-42231-7582|dexpose]])
- **graphql-tools `mergeIncrementalResult`** (CVE-2026-114604, versions 10.10.1–12.0.2).
- `setObjectKeyPath` blocks `'__proto__'`/`'constructor'`/`'prototype'` with `===`. A path segment `["__proto__"]` is an array, so it passes the check, then `current[key]` coerces it to `"__proto__"`.
- Attacker position: a malicious, compromised or MITM'd upstream sending `@defer`/`@stream` parts to a gateway.
- Fixed in 12.0.2.
([[raw/advisories.gitlab.com/graphql-tools-prototype-pollution-advisory-13387|GitLab advisory]], [[raw/miggo.io/cve-2026-114604-graphql-tools-prototype-pollution-15486|Miggo]], [[raw/secopssignal.com/graphql-tools-utils-prototype-pollution-in-incremental-result-merge-cv-14353|SecOps Signal]])
- **React Flight (React2Shell, CVE-2025-55182).** The decoder resolves `$id:prop:prop` references with attacker-supplied property names and no own-property check. Paths such as `__proto__:then` and `constructor:constructor` therefore reach `Promise` machinery and the `Function` constructor through a fake Chunk object ([[raw/seqrite.com/react2shell-cve-2025-55182-rsc-flight-decoder-remote-code-execution-4839|Seqrite]], [[raw/offsec.com/cve-2025-55182-react-server-components-rce-via-flight-payload-deserial-3546|OffSec]]). Also see [[Insecure Deserialization]].
- **Workflow and integration nodes.** n8n GSuiteAdmin used a user `schemaName` as a plain-object key, so `"__proto__"` makes the `??=` a no-op and the next assignment writes `Object.prototype[fieldName]`. Koeck found the bug by grepping `nodes-base` for missing `__proto__`/`constructor`/`prototype` checks, which is a reusable source-review technique ([[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422|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 ([[raw/po6ix.github.io/ast-injection-prototype-pollution-to-rce-in-handlebars-4131|po6ix]]). For escalation see [[Prototype Pollution Gadgets]].
**Tooling.**
- Server-Side Prototype Pollution Scanner (hackvertor), a Burp extension for Burp ≥2021.9 ([[raw/github.com/snoopysecurity-awesome-burp-extensions-a-curated-list-of-amazingly-awe-892|awesome-burp-extensions]])
- Prototype Pollution Gadgets Finder BApp ([[raw/portswigger.net/bapp-store-portswigger-2862|BApp Store]])
- The "Server Side Prototype Pollution" BCheck ([[raw/github.com/portswigger-bchecks-bchecks-collection-for-burp-suite-professional-5576|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 ([[raw/dexpose.io/n8n-from-parsing-bug-to-remote-code-execution-aka-cve-2026-42231-7582|dexpose]], [[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422|Koeck]]).
## Notable cases
- **n8n CVE-2026-33696 (9.4).** An editor-level user goes from GSuiteAdmin pollution to `GIT_SSH_COMMAND` to RCE as the n8n user. That user holds the credential encryption key. Fixed in 2.14.1, 2.13.3 and 1.123.27 ([[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422|Koeck]], [[raw/thehackernews.com/threatsday-gogs-10-0-rce-n8n-workflow-to-rce-10m-reward-glm-5-3-ai-exp-11592|THN]]).
- **n8n CVE-2026-42231.** An xml2js webhook body leads to unauthenticated RCE ([[raw/dexpose.io/n8n-from-parsing-bug-to-remote-code-execution-aka-cve-2026-42231-7582|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 ([[raw/microsoft.com/defending-against-react2shell-in-react-server-components-3551|Microsoft]], [[raw/resecurity.com/react2shell-explained-from-vulnerability-discovery-to-exploitation-3458|Resecurity]]).
- **graphql-tools CVE-2026-114604 (CVSS 8.4)** ([[raw/cvebrief.com/graphql-tools-prototype-pollution-in-mergeincrementalresult-cve-2026-1-13386|CVE Brief]]).
## Defenses
- Use `Object.create(null)` or `Map` for user-keyed containers. Reject `__proto__`/`constructor`/`prototype` **after** checking that the key is a primitive. Route all merges through one guarded `deepMerge`, since n8n had one and a node bypassed it ([[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422|Koeck]], [[raw/advisories.gitlab.com/graphql-tools-prototype-pollution-advisory-13387|GitLab advisory]]).
- Use own-property lookups (`Object.hasOwn`) wherever a decoder resolves property names it received from the wire ([[raw/seqrite.com/react2shell-cve-2025-55182-rsc-flight-decoder-remote-code-execution-4839|Seqrite]]).
- Treat upstream GraphQL responses, XML and schemas as untrusted input ([[raw/cvebrief.com/graphql-tools-prototype-pollution-in-mergeincrementalresult-cve-2026-1-13386|CVE Brief]]).
- Patch the source libraries and remove gadgets, which is defense in depth ([[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035|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
- [[raw/infosecwriteups.com/javascript-prototype-pollution-deep-dive-reconnaissance-exploitation-b-8657|JavaScript Prototype Pollution Deep Dive: Reconnaissance, Exploitation & Bug Bounty Guideline]]
- [[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035|Where Severity Scores Go Wrong: "Just Add Prototype Pollution"]]
- [[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422|CVE-2026-33696: From a Schema Name to RCE in n8n]]
- [[raw/dexpose.io/n8n-from-parsing-bug-to-remote-code-execution-aka-cve-2026-42231-7582|n8n: From Parsing Bug to Remote Code Execution aka CVE-2026-42231]]
- [[raw/thehackernews.com/threatsday-gogs-10-0-rce-n8n-workflow-to-rce-10m-reward-glm-5-3-ai-exp-11592|ThreatsDay: Gogs 10.0 RCE, n8n Workflow-to-RCE, and More]]
- [[raw/tib3rius.com/web-appsec-interview-questions-5906|Web AppSec Interview Questions]]
- [[raw/advisories.gitlab.com/graphql-tools-prototype-pollution-advisory-13387|GraphQL Tools prototype pollution advisory]]
- [[raw/miggo.io/cve-2026-114604-graphql-tools-prototype-pollution-15486|CVE-2026-114604: GraphQL Tools prototype pollution]]
- [[raw/secopssignal.com/graphql-tools-utils-prototype-pollution-in-incremental-result-merge-cv-14353|GraphQL Tools utils prototype pollution in incremental result merge (CVE-2026-114604)]]
- [[raw/cvebrief.com/graphql-tools-prototype-pollution-in-mergeincrementalresult-cve-2026-1-13386|graphql-tools prototype pollution in mergeIncrementalResult (CVE-2026-114604)]]
- [[raw/seqrite.com/react2shell-cve-2025-55182-rsc-flight-decoder-remote-code-execution-4839|React2Shell (CVE-2025-55182): RSC Flight Decoder Remote Code Execution]]
- [[raw/offsec.com/cve-2025-55182-react-server-components-rce-via-flight-payload-deserial-3546|CVE-2025-55182: React Server Components RCE via Flight Payload Deserialization]]
- [[raw/microsoft.com/defending-against-react2shell-in-react-server-components-3551|Defending Against React2Shell in React Server Components]]
- [[raw/resecurity.com/react2shell-explained-from-vulnerability-discovery-to-exploitation-3458|React2Shell Explained: From Vulnerability Discovery to Exploitation]]
- [[raw/po6ix.github.io/ast-injection-prototype-pollution-to-rce-in-handlebars-4131|AST Injection: Prototype Pollution to RCE in Handlebars]]
- [[raw/github.com/snoopysecurity-awesome-burp-extensions-a-curated-list-of-amazingly-awe-892|snoopysecurity/awesome-burp-extensions]]
- [[raw/portswigger.net/bapp-store-portswigger-2862|BApp Store - PortSwigger]]
- [[raw/github.com/portswigger-bchecks-bchecks-collection-for-burp-suite-professional-5576|PortSwigger/BChecks]]