fastboot oem sha1sum

Jan 04, 2017 • Roee Hay

In the January 2017 Android Security Bulletin, Google provided a patch to CVE-2016-8462, an interesting vulnerabiltiy in the Pixels’ bootloader. I reported this issue to Google last December, but unfortunately got beat by Jon Sawyer (@jcase) and Sean Beaupre (@firewaterdevs), who reported it in October, so kudos to them!

Google Pixel’s bootloader contains a proprietary fastboot oem command (‘sha1sum’). This command accepts 3
arguments: partition name, size and offset, with the constraint that size >= offset. Thus, a physical attacker, a
malicious charger or a malicious host (with ADB access – that can reboot the device to the bootloader) can easily
compute the preimage of the first bytes of any partition. This may allow the attacker to leak sensitive information
out of the device. In addition to the first bytes, one can conduct a preimage attack of higher offsets if a specific
pattern is (approximately) known , such as a known suffix or a prefix.
What you can see below is the output of two
runs of my PoC against the board_info partition. The first run leaks bytes 0-7 (“HTC-BOAR”) and the second run
leaks bytes 158-161 (“\xA2\x80\x00\x00”)