The vulnerability, CVE-2023-43636, lies in the EVE-OS measured boot process, which failed to validate the integrity of the root filesystem (rootfs). This allowed an attacker with physical access to tamper with the rootfs without detection. The analysis of the provided patches reveals that the vulnerability was not in a specific Go function but rather in the GRUB bootloader's configuration and capabilities.
The core of the vulnerability is the absence of an integrity measurement step for the rootfs and configuration partitions during the boot sequence. The patches address this by introducing a new GRUB command called measurefs. This command is implemented in C and added to the GRUB build process. The measurefs command calculates a cryptographic hash of a given filesystem and extends a specific Platform Configuration Register (PCR) in the TPM, in this case, PCR 13.
The identified vulnerable functions, set_rootfs_root and set_config_overrides, are shell functions within the pkg/grub/rootfs.cfg GRUB configuration file. These functions are responsible for locating and setting up the root and configuration partitions during boot. Before the patch, these functions would prepare the system to boot from these partitions without verifying their contents. The patch modifies these functions to call the new measurefs command, ensuring that any modification to these partitions will result in a different PCR 13 value.
Furthermore, a second commit links this new measurement to the system's security by sealing the disk encryption key to PCR 13. The change in pkg/pillar/evetpem/tpm.go adds PCR 13 to the DiskKeySealingPCRs list. This ensures that the disk can only be decrypted if the rootfs and configuration partitions have not been tampered with, effectively mitigating the vulnerability.