Skip to content
KitploitKITPLOIT
ToolsBlog
Submit
ToolsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

··Feeds·Contact·Privacy·© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
CVE-2024-4309-Analysis — BGT-Pentest-LAB Final Project: Xiaomi HyperOS System Updater OTA Signature Verification Bypass (CVE-2024-4309) Deep Analysis. | Kitploit
Tools/GitHubGitHub/winslowe/cve-2024-4309-analysis
Vulnerability AnalysisExploitationCryptographyPenetration TestingMobile SecurityLearning & EducationIncident ResponseBinary ExploitationLabs & Practice
GitHubwinslowe/cve-2024-4309-analysis

CVE-2024-4309-Analysis

BGT-Pentest-LAB Final Project: Xiaomi HyperOS System Updater OTA Signature Verification Bypass (CVE-2024-4309) Deep Analysis.

112 months agoNot yet reviewed
View Repository

Most Popular

View all →

Discover the most used tools by our community.

Explore all tools

Browse our collection of tools

View all tools →
Share

🛡️ CVE-2024-4309

Xiaomi HyperOS System Updater — OTA Signature Verification Bypass & RCE


CVSS RCE Python


Status Course License Docker Tests Zero Deps


⚠️ EDUCATIONAL PURPOSES ONLY — Use on real systems is prohibited.




📋 Project Overview / Project Overview

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

FieldValue
CVE IDCVE-2024-4309
ComponentSystem Updater (HyperOS)
Severity🔴 Critical (CVSS 9.1)
CWECWE-347: Improper Crypto Signature Verification
ImpactPersistent RCE, Root Access
FixHyperOS 1.0.4.0+

🎯 Attack Vector

MetricValue
Attack VectorAdjacent Network
ComplexityLow
PrivilegesNone
User InteractionNone
ScopeChanged
CVSS VectorAV:A/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N



💀 Attack Flow / Attack Kill Chain

root@kitploit:~
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
📖 Detailed Explanation — Click for technical details of each step
StepActionTechnical Detail
1MITM PositionNetwork traffic is intercepted via ARP Spoofing or a fake Wi-Fi hotspot
2DNS HijackDNS responses for update.miui.com are redirected to the attacker's server
3Hash InjectionA partial malicious hash is injected into the ota_hashes.db database
4Malicious OTA PackageA fake update.zip with X-Xiaomi-Fast-Channel: true header is created
5RSA BypassMiuiRecoveryVerifier sees the Fast Channel header and skips RSA verification
6Hash BypassquickHashCheck → partial match with strstr() → BYPASS
7RCEMalicious system.img is flashed in recovery mode → Persistent Root



⚙️ Developed Tools / Developed Tools




🖥️ 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.




🐛 Root Cause / Root Cause

❌ Vulnerable Code (strstr)✅ Patched Code (strcmp)
root@kitploit:~
// NativeVerifier.cpp — BUG!
bool quickHashCheck(const char* hash) {
    for (int i = 0; i < count; i++) {
        if (strstr(whitelist[i], hash))
            return true;  // Substring match ⚠️
    }
    return false;
}
root@kitploit:~
// NativeVerifier.cpp — FIXED
bool quickHashCheck(const char* hash) {
    for (int i = 0; i < count; i++) {
        if (strcmp(whitelist[i], hash) == 0)
            return true;  // Exact match ✅
    }
    return false;
}
🔴 8 characters sufficient — Brute-force: 2³²🟢 64 characters required — Brute-force: 2²⁵⁶



🗂 Repository Structure / Repository Structure

root@kitploit:~
📦 CVE-2024-4309-Analysis
├── 📄 README.md                    # This file
├── 📄 ROADMAP.md                   # Project roadmap (5 phases)
├── 🐳 Dockerfile                   # Container configuration
├── 🐳 docker-compose.yml           # Service orchestration file
├── 🔑 .env.example                 # Environment variables template
├── 📄 .gitignore                   # Git exclusion rules
├── 📄 requirements.txt             # Dependency list (zero dependencies)
│
├── 📁 docs/
│   ├── 📁 presentations/           # 🎨 Presentation files (HTML slides, infographic)
│   ├── 📁 research/                # 🔬 Research notes and deep analysis
│   └── 📁 references/              # 📚 Bibliography and references
│
└── 📁 src/
    ├── 🖥️  app.py                   # C2 Web Dashboard (Premium UI)
    ├── ⚔️  attack.py                # OTA MITM attack simulator
    ├── 🔍 detector.py               # Multi-stage attack detection engine
    ├── 🔧 fix_demo.py               # strstr() vs strcmp() demo
    ├── 📄 report_generator.py       # PDF-ready HTML report generator
    └── 🧪 test_suite.py             # 27 automated unit tests



🚀 Setup / Getting Started

Prerequisites

  • Python 3.12+ (no external dependencies — only standard library)
  • Docker (optional)

📥 Cloning

root@kitploit:~
git clone https://github.com/Winslowe/CVE-2024-4309-Analysis.git
cd CVE-2024-4309-Analysis
cp .env.example .env

🐳 Running with Docker

root@kitploit:~
docker-compose up -d

Dashboard → http://127.0.0.1:5000

🐍 Running Without Docker

root@kitploit:~
# Terminal 1 — C2 Dashboard
python src/app.py

# Terminal 2 — Attack Server
python src/attack.py

# Terminal 3 — Detection Engine
python src/detector.py

🧪 Running Tests

root@kitploit:~
python src/test_suite.py
# or
python -m pytest src/test_suite.py -v



📊 Deliverables / Deliverables

DeliverableFileStatus
Vulnerability Research and Logsdocs/research/✅
PoC Scriptssrc/ (6 files)✅
Visual Analysis (Infographic)docs/presentations/✅
C2 Web Dashboardsrc/app.py✅
Automated Test Suitesrc/test_suite.py (27 tests)✅
PDF-Ready Reportreport_generator.py✅
Docker SupportDockerfile + docker-compose.yml✅



📚 Documentation / Documentation

DocumentDescription
docs/research/🔬 Deep analysis and research notes
docs/presentations/🎨 HTML presentation and infographic files
docs/references/sources.md📚 Complete bibliography list
ROADMAP.md🗺️ 5-phase project roadmap



🔗 References / References

SourceLink
Xiaomi Security Bulletintrust.mi.com/misrc/bulletins/advisory
QDebugger Researchota-security.q-debugger.com
CWE-347cwe.mitre.org/data/definitions/347
Android RecoverySystem APIdeveloper.android.com
Xiaomi OTA Researchgithub.com/nicene-0



🎓 Academic Information / Academic Information

👨‍🏫 Instructor / Instructor

NameKeyvan Arasteh

👤 Student / Student

Full NameSamuroDev
Student ID``

📚 Course / Course

CoursePenetration Testing / Penetration Testing
CodeBGT006 · 3 ECTS
Semester2025-2026 Spring
UniversityIstinye University



Built with 🐍 Python · Zero Dependencies · Made for BGT-Pentest-LAB Final Project
© 2026 — For educational and research purposes only.

Download Tool