BGT-Pentest-LAB siber güvenlik final projesi kapsamında hazırlanmıştır.
Xiaomi HyperOS System Updater bileşeninde bulunan ve uzaktan kod çalıştırmaya (RCE) imkan tanıyan CVE-2024-4309 zafiyetinin derinlemesine analizi, saldırı simülasyonu, tespit motoru ve interaktif web dashboard'u bu depoda yer almaktadır.
|
|
flowchart TD
subgraph MITM ["Aşama 1: Ağ Erişimini Ele Geçirme (MITM)"]
A["🌐 1. MITM (ARP Spoofing)"] --> B["🎯 2. DNS Hijack (update.miui.com)"]
end
subgraph INJECTION ["Aşama 2: Veritabanı ve Paket Manipülasyonu"]
B --> C["💾 3. Hash Enjeksiyonu (ota_hashes.db)"]
C --> D["📦 4. Zararlı OTA Paketi Hazırlama"]
end
subgraph BYPASS ["Aşama 3: Güvenlik Kontrollerini Atlama (Bypass)"]
D --> E["🔓 5. RSA İmza Atlatma (Fast Channel)"]
E --> F["⚡ 6. Hash Doğrulama Atlatma (strstr Bug)"]
end
subgraph EXPLOIT ["Aşama 4: Yetki Yükseltme & Sızma"]
F --> G["💀 7. RCE & Kalıcı Root (system.img Flash)"]
end
%% Stil Tanımlamaları
style MITM fill:#0f172a,stroke:#38bdf8,stroke-width:1px,color:#38bdf8
style INJECTION fill:#0f172a,stroke:#818cf8,stroke-width:1px,color:#818cf8
style BYPASS fill:#0f172a,stroke:#f59e0b,stroke-width:1px,color:#f59e0b
style EXPLOIT fill:#0f172a,stroke:#ef4444,stroke-width:2px,color:#ef4444
style A fill:#1e293b,stroke:#0284c7,stroke-width:2px,color:#e2e8f0
style B fill:#1e293b,stroke:#0284c7,stroke-width:2px,color:#e2e8f0
style C fill:#1e293b,stroke:#4f46e5,stroke-width:2px,color:#e2e8f0
style D fill:#1e293b,stroke:#4f46e5,stroke-width:2px,color:#e2e8f0
style E fill:#451a03,stroke:#d97706,stroke-width:2px,color:#fef3c7
style F fill:#451a03,stroke:#d97706,stroke-width:2px,color:#fef3c7
style G fill:#4c0519,stroke:#e11d48,stroke-width:3px,color:#ffe4e6
📖 Detaylı Açıklama — Her adımın teknik detayı için tıklayın
| Adım | Aksiyon | Teknik Detay |
|---|---|---|
| 1 | MITM Pozisyonu | ARP Spoofing veya sahte Wi-Fi hotspot ile ağ trafiği ele geçirilir |
| 2 | DNS Hijack | update.miui.com DNS yanıtları saldırganın sunucusuna yönlendirilir |
| 3 | Hash Injection | ota_hashes.db veritabanına kısmi zararlı hash enjekte edilir |
| 4 | Zararlı OTA Paketi | X-Xiaomi-Fast-Channel: true başlıklı sahte update.zip oluşturulur |
| 5 | RSA Bypass | MiuiRecoveryVerifier Fast Channel başlığını görür, RSA kontrolünü atlar |
| 6 | Hash Bypass | quickHashCheck → strstr() ile kısmi eşleşme → BYPASS |
| 7 | RCE | Recovery modunda zararlı system.img flash edilir → Kalıcı Root |
| ❌ Zafiyetli Kod (strstr) | ✅ Yamalı Kod (strcmp) |
|---|---|
// NativeVerifier.cpp — BUG!
bool quickHashCheck(const char* hash) {
for (int i = 0; i < count; i++) {
if (strstr(whitelist[i], hash))
return true; // Substring eşleşme ⚠️
}
return false;
} |
// NativeVerifier.cpp — FIXED
bool quickHashCheck(const char* hash) {
for (int i = 0; i < count; i++) {
if (strcmp(whitelist[i], hash) == 0)
return true; // Tam eşleşme ✅
}
return false;
} |
| 🔴 8 karakter yeterli — Brute-force: 2³² | 🟢 64 karakter gerekli — Brute-force: 2²⁵⁶ |
📦 CVE-2024-4309-Analysis
├── 📄 README.md # Bu dosya
├── 📄 ROADMAP.md # Proje yol haritası (5 faz)
├── 🐳 Dockerfile # Konteyner yapılandırması
├── 🐳 docker-compose.yml # Servis orkestrasyon dosyası
├── 🔑 .env.example # Ortam değişkenleri şablonu
├── 📄 .gitignore # Git dışlama kuralları
├── 📄 requirements.txt # Bağımlılık listesi (sıfır bağımlılık)
│
├── 📁 docs/
│ ├── 📁 presentations/ # 🎨 Sunum dosyaları (HTML slides, infographic)
│ ├── 📁 research/ # 🔬 Araştırma notları ve derin analiz
│ └── 📁 references/ # 📚 Kaynakça ve referanslar
│
└── 📁 src/
├── 🖥️ app.py # C2 Web Dashboard (Premium UI)
├── ⚔️ attack.py # OTA MITM saldırı simülatörü
├── 🔍 detector.py # Çok aşamalı saldırı tespit motoru
├── 🔧 fix_demo.py # strstr() vs strcmp() demo
├── 📄 report_generator.py # PDF-ready HTML rapor üretici
└── 🧪 test_suite.py # 27 otomatik birim testi
- Python 3.12+ (harici bağımlılık yok — yalnızca standart kütüphane)
- Docker (opsiyonel)
git clone https://github.com/Winslowe/CVE-2024-4309-Analysis.git
cd CVE-2024-4309-Analysis
cp .env.example .envdocker-compose up -dDashboard → http://127.0.0.1:5000
# Terminal 1 — C2 Dashboard
python src/app.py
# Terminal 2 — Saldırı Sunucusu
python src/attack.py
# Terminal 3 — Tespit Motoru
python src/detector.pypython src/test_suite.py
# veya
python -m pytest src/test_suite.py -v| Teslim | Dosya | Durum |
|---|---|---|
| Zafiyet Araştırması ve Logları | docs/research/ |
✅ |
| PoC Scriptleri | src/ (6 dosya) |
✅ |
| Görsel Analiz (Infographic) | docs/presentations/ |
✅ |
| C2 Web Dashboard | src/app.py |
✅ |
| Otomatik Test Suite | src/test_suite.py (27 test) |
✅ |
| PDF-Ready Rapor | report_generator.py |
✅ |
| Docker Desteği | Dockerfile + docker-compose.yml |
✅ |
| Doküman | Açıklama |
|---|---|
docs/research/ |
🔬 Derin analiz ve araştırma notları |
docs/presentations/ |
🎨 HTML sunum ve infographic dosyaları |
docs/references/sources.md |
📚 Tam kaynakça listesi |
ROADMAP.md |
🗺️ 5 fazlı proje yol haritası |
| Kaynak | Link |
|---|---|
| Xiaomi Security Bulletin | trust.mi.com/misrc/bulletins/advisory |
| QDebugger Research | ota-security.q-debugger.com |
| CWE-347 | cwe.mitre.org/data/definitions/347 |
| Android RecoverySystem API | developer.android.com |
| Xiaomi OTA Research | github.com/nicene-0 |
|
|
Built with 🐍 Python · Zero Dependencies · Made for BGT-Pentest-LAB Final Project
© 2026 — Yalnızca eğitim ve araştırma amaçlıdır.