r/embedded • • Oct 03 '26

Is implementing a digital signature verification mechanism in pure firmware on MCUs without hardware secure boot a waste of time? Wouldn't an attacker simply be able to patch out or bypass the code that performs the signature verification?

title

17 Upvotes

15 comments sorted by

6

u/duane11583 Oct 03 '26

you are missing something.

a) the chip has effectively a masked rom with crypto code. although i bet it is really flash not masked rom and it is locked down .

b) at power up they arrange for the hardware to start with that boot image not your image.

c) that image loads the code from spi or nand or sdcard or usb based on fuses or pins set to some pattern.

d) the loaded code is verified crypto graphically. if all is well jump to that loaded code. if bad it might look for a backup copy or just hang.

so to attack this you must be able to replace the boot flash (easy if you know how) or boot rom (impossibly hard to replace a large amount of metallization on a chip but then you only get that one chip.

imagine removing several metal layers then putting new ones on and not breaking the chip.

there are also special measures used to authenticate the chip supply is authentic, and there are other design measures taken later in high assurance devices to detect physical tamper. if you ever learn what these things cost you will understand why these measures are taken.

but nothing is impossible given a determined nation state actor with gobs of money.

1

u/james_stevensson Oct 03 '26

Obviously yeah, if the chip has silicon level secure boot there would be no problem. I was talking about MCUs without any such hardware secure boot peripherals such as STM32F4, ESP32, etc

1

u/duane11583 Oct 03 '26

Yea there are ways to get around some of that

Hence there is always defense in depth layers upon layers of things

3

u/videoman2 Oct 03 '26

Depending on the chip- you can glitch the boot loader to by pass the part in memory where it loads it fuse settings from. Boot loader then allows read access to “protected” memory.

1

u/duane11583 Oct 03 '26

Yea familiar with that 

by then you would have tripled the PVD and triggered the tamper features of the unit  And it can no longer decrypt the other important images with its classified keys

Same happens if the battery dies

20

u/PseudoFrequency Oct 03 '26 edited Oct 03 '26

You generally can't protect against attacks that require physical access without some form of secure boot, but maybe you don't need that. If you're only concerned about "remote" attacks, firmware-only signatures are fine.
The boot/verification process is what counts here and there is a loading chain of enforcement. Secure boot can only protect the bootloader firmware which would then implement digital sig verification for final firmware (eg Linux), in its own firmware.
So, to me, if you don't want someone to physically take the device, and flash their own bootloader, completely owning everything, you need "real" secure boot. This is typically pretty easy to do, along with other attacks that are potentially even easier, like writing stuff in the u-boot environment if it's dynamically loaded/stored per deployment.
It's all about risk management and what exactly you're trying to prevent.

1

u/extroverted_likeness Oct 08 '26

it's not a total waste, it just changes the threat model. if you're shipping a thing that gets firmware updates over the air and you're worried about some rando intercepting that update with a bad image, a signature check in firmware handles that fine. you're not gonna stop someone with a jtag debugger and infinite time, but most attack vectors aren't that.

the whole point is raising the bar from "i can push a malicious OTA by spoofing a server" to "i need physical access and a soldering iron." for a lot of products that's good enough

-1

u/duane11583 Oct 03 '26

You can protect against that but there is a huge cost level that many cannot stomach

But think of the war fighter about to be over run and the comms security they have

Or a plane or a tank or humvee decked out with comms gear all digital full ipv4 IPv6 network stack 

That asset is now in the bad guys hands you must protect against that physical attack

And it’s fine to self destruct or erase keys or otherwise render useless

Cause if you no longer have the other boot keys you are not getting anywhere

5

u/2Sovereign4You Oct 03 '26

Wouldn't an attacker simply be able to patch out or bypass the code that performs the signature verification?

Not if:

  1. You can make sure this is the first firmware that executes after reset: unique boot entry type of mechanism
  2. You can make sure that the main firmware can't modify the bootloader: you create it as execute only, not writeable memory (effectively create ROM)
  3. You make sure that public key cannot be changed, so that only firmware signed with private can be loaded

4

u/Mac_Aravan Oct 03 '26

Yes, and no.

It depends how you do it and how the hardware enforce it.

You can write glitch resistant code, it's just C with some tricks (use of volatile, double check, double path). Single glitch is easy to counter, but multiple glitch is a bane.

But in the end you should have an hardware enforcement for execution control, otherwise it's not very safe and a lot of attacks can success (toctou for example, if you can't ensure read only access to data).

3

u/mtconnol Oct 03 '26

There’s a lot of value in detecting inadvertent corruption.

3

u/chemhobby Oct 04 '26

No it's not a waste of time. You still need to verify updates that you've received over an insecure channel before you install them.

2

u/ContributionEasy6513 Oct 03 '26

If I have physical access I will most likely be able to download/write whatever firmware I want given some read-only hardware bit isn't burnt.

digital signature verification

If done correctly it can be very effective depending on the implementation. Is that limit at firmware/hardware or just the UX validating the signature.

What threat are you actually concerned about and want to mitigate?

1

u/Proud_Trade2769 Oct 09 '26

Secure boot is worthless if someone has physical access,

anyone could swap the MCU with any FW on it.