CVE-2025-14847 | CVSS 8.7(高危)| 未认证内存泄露
MongoBleed 是 MongoDB 网络传输层中的一个严重内存泄露漏洞,允许未认证的远程攻击者无需任何凭据或用户交互,即可窃取敏感的堆内存数据。
| 类别 | 描述 |
|---|---|
| 攻击类型 | 远程未认证内存泄露 |
| 根本原因 | zlib 解压返回分配的缓冲区大小,而非实际数据长度 |
| 泄露的数据 | 数据库密码、API 密钥、会话令牌、AWS 凭据、内部服务器状态 |
| 严重性 | CVSS 8.7(高危) - 可远程访问,无需认证 |
| 利用情况 | 自 2025 年 12 月 28 日起已观察到野外利用 |
| 分支 | 受影响版本 | 修复版本 | 操作 |
|---|---|---|---|
| 8.2.x | 8.2.0 → 8.2.2 | 8.2.3 | 立即升级 |
| 8.0.x | 8.0.0 → 8.0.16 | 8.0.17 | 立即升级 |
| 7.0.x | 7.0.0 → 7.0.27 | 7.0.28 | 立即升级 |
| 6.0.x | 6.0.0 → 6.0.26 | 6.0.27 | 立即升级 |
| 5.0.x | 5.0.0 → 5.0.31 | 5.0.32 | 立即升级 |
| 4.4.x | 4.4.0 → 4.4.29 | 4.4.30 | 立即升级 |
| ≤4.2.x | 所有版本 | 无 | ⚠️ 已停止维护 - 请迁移至受支持版本 |
| 方面 | 详情 |
|---|---|
| 易受攻击对象 | 使用 zlib 压缩的 MongoDB 服务器网络传输层 |
| 严重性 | 高危(CVSS 8.7/7.5) |
| 影响 | 未认证情况下远程泄露未初始化的堆内存 |
| 为何重要 | 泄露的内存片段包含数据库密码、AWS 密钥和内部服务器状态 |
| 漏洞利用状态 | 公开的概念验证(PoC)"mongobleed" 已验证并正在流传 |
| 现在该做什么 | 立即升级到已修复版本,或禁用 zlib 压缩 |
该漏洞存在于 MongoDB 的网络传输层(message_compressor_zlib.cpp)中,zlib 解压逻辑的一个严重缺陷使未认证攻击者能够泄露敏感的服务器内存。
// VULNERABLE CODE (before fix)
counterHitDecompress(input.length(), output.length());
return {output.length()}; // ❌ Returns ALLOCATED buffer size
// PATCHED CODE (after fix)
counterHitDecompress(input.length(), output.length());
return length; // ✅ Returns ACTUAL decompressed data length
┌─────────────────────────────────────────────────────────────────────────────┐
│ MongoBleed Attack Vector │
├─────────────────────────────────────────────────────────────────────────────┤
│ │
│ ATTACKER VULNERABLE MongoDB │
│ │ │ │
│ │ 1. Send OP_COMPRESSED message │ │
│ │ uncompressedSize: 8192 (LIE) │ │
│ │ actual data: ~100 bytes │ │
│ │────────────────────────────────────> │
│ │ │ │
│ │ 2. Allocate 8192-byte buffer │
│ │ 3. Decompress ~100 bytes │
│ │ 4. BUG: Return buffer.length() = 8192 │
│ │ 5. BSON parser reads uninitialized memory │
│ │ │ │
│ │ 6. Error response with leaked │ │
│ │ memory as "field names" │ │
│ │<──────────────────────────────────── │
│ │ │ │
│ 🔓 LEAKED DATA: │ │
│ - API keys, passwords, tokens │
│ - MongoDB internal state │
│ - WiredTiger storage configs │
│ - System /proc information │
│ - Client connection data │
│ │
└─────────────────────────────────────────────────────────────────────────────┘
| 日期 | 事件 |
|---|---|
| 2025 年 12 月 15 日 | 发现漏洞;内部工单 SERVER-115508 |
| 2025 年 12 月 19 日 | 发布修复,披露 CVE-2025-14847 |
| 2025 年 12 月 24 日 | MongoDB Atlas 集群已完成修补 |
| 2025 年 12 月 26 日 | 发布公开 PoC "mongobleed" |
| 2025 年 12 月 28 日 | 观察到野外利用 |
🔬 查看技术分析 → 了解详细的漏洞剖析、漏洞利用构造和检测方法。
mongobleed-exploit-CVE-2025-14847/
├── exploit/ # 🔴 Exploit Lab
│ ├── docker-compose.yml # Vulnerable + Patched MongoDB instances
│ ├── mongobleed.py # Memory leak exploit PoC
│ ├── init/init-mongo.js # Sensitive test data
│ ├── test-exploit.sh # Lab test script
│ └── README.md # Lab documentation
│
├── scanner/ # 🌐 Network Scanner
│ ├── mongobleed_scanner.py # IP/domain vulnerability scanner
│ ├── sample-targets.txt # Sample targets file
│ └── README.md # Scanner documentation
│
├── code-scan/ # 📂 Code Scanner
│ ├── main.py # CLI entry point
│ ├── scanners/ # Docker, Python, Infra scanners
│ ├── models/ # Finding, Vulnerability models
│ ├── integrations/ # Phoenix Security upload
│ └── README.md # Code scanner documentation
│
└── original-exploit/ # 📚 Original PoC reference
cd exploit
# Start lab (vulnerable + patched instances)
docker-compose up -d
sleep 10
# Test vulnerable instance (should leak memory)
python3 mongobleed.py --host localhost --port 27017
# Test patched instance (should NOT leak memory)
python3 mongobleed.py --host localhost --port 27018
# Full lab test
./test-exploit.sh
cd scanner
# Scan single host
python3 mongobleed_scanner.py 192.168.1.100
# Scan network range
python3 mongobleed_scanner.py 192.168.1.0/24
# Scan from file
python3 mongobleed_scanner.py @sample-targets.txt --json --output results.json
cd code-scan
# Scan project for vulnerable MongoDB versions
python3 main.py scan /path/to/project
# Scan and upload to Phoenix
python3 main.py scan /path/to/project --upload-phoenix
# Run tests
python3 main.py test
# === EXPLOIT LAB ===
# Start lab
cd exploit && docker-compose up -d && sleep 10
# Run exploit (vulnerable instance)
python3 exploit/mongobleed.py --host localhost --port 27017
# Run exploit (patched instance - verify no leaks)
python3 exploit/mongobleed.py --host localhost --port 27018
# === NETWORK SCANNER ===
# Scan local lab
python3 scanner/mongobleed_scanner.py localhost:27017 localhost:27018
# Scan network
python3 scanner/mongobleed_scanner.py 192.168.1.0/24 --threads 20
# === CODE SCANNER ===
# Scan current directory
python3 code-scan/main.py scan .
# Scan with JSON output
python3 code-scan/main.py scan /path/to/project --json --output results.json
# Scan and upload to Phoenix
python3 code-scan/main.py scan /path/to/project --upload-phoenix