Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

vulns bluefi

CVE-2025-27840 affects ESP32 Bluetooth firmware. When an ESP32 is connected via USB in HCI (Host Controller Interface) mode, the full HCI command set is exposed with no authentication. This includes undocumented Espressif vendor-specific commands (OGF 0x3F) that provide:

  • Arbitrary memory read: extract RAM, ROM, or flash content including cryptographic keys, Wi-Fi credentials, and NVS secrets.
  • Arbitrary memory write: overwrite runtime state, disable security checks, or inject code.

The plugin:

  1. Opens the ESP32 serial port and sends HCI_Reset to confirm HCI mode.
  2. Probes the two known-dangerous OCFs (0x001 read, 0x002 write) and flags any that respond with a non-“unknown command” status.
  3. Sweeps vendor OCF 0x000 through --ocf-end (default 15) to enumerate the broader attack surface.

HCI command structure:

[0x01][opcode_lo][opcode_hi][param_len][params...]

For vendor commands (OGF 0x3F): opcode = 0xFC00 | OCF

Checks performed

CheckFindingSeverity
Device responds to HCI_ResetHCI interface reachableMedium
OCF 0x001 responsiveArbitrary memory readCritical
OCF 0x002 responsiveArbitrary memory writeCritical
Any OCF in sweep responsiveAdditional attack surfaceHigh
No responsive commands foundNot vulnerable / patchedInfo

Usage

iottack vulns bluefi --port /dev/ttyUSB1 [OPTIONS]

Options

FlagShortDefaultDescription
--port <PORT>-p(required)Serial port of the ESP32 in HCI mode
--baud-rate <BAUD>-b115200Serial baud rate
--timeout-ms <MS>-t200Per-command response timeout
--ocf-end <N>-e15Last OCF to sweep (max 1023 for full scan)
--output <FILE>-o-Save result to a file
--format <FORMAT>-ftexttext or json

Examples

Quick targeted probe (known dangerous OCFs only, ~3 s):

iottack vulns bluefi --port /dev/ttyUSB1

Full vendor command enumeration (~200 s):

iottack vulns bluefi --port /dev/ttyUSB1 --ocf-end 1023

Save as JSON:

iottack vulns bluefi --port /dev/ttyUSB1 --output bluefi.json --format json

Mitigation

  • In production firmware, disable the HCI UART interface: set CONFIG_BT_HCI_UART=n in sdkconfig.
  • Apply the Espressif patch that restricts vendor command access to authenticated channels (available in ESP-IDF ≥ 5.x with the security fix).
  • Reference: https://nvd.nist.gov/vuln/detail/CVE-2025-27840