-
Notifications
You must be signed in to change notification settings - Fork 11
Description
In the following function, a 16-bit key_length value is read from SPI flash, and is then used as the size argument to a subsequent pfr_spi_read() call.
If a physical attacker has tampered with the contents of SPI flash, they could replace the key_length field with an excessively large value. If this value was larger than RSA_KEY_LENGTH_4K (512 bytes), then memory corruption will occur when copying the public key modulus from flash into RAM.
Between the first and second calls to pfr_spi_read() check key_length to ensure it is not larger than sizeof(public_key->modulus).
Edited to add: I noticed that the AST1060 uses internal flash, so it may not be possible for an adversary to tamper with the public key as described in this report. Are there other platform configurations that use external flash?