How does security of esp32 work?

Hi. Just like the title implies; I’m curious how the security of esp32 work. More specifically, I’m wondering about access to the configuration file. (My knowledge and understanding of these things is very limited).

Let’s say I have an esp32 that I use with esphome in HA, and on it there is a configuration that I installed through standard esphome procedure. Suppose someone were to steal it and attempt to read it the config. Would the esp32 security protocols somehow protect against such efforts?

The configuration yaml file you write is compiled into machine code before being uploaded to the device. A big string of hexadecimal numbers that mean things to the ESP cpu.

Someone could download the machine code which they would then have to reverse engineer. There are tools available to assist with this. Here’s an example:

Essentially if you have access to the hardware of anything it is no longer secure. This goes for everything from game consoles to PCs to micro-controllers (even ones with code protect fuses can be defeated if you are persistent enough).

Interesting. Thanks for that. I got the impression from the introduction of this article

(“Understanding ESP32’s Security Features | by Kedar Sovani | The ESP Journal” Understanding ESP32’s Security Features | by Kedar Sovani | The ESP Journal)

that the esp32 security will protect against such things. However, it could be a misunderstanding due to my limited knowledge.

So anything short of a physical protection, some kind dead man’s switch if you will, is insufficient?

To piggyback on @tom_l’s comment, I remember a sysadmin professor of mine once saying, “If someone gets physical access, there’s very little you can do.” This was obviously geared towards production infrastructure, but it generally applies to any sort of computational hardware.

Can you share what your specific concerns are, or what you’re trying to achieve?

In my case, I’m not overly concerned about somebody stealing my ESPs and attempting to decompile the bytecode. However, all of those devices share a VLAN alongside other IOT devices (to properly segregate IOT stuff away from our personal devices), so I do have some concern about, say, an off-the-shelf device (Sonos, etc.) getting exploited and that bad actor attempting to read traffic between my ESPs on that gateway. So, all of my ESPHome configs encrypt the API traffic (Native API Component — ESPHome). That provides me with enough peace of mind.

Thanks. I stumbled upon it when I was looking at the esp32 for entirely different reasons and I thought it could be another reason to get the esp32 instead of ep8266 mini that I currently use.

That got me thinking about the fact that some of my esp:s will be in a space shared with other people. While I highly doubt that they intend to, or even know how to copy my setup, I want to avoid it.

Got it. It might be worth popping into the ESPHome Discord and chatting with one of the devs in real time: ESPHome

1 Like

You can grab the firmware from an esp device, and by running strings [1] on the firmware you can get a lot of info.

[1] strings(1) - Linux man page