Another Brick in the Firewall: How we flashed our way out of a sketchy IoT app

We at Think-Ahead are mostly techies, so some things in our office tend to get less attention than others. Plants, for example. So it might have happened that some of our office plants had a rough time this summer. Naturally, we decided to go against our own principles and solve a people problem with tech.
One order and a couple of days later, we had everything we needed: a moisture sensor and a Zigbee hub. The plan was simple: the moisture sensor reports its data over Zigbee to the hub, which forwards it to a destination of our choosing. Maybe our VictoriaMetrics stack, maybe an internal service in our cluster. Either way, we’d get a notification telling us to water the plants.
TL;DR: The cheapest Zigbee hub we could find wanted an app, an account and a server to phone home to. So we flashed our own firmware onto it, built everything we wish the manufacturer had shipped, and accidentally ended up with a pretty good argument for the Cyber Resilience Act.
You get what you pay for
When I first got my hands on what we ordered (we bought the cheapest stuff we could find, blame us :P), I was mentally prepared to print the return label and send it all back.
Now you might wonder: what was wrong with it? First of all, you needed a separate app to connect to the device. I thought, hmm, OK, not perfect, but let’s get through it once. The App Store rating was also meh, 2/5 stars… ah, damn. The step that almost made me give up was that you had to create an account just to connect the device to your Wi-Fi. HELL NAW!
Bringing out the big guns
A bit of research revealed that the setup protocol had already been reverse engineered. So I let Claude build a macOS app in Swift that connects to the device’s local Wi-Fi and does the initial setup. After some fiddling around, I noticed that the protocol required you to pick one of the manufacturer’s servers for the hub to phone home to. Hopefully for over-the-air updates, but you never know.
Since I couldn’t get the setup protocol working, it was time to bring out the big guns. Inside the hub sits an ESP32-S3 with a soldered-on Zigbee radio, and to my surprise, the device had JTAG over USB enabled. What surprised me even more: the manufacturer hadn’t locked the chip at all. ESP32 chips can be configured to only run firmware signed by the manufacturer and to keep their storage encrypted. Both features were switched off. Just think (ahead, hihi) about the possibilities…
Welcome to the machine
Every good development project starts with a name, and considering that naming things is still one of the hardest problems in our industry, we found one surprisingly quickly. Brace yourselves: Roger Waters was born (any resemblance to the Pink Floyd singer is purely coincidental).
Development was incredibly easy, since the ESP32 family has a great community and a solid ecosystem of libraries, so we didn’t have to reinvent the wheel. The only thing nobody had documented was how the main chip talks to the Zigbee radio, so we wrote a tiny firmware whose only job was to try pin after pin until the radio finally answered. Not elegant, but it worked. With Claude’s help, the first iteration came together quickly: connecting to the moisture sensor, receiving its data and sending the first few alerts to our Teams channel.

Once the data was flowing, our next enemy turned out to be our own Teams channel. A sensor hovering around the threshold will happily send you ten “thirsty” messages an hour, and after the third one my colleagues were already asking me to tune it down. So Roger had to learn some manners: a plant only counts as thirsty after half an hour below the threshold, it gets at most one reminder every six hours, and Roger only plays during office hours. Nobody needs a 3 a.m. gig.
Doing what the manufacturer didn’t
With the plants taken care of, we added the things we would’ve loved to see from the manufacturer in the first place.
First of all: updates. Roger only installs updates that come out of our own release pipeline and are signed by it. Anything else gets rejected, even if someone on our network tries to upload it. That’s exactly the question we couldn’t answer for the original firmware.
We also went a bit overboard with the build pipeline. Our builds are reproducible, so the same source code always turns into the exact same binary, and we can prove what’s actually running on the hub. Every release ships with an SBOM, a list of every library inside the firmware, which gets checked against known vulnerabilities every weekday. If a new CVE shows up in one of them, we know before anyone has to ask.
And the best part: all of it runs on our own hardware and network, no cloud account needed.
Why all the hassle?
Good question. Mostly because we can, and it was a fun little side project. On a serious note, though, I think this little detour shows perfectly why the Cyber Resilience Act, and every other effort to make secure development the standard, matters so much. To this day, we still don’t know what the manufacturer’s original firmware really did, what data it would have sent home, whether its OTA updates were signed, or whether we could have become the target of a cyber attack down the line. With Roger Waters running, we can now sleep in peace, knowing our plants stay comfortably moist and our data stays secure.
Disclaimer: All names and references in this post are just for entertainment purposes. We don’t endorse the political views of any person mentioned.