
BGT-Pentest-LAB Final Project: Xiaomi HyperOS System Updater OTA Signature Verification Bypass (CVE-2024-4309) Deep Analysis.
β οΈ EDUCATIONAL PURPOSES ONLY β Use on real systems is prohibited.
Prepared as part of the BGT-Pentest-LAB cybersecurity final project.
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.
π΄ Vulnerability Summary
|
π― Attack Vector
|
flowchart TD
subgraph MITM ["Phase 1: Network Access Compromise (MITM)"]
A["π 1. MITM (ARP Spoofing)"] --> B["π― 2. DNS Hijack (update.miui.com)"]
end
subgraph INJECTION ["Phase 2: Database and Package Manipulation"]
B --> C["πΎ 3. Hash Injection (ota_hashes.db)"]
C --> D["π¦ 4. Malicious OTA Package Preparation"]
end
subgraph BYPASS ["Phase 3: Security Bypass"]
D --> E["π 5. RSA Signature Bypass (Fast Channel)"]
E --> F["β‘ 6. Hash Verification Bypass (strstr Bug)"]
end
subgraph EXPLOIT ["Phase 4: Privilege Escalation & Exfiltration"]
F --> G["π 7. RCE & Persistent Root (system.img Flash)"]
end
%% Style Definitions
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
| Step | Action | Technical Detail |
|---|---|---|
| 1 | MITM Position | Network traffic is intercepted via ARP Spoofing or a fake Wi-Fi hotspot |
| 2 | DNS Hijack | DNS responses for update.miui.com are redirected to the attacker's server |
| 3 | Hash Injection | A partial malicious hash is injected into the ota_hashes.db database |
| 4 | Malicious OTA Package | A fake update.zip with X-Xiaomi-Fast-Channel: true header is created |
| 5 | RSA Bypass | MiuiRecoveryVerifier sees the Fast Channel header and skips RSA verification |
| 6 | Hash Bypass | quickHashCheck β partial match with strstr() β BYPASS |
| 7 | RCE | Malicious system.img is flashed in recovery mode β Persistent Root |
|
π₯οΈ C2 Dashboard app.py
Interactive dashboard that visualizes the attack simulation step by step with a premium web panel. Kill chain, risk score, real-time logs. |
βοΈ Attack Simulator attack.py
MITM attack simulation with a fake OTA server. 4 REST endpoints, malicious ZIP generation, hash injection and Fast Channel bypass. |
π Detection Engine detector.py
3-stage OTA security scanner. strstr() detection, Fast Channel analysis, risk score and IoC report. |
|
π§ Fix Demo fix_demo.py
strstr() vs strcmp() interactive comparison and patch demonstration. |
π Report Generator report_generator.py
PDF-ready professional HTML vulnerability analysis report generator. |
π§ͺ Test Suite test_suite.py
27 automated unit tests. Attack + Detector integration tests. |
| β Vulnerable Code (strstr) | β Patched Code (strcmp) |
|---|---|
|
|
| π΄ 8 characters sufficient β Brute-force: 2Β³Β² | π’ 64 characters required β Brute-force: 2Β²β΅βΆ |