esp32sec.
v0.6 · ESP32 · ESP8266 · OFFENSIVE SECURITY TOOLKIT

esp32.sec_

Firmware analysis, UART sniffing, partition parsing, secure-boot checks, and AI-assisted string review for ESP32 and ESP8266 hardware. Six focused Python tools, one command-line flow.

6
Tools
3
Python deps
MIT
License
ESP32
ESP8266 ready
SCAN / ACTIVE ESP32 development board on dark surface with red accent lighting

One toolkit,
full attack surface.

Six Python scripts that cover the basics of ESP32 hardware security research: read the flash, sniff the bus, parse the layout, verify the boot chain, and (optionally) let an LLM review the strings you pulled out.

01

flash_dump.py

Read the full SPI flash over UART using esptool. Custom baud, size, and output path.

sudo python3 flash_dump.py --port /dev/ttyUSB0
02

uart_sniffer.py

Capture raw boot-ROM and runtime UART output. Boot ROM uses 74880 baud, runtime 115200.

python3 uart_sniffer.py --baud 74880
03

firmware_inspect.py

Quick-look at a flash image: ESP32 magic byte, NVS partition, printable strings.

python3 firmware_inspect.py flash.bin --strings
04

partition_table.py

Parse the partition table from a dump and label each entry by type (app/data) and subtype.

python3 partition_table.py flash.bin
05

secure_boot_check.py

Heuristic check for secure boot and flash crypto from a flash dump. Pairs with espefuse.py.

python3 secure_boot_check.py flash.bin
06

llm_firmware_review.py

Optional: send extracted strings to OpenAI or Anthropic for a security review. Local heuristics flag obvious secrets first; the LLM catches the rest. Fully offline by default.

python3 llm_firmware_review.py flash.bin --provider openai

Dump, inspect,
understand.

A typical flow: pull the firmware off the chip, look at what's inside, and figure out whether the device is doing what it claims.

zsh · ~/esp32sec
# 1. Clone and install $ git clone https://github.com/zhameersheraz/esp32sec.git $ cd esp32sec && pip install -r requirements.txt   # 2. Dump the flash (4MB default, change with --size) $ sudo python3 tools/flash_dump.py --port /dev/ttyUSB0 --output flash.bin [+] esptool.py v4.7 --chip esp32 --port /dev/ttyUSB0 --baud 115200 read_flash 0x0 4MB flash.bin [+] Wrote flash.bin (4194304 bytes)   # 3. What is in here? $ python3 tools/firmware_inspect.py flash.bin --strings [+] Looks like a valid ESP32 image (magic 0xE9) [+] NVS partition found [+] Partition table found   # 4. Where are the partitions? $ python3 tools/partition_table.py flash.bin name type subtype offset size flags nvs data nvs 0x00090000 0x00006000 0x00 phy_init data phy 0x000f0000 0x00001000 0x00 factory app factory 0x00010000 0x00300000 0x00 storage data spiffs 0x00390000 0x000f0000 0x00   # 5. AI-assisted review (set OPENAI_API_KEY first) $ export OPENAI_API_KEY=sk-... $ python3 tools/llm_firmware_review.py flash.bin --provider openai [+] 18432 strings (min len 6) from flash.bin [!] 3 local-heuristic match(es): [GitHub PAT] ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx [Possible API key literal] api_key = "AIzaSy..." [Hard-coded IP address] 192.168.4.1   # 6. Optional: AI-assisted review (set OPENAI_API_KEY first) $ export OPENAI_API_KEY=sk-... $ python3 tools/llm_firmware_review.py flash.bin --provider openai

You probably
already have it.

No custom dev board required. Any ESP32 dev kit and a $3 USB-to-UART bridge is enough to get started.

Required

  • Target ESP32 or ESP8266 dev board
  • Bridge USB-to-UART: CP2102, FTDI, CH340
  • Host Linux, macOS, or WSL
  • Python 3.10 or newer

Recommended

  • Logic Saleae or cheap USB logic analyzer
  • Soldering For non-dev-kit targets
  • Multimeter For verifying voltage levels
  • JTAG ESP-PROG for deeper debugging
ESP32 ESP32-S2 ESP32-S3 ESP32-C3 ESP8266 CP2102 FTDI FT232 CH340

Three commands
and you're in.

Clone, install, and dump your first ESP32 flash in under a minute. Drop your LLM key in if you want the AI review pass.