2.1 File Based Encryption
Starting with Android 7.0, users can encrypt the userdata partition with FBE instead ofFDE. Technically Android’s FBE is implemented as a feature of the ext4 FS. The basic element in ext4 is an inode, which represents and stores metadata of a file or folder. Metadata include modify, access, create or change (MAC) timestamps, ownership information, size and a generation ID. File and folder names are not stored in an inode structure and are hence not present unencrypted. Inodes hold pointers to the content data and to more metadata called extended attributes. The extended attributes are used to store data of filesystem extensions. In the case ofFBE they also manage important data for the encryption. Other important metadata for our work is the generation ID. Generation IDs are used on NFS to distinguish new files reusing an inode from an older, already deleted file. The combination of an inode and generation ID is unique for the filesystem’s lifetime. File and folder names are only part of a folder’s content
data. Figure 1 shows a simplified example of a folder containing a file. The content data of a folder is a list of names and inode reference. These entries define the name of child files/folders and link to their inode. This allow to nest folders and to build up the filesystem structure. With FBE the content of each file or folder gets encrypted with an individual per-file-key. Since file names are the content data of the parent folder, all names of files in the same folder get encrypted with the same key, namely the parent folders per-file-key. The per-file-key of a file is inherited from a master key.
For this process the extended attributes hold a random nonce and a key descriptor defining which master key to use. The per-file-key is the result of the encryption using AES128ECB of the nonce with the master key. In our experiments AES256-XTS is used to encrypt the content data ofa file with the per-file-key. For the folder entries AES256-CBC-CTS is used with the per-file-key of the folder to encrypt the file and folder names. There are two master keys in a single user Android system.
One is used for files which are needed after booting the device without unlocking to support basic functionality like emergency calls. These files are called device encrypted (DE). The DE master key is tied to the physical device. The second master key is for files which are only usable after unlocking