UEFI Secure Boot on the Raspberry Pi
linux.it
linux.it
* Instead of having all boot related files (start4.elf, kernel.img, ...) on the first partition of the SD card, you instead have a single boot.img FAT image containing those files instead.
* You sign that file with your own RSA 2048 key and place a boot.sig containing the signature next to the boot.img file.
* You flash the Pi4 EEPROM and include your public key and some additional EEPROM settings.
* You instruct the EEPROM to burn the hash of your public key into the Pi's OTP memory. Once that's done, the key cannot be changed and the Pi will not boot into anything not signed with your key.
* Optionally you can also place keys for disk encryption into the OTP memory and use that to encrypt everything except the boot files. That way it should be pretty hard to access them as you cannot run a rogue OS to read the OTP memory due to secure boot.
References:
* https://github.com/raspberrypi/usbboot/blob/master/secure-bo...
* https://github.com/raspberrypi/usbboot/blob/master/docs/secu... (441KB PDF)
[1] https://www.raspberrypi.com/documentation/computers/raspberr...
[1] https://github.com/raspberrypi/usbboot/blob/master/secure-bo...
I'd rather prefer alternative like say device have private key that can be used to validate device's "authenticity", and that key is:
* unavailable if device is not booted via secure boot
* resetted if you reset secure boot to turned off
Then:
* software can use it as "device key/license key" for proprietary applications, acting as mini-HSM akin to TPM; sign the generated public key with company's cert on device production and if it ever gets put out of the secure mode, byebye license.
* no total bricking, no landfill, hackable devices.
Documentation states: WARNING: Modifications to OTP are irreversible. Once revoke_devkey has been set it is not possible to unlock secure-boot mode or use a different private key.
However, that does still have value. Let's say (one dramatic example) that I'm imprisoned. The government so generously agreed to let me use my phone for an hour, but managed to use an exploit to install a keylogger for when I enter in my PIN code (an actual marketed feature of GrayKey). I can simply forcibly reboot the phone using the hardware reset, and then enter my PIN code knowing that their attempts to log my PIN code have failed.
This is especially important for things like smartphones. Yes, you can't boot other Operating Systems on your iPhone and there's no way to disable that. On the other hand, there's no way for a hostile government, or just your crazy ex, to permanently bug your device either. They can, of course, use various methods to try to re-infect your device after each reboot but it's hit-or-miss, especially as the bugs get fixed.
That may work in case of Android or iOS as a whole package (or not) but all e-fuses achieve is that some fixed boot ROM bootloader loads and checks the next stage of boot code against some key and runs it. That's all. All the rest of the verification rests on the mountain of buggy code down the road.
It doesn't guarantee anything else you mentioned. If you ever signed and published a bootloader stage that has bug/fetaure allowing the attacker to bypass signature checking on any code further down, the whole scheme becomes completely useless.
For guaranteeing clean code, all you need to do is to boot clean code. :) Hardware has to reliably allow you to force boot from external storage without running any code that the attacker could have modified. That's all. Very simple and reliable. Some phones allow this. Some SBCs do allow this, too.
[Hopefully] "secure boot" is strictly less reliable and less optimal and much more complicated than this, with way more opportunities to be bitten by bugs in its implementation.
Many of us first encountered them on the Xbox 360, where their use is documented in detail here: https://free60.org/Hardware/Fusesets/
The short version is a signed firmware can be programmed to not boot if more than X amount of fuses are burned, so when a change occurs that the vendor wants to ensure can't be downgraded they just increase that number and burn fuses as part of the update process. Older versions fail the check and crash themselves. There is a hardware modification that can be done to prevent fuses from being burnt but that obviously has to be done before the update.
...and you are malicious actor wanting to put a backdoored system in
...you could just get the new rPi in it, that's not blocked.
See page 5 of the following document, it is the Level 2 protection that's irreversible: https://www.st.com/resource/en/product_training/STM32F7_Secu...
The PIC32 MCUs I use always allow you to reverse the protection, after erasing the device.
Normal users care about secure boot because it protects their disk encryption.
The point of secure boot is to make sure it's only our firmware running, and only our firmware connecting to our backend with the appropriate keys. Anything else is a security nuisance at best and an company killing problem at worst.
We're willing to sacrifice the SoC in those cases. Your mileage may vary.
Second, you're creating e-waste when you go out of business. This is not something that should be legal.
I'm really disappointed that Raspberry Pi didn't implement hardware protection of the efuses, using the method I described above, or one similar to it. So a jumper would have to be installed, in order to supply power for blowing the fuses.
Many Allwinner SoCs have a separate VPP pin, without power supplied to this pin, it's not possible to blow the fuses. I wish the rest of the industry did that.
Notably AMD Ryzen CPUs can have their efuses blown in the field, if the Platform Security Processor is compromised: https://www.servethehome.com/lenovo-vendor-locking-ryzen-cpu...
It's just another way malware could compromise your hardware, this time physically disabling it. I'm sure malware authors might end up putting this to use somehow. And that's why the hardware should have this feature disabled by default. It should not be possible to damage hardware through software, period. There must be hardware protection against this, in a well designed system. Anything else is negligence, in my opinion. In the event of malware causing CPUs to be bricked, AMD should be held liable for the costs of replacing the processors, as they should have had foreknowledge of this occurring, when they designed the processors?
Ampere Altra ARM processors have a separate pin for efuse power, you can find that in their datasheet below on page 55, and they explicitly state to pull it to ground if you do not want to use it: https://d1o0i0v5q5lp8h.cloudfront.net/ampere/live/assets/doc...
Sadly there are no desktop-class Ampere CPUs yet. But that might change in the future.
So it's still useless, but... less useless than before? And maybe that means it'll get to a point where useful models are available again soonish?
It's back up to $99 now (I got it discounted). It works fine.
https://www.amazon.com/dp/B0BHP34TH1?ref=ppx_yo2ov_dt_b_prod...
Does it do that transparently, maybe when the keys are enrolled?
Stop some ways supply chain attacks can happen.
Probably some other use cases I've not considered too.
However, let's say that the said industrial equipment is stored in a security box, with tamper-resistant screws, and you are on camera. It's a lot harder to tamper with then, compared to just plugging in a flash drive and rebooting the Pi into USB boot; at least in theory. Ditto for helping to prevent persistent remote attacks.
It's not a powerful device for hosting databases, it's not really used for storage, only for small things like a Kodi server and even that lags.
[1]: https://www.kernel.org/doc/html/latest/gpu/v3d.html
[2]: https://wiki.debian.org/RaspberryPi4#Using_EFI_Firmware_and_...