Breaking Secure Boot on Google Nest Hub (2nd Gen) to run Ubuntu
A stack buffer overflow in U-Boot's DOS partition detection code can be triggered by a malicious USB mass storage device that reports a block size larger than the 512-byte buffer, allowing an attacker to overwrite the return address and execute arbitrary code in the bootloader. This breaks the secure boot chain on the Nest Hub (2nd Gen) and lets a custom OS be booted from an external USB drive.
Published on fredericb.info
In this post, we attack the Nest Hub (2nd Gen), an always-connected smart home display from Google, in order to boot a custom OS.
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
How it worked
Root cause
The partition detection code allocates a 512-byte stack buffer but passes the attacker-controlled block size from the USB mass storage layer to the read function, which writes more bytes than the buffer holds.
Impact
An attacker with physical access and a custom USB device could execute arbitrary code in the bootloader and bypass signature verification, breaking the secure boot chain to run a custom OS.
What the attacker needed
Physical access to the device; custom USB mass storage device; device booted in recovery mode
How it was found
- Boot the device into USB Download mode by holding both volume buttons.
- Connect a USB mass storage device that reports a block size larger than 512 bytes.
- The bootloader reads block 0 into a fixed 512-byte stack buffer, overflowing it.
- Place a value at the right offset to overwrite the return address and redirect execution to the payload.
- The payload runs and the bootloader can be dumped or replaced.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.
When the device starts up, its bootloader reads the first block of a USB drive to look for a partition table. It reserves a fixed-size space in memory for that block, but trusts the drive's claim about how big the block is, so a fake drive can send more data than fits and overwrite nearby memory. By carefully choosing what lands there, an attacker can make the bootloader run their own code instead of the signed firmware.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.