LOGBOOK

HELP

← again tap: answer good → ↑ swipe up at the end: next

1 / 12
Other keys: show • Space: good • 1-4: rate • 0: skip • 5: flag

Question

Why does physical access to an IoT device change its threat model so much compared to a server in a data centre?

Answer

data centre server network locked room: the network is the way in IoT devicehome · field · wall attacker JTAG flash UART secret · check recoverable unless the hardware protects it

Explanation in 5 steps

Whoever holds the device can attach debug hardware, read its memory and firmware, and watch or change the program while it runs. Any secret or check that lives only on the device is therefore at risk.

A server sits behind locked doors, so its threat model is mostly about the network. An IoT device is handed to its users and placed in homes, fields and walls, so you have to assume an attacker can unscrew the case. With the board in hand, an attacker can:

  • Attach a debug port such as JTAG, which can halt the CPU and read or write memory and registers below the operating system.
  • Dump the flash and study the firmware offline as long as they like.
  • Observe the device at runtime, for example on its serial console.

The consequence for design: a password, key or "secret message" that is checked or stored only on the device should be treated as recoverable unless the hardware protects it (see the hardening card). This is why IoT security guidance puts so much weight on disabling debug interfaces and encrypting flash before shipping.

Tip: "If it ships, it can be opened." Plan as if every device will end up on an attacker's bench.

Go deeper:

or press any other key

Question

What does esptool.py -p /dev/ttyUSB0 write_flash 0x10000 image.bin do, and why is the address 0x10000?

Answer

SPI flash one chip, several regions bootloader 0x1000 partition table 0x8000 nvs · phy_init 0x9000 factory app 0x10000 image.bin esptool write_flash no names · no -g runs fine - but you cannot read it

Explanation in 5 steps

It writes a prebuilt application image into the ESP32's flash over the USB serial port, starting at offset 0x10000. That is where the default ESP-IDF partition table places the first app partition.

ESP32 flash map: bootloader at 0x1000, partition table at 0x8000, nvs at 0x9000, phy_init at 0xF000 and the factory app at 0x10000, where write-flash puts image.bin

* The default layout. Writing at 0x10000 replaces only the application. *

ESP32 flash is split into regions: the second-stage bootloader near the start, the partition table at 0x8000, and then the partitions it lists. In the default single-app layout the factory app partition begins at 0x10000, so writing image.bin there replaces the application while leaving the bootloader and partition table untouched.

The important word is binary: image.bin is just the bytes that go into flash. It runs fine, but it carries no symbol names and no debug information, so you can flash and run a program you have no source for. Studying it is another matter (see the ELF card).

In esptool v5 and later the command is spelled esptool -p /dev/ttyUSB0 write-flash 0x10000 image.bin; the old esptool.py and write_flash spellings still work but are deprecated.

Go deeper:

or press any other key