Types for the chain of trust: no (loader) write left behind

A PhD thesis by Rebecca .bx Shapiro (@bxsays)

Advised by Sergey Bratus and Sean W. Smith

Alice in bootlaoderland


The software chain of trust starts with a chain of loaders. Software is just as reliant on the sequence of loaders that ultimately setup its runtime environment as it is on the libraries with which it shares its address space and offloads tasks onto. Loaders, and especially bootloaders, act as the keystone of trust, and yet their formal security properties - which should be a part of any solid bootloader design - are underappreciated and not well understood. This is especially problematic given the increasing adoption of loader-based code signing and execution enforcement mechanisms. My thesis digs deeply into how loaders have failed to earn our trustworthiness and how they may continue to harbor vulnerabilities even after memory corruption vulnerabilities are well-addressed and lose their prevalence. In order to address these issues, I propose a memory region-based type system that allows us to better model loader's intentions and thus mediate its behavior. More specifically, I show how a loader's execution can be broken down into a sequence of typed phases, each semantically classified as either a bookkeeping, loading, or patching substage, while sections of memory are grouped into semantically related regions and assigned a type, based on their intended use, by which policy access decisions are made. I have demonstrated the feasibility of such a type system and policy mechanism by applying it to U-Boot, a well-known and widely-used bootloader, with minimal changes to the bootloader's implementation. In order to do so, I designed and developed an extensive bootloader instrumentation suite that makes it easier to analyze a bootloader's behaviors, construct a policy, and completely mediate operations, thereby enforcing behaviors governed by the type system's policy.