← again tap: answer good → ↑ swipe up at the end: next
Question
Why does physical access to an IoT device change its threat model so much compared to a server in a data centre?
Answer
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:
OWASP — Internet of Things Project (IoT Top 10, 2018) — "Lack of physical hardening" and "hardcoded passwords" are two of the ten.
ESP-IDF — Security Overview — what the ESP32 offers against an attacker who holds the board.
Question
What does esptool.py -p /dev/ttyUSB0 write_flash 0x10000 image.bin do, and why is the address 0x10000?
Answer
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.
* 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:
ESP-IDF — Partition Tables — the default layout with the factory app at 0x10000.
esptool — Basic Commands —
write-flashand its options.