# Prototype Pollution Gadgets > Code that reads a property the program never set, inherits an attacker-polluted value from `Object.prototype`, and passes it to a dangerous sink. A gadget is the half of a prototype-pollution chain that produces the impact. ## How it works A gadget needs three things: 1. **An object created without that property.** Usually a plain `{}` options, env or config object. 2. **A lookup that walks the prototype chain.** `obj.x`, `obj[key]`, `for...in`, or the `in` operator. 3. **A sink that uses the result.** Process spawn, code generation, an HTTP request, HTML output, or a DB query. The vulnerable library does not create the pollution. It only consumes it. Without a separate pollution source in the same runtime, the gadget does nothing, and without the gadget the pollution has no effect. JFrog's lodash → Axios chain shows this split ([[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035|JFrog]]). The concept mirrors deserialization [[Gadget Chains]]: existing code is reused, and impact depends on what is loaded. ## Techniques / payloads Gadgets by sink class (described conceptually, not as working chains): | Sink | Gadget | Polluted key / mechanism | |---|---|---| | Process env | simple-git `.env()` allocates `{}`. Node copies inherited keys into the child env, and git runs `GIT_SSH_COMMAND` for SSH-style URLs (n8n Git node) | `GIT_SSH_COMMAND` ([[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422|Koeck]]) | | Process options | Node's `spawn` no longer honors polluted `options`, so a gadget must be app or library code that builds a plain options object and passes it to `spawn` (`@n8n/node-cli`). `stdio` was not controllable, which pushed the chain to `GIT_SSH_COMMAND` | ([[raw/dexpose.io/n8n-from-parsing-bug-to-remote-code-execution-aka-cve-2026-42231-7582|dexpose]]) | | Template compiler (AST injection) | Handlebars: polluted AST-shaped values pass the parser and reach the compiler, which emits them into the generated template function. Pug: `Object.prototype.block` is walked when a `While` node lacks its own `block` | `pendingContent` (detection), `type`/`body`, `block` ([[raw/po6ix.github.io/ast-injection-prototype-pollution-to-rce-in-handlebars-4131|po6ix]]) | | Code generation | protobuf.js resolves type names by plain property lookup, so a polluted value makes an attacker string look like a primitive type and it is compiled into a `Function()` encoder or decoder (CVE-2026-44291, CVSS 8.1) | type-name keys ([[raw/thehackernews.com/six-proto6-vulnerabilities-in-protobuf-js-expose-node-js-apps-to-rce-a-8856|THN Proto6]]) | | HTTP client: proxy | Axios takes `proxy` from the merged config, which leads to all traffic and credentials passing through the attacker (CVE-2026-44494) | `proxy` ([[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035|JFrog]]) | | HTTP client: headers | Axios merges inherited header keys and writes them unsanitized (CWE-113). CRLF in the value smuggles a second request, such as an IMDSv2 token `PUT` | arbitrary header name ([[raw/github.com/axios-unrestricted-cloud-metadata-exfiltration-via-header-injection-ch-4787|GHSA-fvcv-3m26-pcqx]]) | | ORM / `for...in` | TypeORM `buildWhere` iterates inherited keys and throws `EntityPropertyNotFoundError` on every query, which is a DoS | any key ([[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422|Koeck]]) | | String coercion | Overriding `Object.prototype.toString` so that coercion returns attacker-chosen code (Shopify Return Magic Handlebars RCE) | `toString` ([[raw/mahmoudsec.blogspot.com/handlebars-template-injection-and-rce-in-shopify-app-4132|mahmoudsec]]) | | Sanitizer / router (client) | DOMPurify CVE-2024-48910 and React Router CVE-2026-42211 consume inherited config. Piscina CVE-2026-55388 is a server-side worker-pool equivalent | ([[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035|JFrog]]) | **Finding gadgets.** - *Black box.* Pollute a candidate key with a marker, then look for the marker in output. `pendingContent` appearing in Handlebars output is one example ([[raw/po6ix.github.io/ast-injection-prototype-pollution-to-rce-in-handlebars-4131|po6ix]]). In Burp, use the Prototype Pollution Gadgets Finder BApp ([[raw/portswigger.net/bapp-store-portswigger-2862|BApp Store]]). - *White box.* Find `{}` objects whose optional fields reach `spawn`/`exec`, `Function`/`eval`, template compilation, `http.request` options, or `innerHTML`. ## Notable cases - **Axios 2026.** Ten gadget CVEs (CVE-2026-42033/35/41/42/44/264, -44489/90/94/95) received GitHub/NVD ratings from low to critical. JFrog rates most of them low or medium, because each needs pre-existing pollution and the app must not set the property itself ([[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035|JFrog]]). The separate header-injection advisory GHSA-fvcv-3m26-pcqx claimed CVSS 9.9 and RCE or cloud compromise for all v0.x–1.x versions ([[raw/github.com/axios-unrestricted-cloud-metadata-exfiltration-via-header-injection-ch-4787|GHSA]]). - **protobuf.js "Proto6".** Six CVEs. The root cause is that schemas and metadata are trusted by default. Fixed in 7.5.6 and 8.0.2, and protobufjs-cli 1.2.1 and 2.0.2 ([[raw/thehackernews.com/six-proto6-vulnerabilities-in-protobuf-js-expose-node-js-apps-to-rce-a-8856|THN]]). - **Handlebars and Pug AST injection.** The demo used the unpatched `flat` module as the pollution source ([[raw/po6ix.github.io/ast-injection-prototype-pollution-to-rce-in-handlebars-4131|po6ix]]). See [[JavaScript Template Engine SSTI]]. - **n8n.** The same `GIT_SSH_COMMAND` gadget was reused across two separate pollution sources (XML node and GSuiteAdmin) ([[raw/simonkoeck.com/cve-2026-33696-from-a-schema-name-to-rce-in-n8n-11422|Koeck]], [[raw/dexpose.io/n8n-from-parsing-bug-to-remote-code-execution-aka-cve-2026-42231-7582|dexpose]]). ## Defenses - Create option, env and header objects with `Object.create(null)`, or copy only own properties. Validate header values for CRLF ([[raw/github.com/axios-unrestricted-cloud-metadata-exfiltration-via-header-injection-ch-4787|GHSA-fvcv-3m26-pcqx]]). - Never feed schema- or config-derived strings into `Function()` without strict allow-lists ([[raw/thehackernews.com/six-proto6-vulnerabilities-in-protobuf-js-expose-node-js-apps-to-rce-a-8856|THN Proto6]]). - Keep template engines patched against their own pollution advisories, such as Handlebars GHSA-2cf5-4w76-r9qv ([[raw/xygeni.io/handlebars-js-safe-usage-to-avoid-injection-flaws-4129|Xygeni]]). - Triage gadget CVEs in context. Ask whether a pollution source exists in the same process, and whether the app sets the property itself ([[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035|JFrog]]). Programs often cap a standalone gadget, as covered in [[Vulnerability Chaining]]. ## Related - [[Prototype Pollution]] (main guide) - [[Server-Side Prototype Pollution]] · [[Client-Side Prototype Pollution]] - [[Gadget Chains]] · [[JavaScript Template Engine SSTI]] · [[Cloud Metadata Service Exploitation]] · [[Remote Code Execution]] · [[Vulnerability Chaining]] ## Sources - [[raw/jfrog.com/where-severity-scores-go-wrong-just-add-prototype-pollution-10035|Where Severity Scores Go Wrong: "Just Add Prototype Pollution"]] - [[raw/github.com/axios-unrestricted-cloud-metadata-exfiltration-via-header-injection-ch-4787|Unrestricted Cloud Metadata Exfiltration via Header Injection Chain]] - [[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/po6ix.github.io/ast-injection-prototype-pollution-to-rce-in-handlebars-4131|AST Injection: Prototype Pollution to RCE in Handlebars]] - [[raw/thehackernews.com/six-proto6-vulnerabilities-in-protobuf-js-expose-node-js-apps-to-rce-a-8856|Six Proto6 Vulnerabilities in protobuf.js Expose Node.js Apps to RCE and DoS]] - [[raw/mahmoudsec.blogspot.com/handlebars-template-injection-and-rce-in-shopify-app-4132|Handlebars template injection and RCE in Shopify app]] - [[raw/xygeni.io/handlebars-js-safe-usage-to-avoid-injection-flaws-4129|Handlebars.js: Safe Usage to Avoid Injection Flaws]] - [[raw/portswigger.net/bapp-store-portswigger-2862|BApp Store - PortSwigger]]