Prototype Pollution
An attacker-controlled key such as
__proto__orconstructor.prototypereaches a property write on a plain object, so the value lands onObject.prototypeand is inherited by every object in the JavaScript runtime (CWE-1321).
What it is
Every JS object resolves missing properties by walking its [[Prototype]] chain to Object.prototype. If user input controls a key path in a recursive merge, clone, path-setter or parser, a write to obj["__proto__"][k] = v becomes Object.prototype[k] = v, and ({}).k === v from then on (InfoSec Write-ups deep dive, JFrog).
The broken trust boundary is between data keys and the object model. The parser treats "__proto__" as an ordinary string key (JSON.parse does not special-case it), but the assignment target does special-case it. The bug is in the sink that copies the key, not in the parser.
Pollution is a primer, not an impact. It only matters when a gadget later reads an unset property, gets the inherited value, and passes it to something dangerous. The gadget can be the app’s own code, a library, or the runtime (InfoSec Write-ups, JFrog). Tib3rius’s interview canon gives the split: client side usually leads to DOM XSS, and server side (Node.js) leads to access-control bypass or RCE (Tib3rius).
Why it matters
Impact ladder, from weakest to strongest:
| Level | What the gadget does | Example from the notes |
|---|---|---|
| DoS | Inherited keys break iteration or validation everywhere | n8n: TypeORM buildWhere picks up the polluted key through for...in and throws on every query. The instance stays down until restart ([[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422 |
| Logic / authz bypass | isAdmin, role and similar checks read an inherited true | {"__proto__":{"isAdmin":true}} via Object.assign/_.merge ([[raw/infosecwriteups.com/javascript-prototype-pollution-deep-dive-reconnaissance-exploitation-b-8657 |
| DOM XSS | A library reads an unset config key into an HTML/script sink | Client-side URL-fragment or query sources ([[raw/portswigger.net/dom-invader-2577 |
| SSRF / MitM | The HTTP client inherits proxy or headers | Axios proxy gadget (CVE-2026-44494) and the Axios header-CRLF gadget that reaches IMDSv2 ([[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035 |
| RCE | Inherited keys reach spawn env/options, a template compiler, or Function() codegen | n8n GIT_SSH_COMMAND, Handlebars/Pug AST injection, protobuf.js CVE-2026-44291 |
What drives severity is whether both halves exist in the same process. JFrog reassessed the ten 2026 Axios “gadget” CVEs, which GitHub/NVD rated from low to critical. Each one is exploitable only if pollution already exists elsewhere in the runtime, so JFrog rates most of them low or medium. The same reasoning applied to DOMPurify CVE-2024-48910, React Router CVE-2026-42211 and Piscina CVE-2026-55388 (JFrog). Prototype pollution is no longer limited to the web: Adobe Acrobat Reader CVE-2026-34621 (CVSS 8.6) was a prototype pollution bug in Reader’s embedded JS engine and was exploited in the wild through phishing PDFs (Mishcon, THN, HKCERT). At ecosystem scale, Unit 42’s AI-driven zero-day sweep found that JS/TS findings concentrate in code injection, prototype pollution and SSRF (Unit 42).
How it works
Three ingredients:
- Source. Attacker-shaped keys: a JSON body, query string (
a[__proto__][x]=1,__proto__.x=1), URL fragment,postMessage,localStorage, WebSocket frames, GraphQL variables, XML, cookies or upload metadata (InfoSec Write-ups). - Pollution sink. Code that writes nested keys without own-property and name checks:
_.merge/defaultsDeep,$.extend,Object.assigninto a shared object,flat/unflatten,qs-style bracket parsers, path setters,obj[userKey] ??= {}. - Gadget. A read of an unset property whose inherited value reaches a sink. See Prototype Pollution Gadgets.
// pollution sink (n8n GSuiteAdmin, CVE-2026-33696, simplified)
customSchemas[schemaName] ??= {}; // schemaName = "__proto__" -> Object.prototype
customSchemas[schemaName][fieldName] = v; // Object.prototype[fieldName] = v(Koeck)
Variants:
- Client-Side Prototype Pollution. URL and
postMessagesources in the browser. Gadgets live in front-end libraries and lead to DOM XSS or sanitizer bypass. - Server-Side Prototype Pollution. Node.js body, query and parser sources. The process is long-lived, so one request poisons every later request. Gadgets lead to authz bypass, DoS, SSRF or RCE.
- Parser and deserializer pollution. Formats whose decoders resolve attacker-named properties up the chain: React Flight (React2Shell, CVE-2025-55182), xml2js, GraphQL incremental-delivery merge, protobuf.js. These are covered on the server-side page and in Insecure Deserialization.
- Prototype traversal in sandboxes. The same chain-walking breaks JS sandboxes: vm2’s 2026 escapes (CVE-2026-43999 “escape the sandbox and enable prototype pollution”), and Cohere Terrarium CVE-2026-5752 (Pyodide → host Node.js prototype traversal, root in the container) (THN vm2, THN Terrarium).
- Prototype overwrite inside expression sandboxes. AngularJS sandbox escapes overwrite
String.prototype.charAtto break the expression lexer. This is a close cousin rather than input-key pollution, so see Client-Side Prototype Pollution.
Where to find it
- Stack signals. Node/Express is the place to look for prototype pollution and SSRF (as93 recon). Fingerprint jQuery, lodash, Handlebars and similar libraries and their versions in JS bundles (InfoSec Write-ups).
- Features that merge user objects into existing ones. Settings and profile
PATCHendpoints, config import, “update preferences” endpoints, which overlap with Mass Assignment. - Generic key-to-object code. Any place a user string becomes a property name: schema names, field names, workflow node parameters (n8n), XML tag names (xml2js), GraphQL
pathsegments (graphql-tools). - Non-HTTP transports. WebSocket messages and GraphQL variables (InfoSec Write-ups), and upstream GraphQL
@defer/@streamresponses consumed by a gateway (GitLab advisory). - Schema and codegen pipelines. protobuf.js treats schemas and descriptors as trusted (THN Proto6).
- Template contexts.
{{this.__proto__}}rendering[object Object]in an email or profile template points to a Node engine and prototype access (H1 #423541, SSTI 2k25).
How to test
- Fingerprint. Is the runtime Node or a heavy front-end, and which merge, parse or template libraries are in use, at what versions?
- Map sources. Spider the app and pull endpoints from JS. Include JSON, query, cookie, WebSocket, GraphQL and XML inputs (InfoSec Write-ups).
- Try the payload-shape matrix on every object-accepting input:
Also try nesting deeper than the top level. xml2js blocked a top-level{"__proto__":{"polluted":"yes"}} {"constructor":{"prototype":{"polluted":"yes"}}} {"a":{"__proto__":{"polluted":"yes"}}} {"__proto__":{"__proto__":{"polluted":"yes"}}} ?__proto__[polluted]=yes ?__proto__.polluted=yes #__proto__[polluted]=yes<__proto__>(CVE-2023-0842), but a nested one still worked (dexpose). Try non-string key types too, such as an array segment["__proto__"]against===blocklists (GitLab advisory). - Confirm pollution without breaking things.
- Client side: check
({}).pollutedin the console, or let DOM Invader find the source. - Server side: look for an inherited key reflected in later JSON responses, or a status flip (403 → 200) (InfoSec Write-ups). Prefer non-destructive property names, because server pollution persists for the life of the process and can DoS the target (n8n/TypeORM).
- Client side: check
- Hunt a gadget. Look for library-specific canaries. For example, an
Object.prototype.pendingContentstring appearing in Handlebars output fingerprints the engine black-box (po6ix). Then trace which unset properties reach sinks. See Prototype Pollution Gadgets. - Report the chain. A gadget without a source gets discounted, so pair the source with the sink in the same process (JFrog; see Vulnerability Chaining).
Checklist
- Every JSON/query/XML/GraphQL/WebSocket object input tried with
__proto__,constructor.prototype, nested and bracket/dot forms - Array and other non-primitive key segments tried against name blocklists
- Client-side: URL query and hash,
postMessage, storage sources checked (DOM Invader / pphack) - Server-side: a reflected inherited property or a status/behavior change confirmed with a benign key
- Gadget identified in the same runtime (template engine, HTTP client,
child_process, codegen, sanitizer) - Persistence and DoS risk considered before polluting shared server keys
- Clean-up planned (re-set the key to
undefinedwhere the app allows it)
Exploitation and escalation
- To DOM XSS or sanitizer bypass. Inherited config keys flow into
innerHTMLor scriptsrcin front-end libraries. See Client-Side Prototype Pollution and DOM-Based XSS. - To authz bypass. Inherited
isAdmin/role flags. This overlaps with Mass Assignment. - To RCE through
child_process. Polluted env keys pass through objects the app allocates as{}. n8n’s Git node (simple-git.env()→spawn) inheritsGIT_SSH_COMMAND, which git runs as a shell command on SSH-style URLs (Koeck, dexpose). Node’s ownspawnno longer honors pollutedoptionsdirectly, so the gadget has to be app code that builds a plain options or env object (dexpose). - To RCE through template compilers (AST injection). Pollution inserts nodes into the Handlebars or Pug AST, and the compiler emits them into a generated function (po6ix). See JavaScript Template Engine SSTI.
- To RCE through codegen. protobuf.js resolves type names by plain property lookup, so a polluted prototype makes an attacker string look like a primitive type. The string is then compiled with
Function()(CVE-2026-44291) (THN Proto6). - To SSRF, cloud compromise or MitM. Axios inherits
proxy(traffic interception) or CRLF-bearing header values, which smuggle an IMDSv2 tokenPUT(JFrog, GHSA-fvcv-3m26-pcqx). See Cloud Metadata Service Exploitation. - Deserializer-native chains. React2Shell reaches
constructor:constructor(the Function constructor) through prototype-chain references in Flight payloads (OffSec). See Remote Code Execution.
Bypassing defenses
- Top-level-only checks. xml2js rejected a top-level
__proto__tag after CVE-2023-0842, but a nested<test><__proto__/></test>still handed back a reference toObject.prototype(dexpose). inversus own-property. xml2js’s CoffeeScriptkey not of objcompiles to!(key in obj). Theincheck walks the chain, so inherited names (__proto__,constructor) are treated as existing keys (dexpose).- Type confusion against string blocklists. graphql-tools compared segments with
=== '__proto__', but an array segment["__proto__"]passes the check and is then coerced to the key"__proto__"byToPropertyKey(CVE-2026-114604, fixed in 12.0.2). The earlierdset-based code (≤10.10.0) was not exploitable (GitLab advisory, Miggo). constructor.prototypeinstead of__proto__. Filters that block only__proto__miss it (InfoSec Write-ups).- Guards that exist but aren’t used. n8n already had a
deepMergewith pollution guards, but the GSuiteAdmin node didn’t call it (Koeck). - Constrained primitives still chain. xml2js only gave array-wrapped values, but a post-parse “Edit Fields” step could write arbitrary keys through the leaked reference (dexpose).
Real-world cases
- n8n CVE-2026-33696 (CVSS 9.4). GSuiteAdmin
schemaName="__proto__"→GIT_SSH_COMMAND→ RCE through the Git node, plus a TypeORM DoS (Koeck, THN ThreatsDay). - n8n CVE-2026-42231. xml2js nested
__proto__in a webhook body → unauthenticated RCE through a spawn-style gadget in@n8n/node-cli(dexpose). - React2Shell CVE-2025-55182. React 19.0.0–19.2.0 and Next.js 16.0.0–16.0.6. The Flight decoder resolves attacker property names without own-property checks, leading to unauthenticated RCE. Exploited from 5 Dec 2025, mostly to deploy coin miners (Seqrite, Microsoft, Resecurity).
- graphql-tools CVE-2026-114604 (8.4).
mergeIncrementalResultarray-segment bypass. A malicious upstream pollutes the gateway (CVE Brief, SecOps Signal, OpenAdvisories). - protobuf.js “Proto6”. CVE-2026-44291 (8.1) is a codegen gadget after pollution, and CVE-2026-44292 is prototype injection in generated constructors. Fixed in 7.5.6 and 8.0.2 (THN, EntryZero).
- Axios 2026 gadget wave. Ten CVEs that all need pre-existing pollution. JFrog chained lodash CVE-2019-10744 (
defaultsDeep, 4.17.11) with CVE-2026-44494 to get MitM (JFrog). - Adobe Acrobat Reader CVE-2026-34621. Prototype pollution in Reader’s JS engine through PDF form actions. Exploited in the wild (Mishcon).
- Handlebars GHSA-2cf5-4w76-r9qv (2021). Prototype pollution through crafted templates (Xygeni). The Shopify Return Magic Handlebars RCE abused
Object.prototype.toStringoverriding (mahmoudsec). - vm2 2026 escapes and Cohere Terrarium CVE-2026-5752. Prototype traversal used as a sandbox escape (THN, THN).
- jQuery CVE-2019-11358:
$.extend(true, …)deep merge did not block__proto__, so pollution plus an application gadget gave XSS. (source)
Prevention
- Block dangerous keys at every write. Reject
__proto__,constructorandprototype, and only after validating that the key is a primitive string or number (Koeck, GitLab advisory). - Use prototype-less containers for user-keyed maps.
Object.create(null)(orMap) for anything keyed by user input (Koeck). - Use own-property checks, not
inor a bareobj[key], when resolving attacker-named properties. This was the root cause in both React Flight and xml2js (Seqrite, dexpose). - Use one vetted deep-merge. Route every merge through a single guarded helper, and lint for ad-hoc
obj[a][b] = v(Koeck). - Freeze prototypes where the architecture allows it. Mozilla’s frozen-prototypes design repeatedly stopped an AI model’s prototype-pollution sandbox-escape attempts in Firefox (tl;dr sec #328).
- Harden gadgets. Validate header values for CRLF (Axios), stop treating schemas and metadata as trusted code (protobuf.js), and keep Handlebars patched against its own pollution advisory (GHSA-fvcv-3m26-pcqx, THN Proto6, Xygeni).
- Patch the source libraries. No seven-year-old lodash (4.17.11 / CVE-2019-10744), graphql-tools ≥12.0.2, protobufjs 7.5.6/8.0.2, React/Next.js past the React2Shell fix. Score gadget CVEs in context rather than at face value (JFrog).
Tools
| Tool | Use |
|---|---|
| DOM Invader (Burp browser) | Finds client-side pollution sources and scans for gadgets that reach sinks ([[raw/portswigger.net/dom-invader-2577 |
| Server-Side Prototype Pollution Scanner (hackvertor, Burp ≥2021.9) | Non-destructive server-side detection ([[raw/github.com/snoopysecurity-awesome-burp-extensions-a-curated-list-of-amazingly-awe-892 |
| Prototype Pollution Gadgets Finder (BApp) | Server-side gadget analysis ([[raw/portswigger.net/bapp-store-portswigger-2862 |
| BChecks “Server Side Prototype Pollution” | Scanner check for Burp Pro ([[raw/github.com/portswigger-bchecks-bchecks-collection-for-burp-suite-professional-5576 |
| pphack | Client-side prototype pollution scanner ([[raw/github.com/ars0n-framework-v2-bug-bounty-hunting-framework-4866 |
page-fetch one-liner | Mass client-side check: append ?__proto__[testparam]=exploit and evaluate window.testparam ([[raw/github.com/0xpugazh-one-liners-1013 |
| SAST / LLM review | Prototype pollution is among the classes LLM reviewers find reliably (Snyk VulnBench JS), but SAST hits inside vendored libraries are mostly false positives without context ([[raw/snyk.io/snyk-vulnbench-js-1-0-can-llms-find-the-same-bugs-twice-9972 |
Sub-pages
- Client-Side Prototype Pollution: browser sources (URL,
postMessage), front-end gadgets, DOM XSS, andEvent.prototype-style tricks. - Server-Side Prototype Pollution: Node.js merge and parser sinks, safe detection, the n8n, React2Shell and graphql-tools cases.
- Prototype Pollution Gadgets: what turns pollution into impact, including template AST injection,
child_processenv, Axios, protobuf.js codegen, and severity scoring.
Related: Remote Code Execution · DOM-Based XSS · Cross-Site Scripting · JavaScript Template Engine SSTI · Server-Side Template Injection · Mass Assignment · Insecure Deserialization · Gadget Chains · Server-Side Parameter Pollution · Vulnerability Chaining · GraphQL Security · Cloud Metadata Service Exploitation
Sources
- JavaScript Prototype Pollution Deep Dive: Reconnaissance, Exploitation & Bug Bounty Guideline · original
- Where Severity Scores Go Wrong: "Just Add Prototype Pollution" · original
- Unrestricted Cloud Metadata Exfiltration via Header Injection Chain · 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
- AST Injection: Prototype Pollution to RCE in Handlebars · original
- Handlebars.js: Safe Usage to Avoid Injection Flaws · original
- Handlebars template injection and RCE in Shopify app · original
- HackerOne Report #423541: H1514 Server Side Template Injection · original
- Server-Side Template Injection — Bug Bounty 2k25 · original
- Six Proto6 Vulnerabilities in protobuf.js Expose Node.js Apps to RCE and DoS · original
- Top 5 hacker-relevant vulnerabilities (week 44 2026) · original
- GraphQL Tools prototype pollution advisory · original
- graphql-tools prototype pollution in mergeIncrementalResult (CVE-2026-114604) · original
- GraphQL Tools utils prototype pollution in incremental result merge (CVE-2026-114604) · original
- GraphQL Tools prototype pollution in mergeIncrementalResult (CVE-2026-114604) · original
- CVE-2026-114604: GraphQL Tools prototype pollution · original
- CVE-2025-55182: React Server Components RCE via Flight Payload Deserialization · original
- React2Shell (CVE-2025-55182): RSC Flight Decoder Remote Code Execution · original
- Defending Against React2Shell in React Server Components · original
- React2Shell Explained: From Vulnerability Discovery to Exploitation · original
- Adobe Acrobat Reader: Prototype pollution vulnerability enables remote code execution · original
- Adobe Patches Actively Exploited Acrobat Reader Flaw CVE-2026-34621 · original
- Adobe Acrobat Remote Code Execution Vulnerability · original
- vm2 Node.js Library Vulnerabilities Enable Sandbox Escape and Arbitrary Code Execution · original
- Cohere AI Terrarium Sandbox Flaw Enables Root Code Execution Container Escape · original
- tl;dr sec #328 · original
- The Frontier AI Vulnerability Burst · original
- Web AppSec Interview Questions · original
- Recon methodology for bug bounties: finding attack surface others miss · original
- DOM Invader · original
- snoopysecurity/awesome-burp-extensions · original
- Awesome Burp Extensions 2025 · original
- BApp Store - PortSwigger · original
- PortSwigger/BChecks · original
- ars0n-framework-v2: Bug Bounty Hunting Framework · original
- 0xPugazh/One-Liners · original
- dwisiswant0/awesome-oneliner-bugbounty · original
- Snyk VulnBench JS 1.0: Can LLMs Find the Same Bugs Twice? · original
- Frame: Grounding LLM Vulnerability Detection with a Sound Separation-Logic Core · original
- XSS Explained: From a Simple alert(1) to Real-World Impact CVEs · original