ESP32 / ESP8266 firmware analysis and security toolkit.
Flash dump, UART sniff, partition parse, secure boot check. Optional LLM string review.
Live site → · Quick start · Tools
esp32sec is a focused Python toolkit for poking at ESP32 / ESP8266 devices
during authorized security research. No custom dev board, no cloud service,
no telemetry. Six scripts you can read in 5 minutes each, and an optional
LLM tier that turns hours of string-grepping into a 30-second review.
+----------+ +-----------+ +-----------------+
| Target | <---> | UART bus | <---> | Your laptop |
| ESP32 | UART | CP2102 | USB | (Linux/mac/WSL) |
+----------+ +-----------+ +-----------------+
|
+-----------------+-----------------+
| | |
v v v
flash_dump.py uart_sniffer.py firmware_inspect.py
(4MB in 30s) (boot + runtime) (strings, magic, NVS)
|
v
partition_table.py
secure_boot_check.py
|
v
llm_firmware_review.py
(OpenAI / Anthropic / heuristic)
| # | Script | What it does |
|---|---|---|
| 01 | tools/flash_dump.py |
Dump the full SPI flash over UART using esptool |
| 02 | tools/uart_sniffer.py |
Capture raw boot-ROM and runtime UART output |
| 03 | tools/firmware_inspect.py |
Quick-look at a flash image: magic, NVS, strings |
| 04 | tools/partition_table.py |
Parse the OTA / NVS / spiffs partition table from a dump |
| 05 | tools/secure_boot_check.py |
Heuristic check for secure boot / flash crypto state |
| 06 | tools/llm_firmware_review.py |
AI-assisted review: local patterns + OpenAI / Anthropic |
The parsers are covered against a synthetic but structurally valid 4 MB flash image, so nothing needs hardware to verify a change:
python -m unittest discover -s tests -vThat checks the partition table parser against real ESP-IDF entry layouts and
pins the ESP-IDF app-image header offsets, which is where this repo previously
read chip_id from the wrong place.
# 1. Clone and install
git clone https://github.com/zhameersheraz/esp32sec.git
cd esp32sec
pip install -r requirements.txt
# 2. Wire up: ESP32 <-> CP2102/FTDI <-> USB
# 3. Dump the flash
sudo python3 tools/flash_dump.py --port /dev/ttyUSB0 --output flash.bin
# 4. Inspect
python3 tools/firmware_inspect.py flash.bin --strings
python3 tools/partition_table.py flash.bin
python3 tools/secure_boot_check.py flash.bin
# 5. Sniff live UART during boot
sudo python3 tools/uart_sniffer.py --port /dev/ttyUSB0 --baud 74880
# 6. Optional: send the strings to an LLM for context-aware review
# (defaults to fully-offline heuristic if no provider is given)
python3 tools/llm_firmware_review.py flash.bin --provider openaiYou probably already have it.
Required
- ESP32 or ESP8266 dev board
- USB-to-UART bridge: CP2102, FTDI FT232, or CH340
- Linux, macOS, or WSL
- Python 3.10 or newer
Recommended
- USB logic analyzer (Saleae, sigrok-compatible clones)
- Multimeter for verifying 3.3 V levels
- ESP-PROG (or compatible JTAG) for deeper debugging
- Soldering iron for off-dev-kit targets
esp32sec/
├── assets/ # 3D-rendered hero / workflow images
├── docs/
│ ├── assets/ # images served by the GitHub Pages site
│ └── index.html # GitHub Pages site
├── tools/
│ ├── flash_dump.py
│ ├── uart_sniffer.py
│ ├── firmware_inspect.py
│ ├── partition_table.py
│ ├── secure_boot_check.py
│ ├── llm_firmware_review.py # optional: OpenAI / Anthropic
│ └── __init__.py
├── LICENSE # MIT
├── README.md # this file
└── requirements.txt # core deps
Only test against devices you own or have explicit written permission to test. The author is not responsible for misuse.
This toolkit is for:
- Personal hardware you own
- Authorized penetration tests (with signed scope)
- CTF competitions and educational labs
- Academic security research
Not for: unauthorized access, planted devices, anything shady.
MIT — see LICENSE.
