TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Pwn the ESP32 Forever: Flash Encryption and SEC. Boot Keys Extraction

216 pointsby wolframioover 5 years ago

13 comments

jwsover 5 years ago
Synopsis: Secret keys are embedded in the device&#x27;s e-fuses and are not readable by normal means because of a protection e-fuse. By measuring current draw during power up an interval is determined to be the time when the CPU is reading the e-fuses. At that time the power supplies are &quot;glitched&quot; from 3.3v to 6v using unspecified patterns from a signal generator. This causes errors in the e-fuse reading, one of which is to make a bank of read protected fuses readable. The read values have errors in them, but multiple runs and statistical error correction can retrieve the actual values.<p>Physical access to the device is required. Security compromise is permanent.
评论 #21600807 未加载
评论 #21600800 未加载
LeifCarrotsonover 5 years ago
This is an interesting attack, and certainly looks highly successful in terms of allowing a determined hardware hacker to gain root&#x2F;bootloader access to a device that the manufacturer has attempted to lock them out of. Glitching with a 6V supply on a 3.3V bus is certainly something I&#x27;d want to be a little cautious of if the hardware was more expensive than a $10 dev board - I wouldn&#x27;t buy a $800 IoT fridge and use this to install alternate firmware just for fun, but it&#x27;s nice to know it&#x27;s possible in case my fridge stops working because the manufacturer declares it end-of-life. It&#x27;s just not clear to me if or how this is a bad thing. The author writes:<p>&gt; <i>This FATAL exploit allows an attacker to decrypt an encrypted firmware because he is now in possession of the AES Flash Encryption Key.</i><p>&gt; <i>Worst case scenario, he is now able to forge his own valid firmware (using the Secure Boot Key) then encrypt it (using the Flash Encryption Key) to replace the original firmware PERMANENTLY.</i><p>&gt; <i>This last post closes my security investigation on ESP32, which I consider now as a broken platform.</i><p>Isn&#x27;t that a good thing for me as a consumer? I like the ability to decrypt and modify my own devices. I like that this is a permanent modification, unlike eg. dd-wrt where you have to prevent the bootloader from overwriting your software with that of the manufacturer.<p>The only thing I can think of that would be really bad is if I had a device with an ESP32 inside physically stolen then reinstalled by an attacker (or a counterfeit sold to me with malicious code from the vendor) and this exploit allowed them to get private data from my network to an Internet location. But they could already just buy or build their own device, ESP32 or not, to do that.<p>This is only bad for draconian IoT manufacturers who want to enforce their terms of service and artificial limitations on hardware they think consumers are leasing but consumers think they are buying.
评论 #21600943 未加载
评论 #21599945 未加载
评论 #21602357 未加载
评论 #21600154 未加载
评论 #21600165 未加载
评论 #21602453 未加载
wiremineover 5 years ago
Some additional info is in Espressif&#x27;s notification (CVE-2019-17391) which is linked to in the write up: <a href="https:&#x2F;&#x2F;www.espressif.com&#x2F;en&#x2F;news&#x2F;Security_Advisory_Concerning_Fault_Injection_and_eFuse_Protections" rel="nofollow">https:&#x2F;&#x2F;www.espressif.com&#x2F;en&#x2F;news&#x2F;Security_Advisory_Concerni...</a><p>The fix is in ESP32-D0WD-V3 and ESP32-WROVER-E, but of course that doesn&#x27;t do you any good if you&#x27;ve already shipped product.
评论 #21600531 未加载
gorgoilerover 5 years ago
Something about e-fuses seems quite mystical. The idea of a computer program deliberately and permanently damaging its own hardware (or hardware it is attached to) using a mechanism so close to regular operation (current flowing in memory) but for a good reason rather than to cause harm, and in such an information rich way.<p>Different to say a robotic tool using its tooltip to maim itself and different to one robot building another, because at the e-fuse level of detail it’s so much more information sense.<p>Perhaps it’s like a tattoo? Perhaps I’m thinking of the ship tattoos in <i>Surface Detail</i> by Iain M Banks?
评论 #21601642 未加载
planteenover 5 years ago
I&#x27;ve heard e-fuses in general are vulnerable to optical inspection under polarized light after deliding a part. So if someone capable really wanted to clone a device, it&#x27;s very possible they already were able to get the e-fuse key values.<p>I once used the e-fuse feature of another part for bootloader integrity. I wasn&#x27;t worried about encryption, but the part would validate the bootloader integrity when encrypted. If integrity failed, the part would keep searching for a valid image. It was an easy way for some protection against flash corruption.
评论 #21603666 未加载
andrewstuartover 5 years ago
I believe this requires physical access to the MCU.
评论 #21599885 未加载
评论 #21599890 未加载
_defover 5 years ago
I didn&#x27;t even know the ESP32 had these security capabilities, but I guess I&#x27;ve not been missing out ;)
chliover 5 years ago
From the article:<p><i>&gt; I quickly identify a pure HW processing 500us before the beginning of the UART ascii strings ‘ets June 2018’ corresponding to the BootROM process.<p>&gt; This HW activity is probably the eFuses Controller initialisation, and a load of the eFuses values in some dedicated buffer memory, to be used by the Flash controller for further steps).</i><p>How one would come to this specific conclusion without having any prior knowledge of the boot rom ?
评论 #21605291 未加载
MrBuddyCasinoover 5 years ago
Props for the effort, but who expects a cheap china MCU for consumer products to be resilient against glitching attacks? You don’t use that stuff in high-security settings anyway. For consumers products resilient to advanced hardware attacks, I can only think of the iPhone and some consoles. Anything else?
评论 #21600117 未加载
评论 #21602752 未加载
评论 #21599986 未加载
traversedaover 5 years ago
If you&#x27;re interested in this problem space you should definitely check out the chip whisperer. They make some great hardware for doing this kind of test.<p><a href="https:&#x2F;&#x2F;newae.com&#x2F;tools&#x2F;chipwhisperer&#x2F;" rel="nofollow">https:&#x2F;&#x2F;newae.com&#x2F;tools&#x2F;chipwhisperer&#x2F;</a>
kbumsikover 5 years ago
I&#x27;m wondering, how many companies that use ESP32 actually use the firmware security feature?
评论 #21600907 未加载
评论 #21600085 未加载
throwaway77384over 5 years ago
Could this get around a locked bootloader on a Sony Xperia Z5 Compact? (As in, the normal sony-website-enabled bootloader unlock NOT allowed when checking in service menu)<p>If so, there might be a bounty out for it...
crankylinuxuserover 5 years ago
Permanent ownership of device that was previously under control from another is now enforced.<p>Regaining control of your stuff is essential.