Closed lionelains closed 2 months ago
After some digging, it appears that this happens only if flash corruption occurs in the rustboot header, and not in the firmware itself. If the firmware is damaged, there is always a panic(), boot will not proceed.
@imrank03 - can you help?
Sure, I'll go through the scenario and try to reproduce the issue, and I'll get back.
We encountered an issue where we modified the content at offset +112, specifically where the public key digest value
is located. rustBoot does not currently handle the integrity and authenticity
checks for this digest value effectively. As a result, even if we modify the header at offset 112 or alter the digest value, the system still proceeds with the boot process without triggering a failure.
Additionally, the rollback condition is not handled properly in the rustboot. This causes rollback attempts to fail, leaving the system vulnerable to running compromised firmware.
The panic() function, which should halt the system if all boot options are exhausted or if an emergency update fails, did not trigger as expected due to a defmt feature condition. This allows the execution to continue outside of the match
statement, leading to the BootInSuccessState being executed every time. Consequently, the compromised firmware continues to run, as the system fails to properly handle the integrity and authenticity checks or the rollback process.
When manually modifying the flash partition for the current firmware (that previously validated boot), rustboot still boots the firmware in that partition, if it has not been compiled with the
defmt
feature.Found in 8437fd2a6ebf79d68a885da895e009fafccfccee
Scenario to reproduce:
update_success()
is invoked).defmt
feature has not been enabled during build, then no panic() occurs.match
andif
statements, thus the corrupted firmware is executed.This has been reproduced on a STM32H723 board.