AOSP Foundations
4 min read

Android Verified Boot (AVB)

Understand the cryptographic chain of trust that guarantees the operating system has not been tampered with by malware.

Why Root Access is Not the Final Boss

Imagine an attacker gains root privileges and modifies the system partition. You might assume a factory reset solves the problem. But if the attacker alters the block device while the operating system is offline, traditional security tools cannot see the changes. Rootkits survive factory resets because they load before the operating system even starts. An attacker can use fastboot to reflash the boot partition with a modified kernel while the device sits in bootloader mode. To stop offline tampering, the hardware itself needs to verify the software before letting it run.

Bootstrapping Trust from Silicon

How does the device know it has not been tampered with before the operating system loads? The answer lies in establishing a Chain of Trust. The Boot ROM is a tiny piece of code permanently etched into the silicon during manufacturing. This code serves as the unchangeable anchor. Silicon-level instructions use public-key cryptography to verify the signature of the primary bootloader. Each component checks the cryptographic signature of the next component before handing over control.

We can map out this Chain of Trust to see how execution flows from immutable hardware up to the kernel.

The Boot ROM acts as the absolute anchor for the entire boot sequence. If any signature fails mathematically, the bootloader halts the process and flags the device as corrupt. Verifying small bootloaders in memory is straightforward, but verifying the entire Android system requires a centralized strategy.

Centralizing Signatures with vbmeta

Where are all these cryptographic signatures actually stored on the device? Android groups them into a specialized partition called vbmeta. This Verified Boot Metadata partition acts like a secure shipping manifest. The metadata lists the exact cryptographic hashes and public keys for the major system partitions. Instead of embedding signatures directly into large partitions, the build system centralizes them here. The bootloader only needs to verify the vbmeta partition signature once.

We can visualize how the vbmeta structure links to the other partitions on the device.

The metadata structure points outward to the physical partitions holding the operating system. Beginners often confuse vbmeta with an encrypted vault, but the partition only holds hashes and signatures.

Tip: The avbtool utility is part of the AOSP build system and can be used on host machines to inspect any Android image.

You can extract and view the public keys and hashes directly from the metadata partition.

avbtool info_image --image vbmeta.img

A common mistake engineers make is forgetting the --image flag and wondering why the tool fails to parse the file. The output reveals the precise hash trees and signature blocks locking down the system. With vbmeta cryptographically locking the partitions, what happens when a developer actually wants to modify them?

Breaking the Chain: Unlocking the Bootloader

If Android Verified Boot stops modified code from running, how do custom ROMs even work? Developers must explicitly command the hardware to ignore signature verification failures by issuing a specific fastboot command.

fastboot flashing unlock

Beginners often believe this command removes AVB entirely, but the instruction merely tells the bootloader to ignore validation errors. This fundamental change in state has permanent security implications. The device will willingly execute modified kernels and display an orange warning screen during boot. Unlocking the bootloader shifts the responsibility of trust from the hardware manufacturer back to the user.

We can model the device states and how developer commands trigger transitions between them.

The flashing command pushes the device into a transition state before fully unlocking. Unlocking tells the bootloader to proceed even if the signatures are mathematically invalid.

Warning: Unlocking the bootloader intentionally wipes user data to prevent an attacker from stealing private information after breaking the chain of trust.

This data wipe protects users from physical theft. If a thief steals a locked device and unlocks the bootloader to bypass the lock screen, the data is already gone. Unlocking also breaks trust with secure applications, disabling features like Google Pay and certain banking apps.

Android Verified Boot guarantees un-tampered execution by relying entirely on hardware anchors. The vbmeta partition keeps the cryptographic hashes organized and centrally verifiable. We know vbmeta stores a hash for the kernel, but the metadata stores a hash tree for the system partition. How can the kernel verify a multi-gigabyte partition while running without grinding the device to a halt?