Skip to content

schoi1337/blexploit

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

71 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

blexploit

A full-featured offensive BLE security framework for scanning, exploitation, and replay with anomaly detection, fingerprint-based attack suggestions, and offline sandbox simulation.

⚠️ WARNING: Ethical Use Required

blexploit is a BLE security testing framework for red teams and researchers.
It must only be used in environments where you have explicit authorization.
Unauthorized use may be illegal and is strictly prohibited.

πŸ‘‰ Read the full legal disclaimer.

πŸš€ Features

  • Passive BLE scanning with anomaly detection
  • GATT enumeration and fingerprinting
  • Modular attack framework (replay, brute-force, fake key)
  • Simulation engine for safe testing

πŸ“Έ Screenshots (Coming Soon)

Passive Scan Report (HTML) Fingerprinting Summary

🧠 Why Blexploit?

Most BLE security tools only log packets or trigger proof-of-concept GATT writes.
Blexploit bridges the gap between passive analysis and offensive simulation with a modular, extensible framework:

  • Real BLE packet injection (--write-test, --attack)
  • Anomaly-based risk detection via Isolation Forest
  • GATT-based fingerprinting & UUID enumeration
  • Modular plugin-based attack execution
  • Auto-generated HTML & JSON reports with recommendations

πŸ“½ Demo (Coming Soon)

  • Simulated replay of Xiaomi GATT writes
  • HTML report generation from passive scan
  • UUID-based attack module suggestion in CLI

🧠 Smart Attacks

  • Auto-suggested modules based on detected UUIDs
    β†’ Example: UUID 0xffd5 β†’ replay, brute-pin
  • Risk scoring from anomaly detection using Isolation Forest
  • Log tagging of exploit attempts with risk level, suggestions, and remediation

πŸ“Š Sample Report

πŸ”— HTML Report Example (Coming Soon) πŸ“„ JSON Output Schema (Coming Soon)

Each scan result includes:

  • Device info (MAC, Name, Manufacturer)
  • Risk level (Low / High via anomaly detection)
  • Suggested attack modules (based on UUIDs)
  • Mitigation recommendations

πŸ§ͺ Simulation Mode & Sandbox

Blexploit supports safe testing through simulated attacks and offline sandbox replay, enabling:

  • Training and education without real BLE hardware
  • Reproducible PoCs and CLI demos
  • Integration into CI pipelines

βœ… Key Features

Feature Description
--simulate-fakekey Simulates invalid BLE key injection
--simulate-replay Simulates BLE replay attack flow without sending packets
--sandbox Offline replay engine using mock device profiles
mock_device.py Emulates BLE devices like Xiaomi, Tile, WELOCK
YAML scripting Define and replay BLE write sequences for PoCs

πŸ” Example Usage

Run a safe simulation (no packets transmitted):

python main.py simulate-fakekey

Offline replay against sandbox profile:

python main.py --sandbox --input-file scripts/xiaomi_unlock.yaml

πŸ— Architecture

main.py
β”‚
β”œβ”€β”€ core/
β”‚   β”œβ”€β”€ passive_scanner.py      # BLE advertising scan + anomaly detection
β”‚   β”œβ”€β”€ fingerprint_store.py    # Store and compare device fingerprints
β”‚   β”œβ”€β”€ ble_write.py            # Write to GATT characteristics in live BLE devices
β”‚   └── uuid_scanner.py         # Enumerate GATT services/characteristics for a device
β”‚
β”œβ”€β”€ attacks/
β”‚   β”œβ”€β”€ replay.py               # Replay known BLE write payloads (e.g. unlock)
β”‚   β”œβ”€β”€ brute_pin.py            # Brute-force BLE PINs from top100 list
β”‚   └── ...                     # Additional attack modules (e.g. fakekey)
β”‚
β”œβ”€β”€ logic/
β”‚   β”œβ”€β”€ anomaly_detector.py     # IsolationForest-based BLE anomaly detection
β”‚   └── attack_suggester.py     # Map UUIDs to recommended attack modules
β”‚
β”œβ”€β”€ reporting/
β”‚   └── report_generator.py     # Generate HTML/JSON reports with risk & attack info
β”‚
└── data/
    └── top100_ble_pins.txt     # BLE PIN wordlist used in brute-force attacks

βš™οΈ Installation

πŸ”— Clone the Repository

git clone https://github.com/schoi1337/blexploit.git
cd blexploit

🐍 Create Virtual Environment (Recommended)

python3 -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

πŸ“¦ Install Dependencies

pip install -r requirements.txt

πŸ’» Platform-specific Notes

βœ… Linux (e.g., Kali, Ubuntu)

Make sure bluez is installed:

sudo apt install bluetooth libbluetooth-dev bluez

Ensure the Bluetooth interface is up:

sudo systemctl start bluetooth

Run all BLE operations with root or appropriate permissions.

🍏 macOS

Install macOS BLE backend:

pip install pyobjc-core pyobjc-framework-CoreBluetooth

πŸͺŸ Windows

  • Make sure you're using Python β‰₯ 3.8 (64-bit)
  • No extra BLE drivers required.
  • Use Bleak's WinRT backend (automatically selected)

πŸ”’ BLE Interface Requirements

  • A working BLE adapter (built-in or USB)
  • Location/Bluetooth permission enabled (especially on macOS and Windows)

πŸ§ͺ Usage

# Scan nearby BLE devices and generate report
python main.py passive-scan --timeout 10 --unsafe

# Read BLE characteristic
python main.py read-gatt --address <MAC> --uuid <UUID>

# Attempt brute-force BLE PIN attack
python main.py attack --type brute-pin --address <MAC> --unsafe

🧩 Plugin-Based Attack System

To add a new attack module:

# Example: attacks/custom_jammer.py
def run(args):
    print("[*] Sending test packet to", args.address)

And register it via CLI:

python main.py attack --type custom-jammer --address <MAC> --unsafe

πŸ“‹ Roadmap

Blexploit is under structured development with the following planned milestones:

  • macOS BLE scanning (via CoreBluetooth backend)
  • CLI+video replay demo (asciinema or GIF)
  • Animated fakekey/replay visualization in terminal
  • Public v1.0.0 release tag and changelog
  • README translations for international security audiences
  • Auto-tagging exploit logs for post-triage export (CSV/JSON)

🀝 Contributing

Contributions are welcome! If you have ideas for new attack modules, improvements to fingerprinting, or better simulation flows β€” feel free to open an issue or submit a pull request. Please see CONTRIBUTING.md for setup instructions and contribution guidelines.

☠️ Ethical Use Disclaimer

Blexploit is intended strictly for authorized testing and research. All live attack modules (--attack, --write-test) require:

  • The --unsafe flag
  • A typed confirmation in the CLI prompt (y or yes must be entered manually)

πŸ“„ License & Legal Notice

This project is licensed under the MIT license with an added ethical use clause. By using this tool, you agree to use it only in authorized environments.

Do not use against systems you do not own or have explicit permission to test.
The author assumes no responsibility for misuse or damage caused by this tool.

If you're unsure whether your testing is legal β€” don’t run it.