Bypassing disk encryption on systems with automatic TPM2 unlock
Vulnerabilities in TPM2 disk encryption systems can allow attackers physical access to encrypted data. Proper LUKS identity verification and using a TPM pin are recommended to enhance security.
Read original articleThe article discusses vulnerabilities in systems using automatic disk unlocking with TPM2 (Trusted Platform Module 2) and systemd-cryptenroll or clevis. It highlights that many setups fail to verify the LUKS (Linux Unified Key Setup) identity of the decrypted partition, making them susceptible to attacks if an attacker gains physical access to the machine. The exploit involves creating a fake LUKS partition that tricks the initrd (initial ramdisk) into executing a malicious init executable, allowing the attacker to access the original encrypted data. The article emphasizes the importance of using a TPM pin or ensuring that the initrd properly asserts the LUKS identity to mitigate these risks. It also outlines how TPM2 works, detailing the role of Platform Configuration Registers (PCRs) in maintaining a chain of trust during the boot process. The author warns that many guides on setting up TPM2 disk unlocking do not address these vulnerabilities, potentially leaving users exposed, especially those using TPM for securing laptops against theft. Recommendations include implementing additional verification measures to ensure the integrity of encrypted volumes before accessing any files.
- TPM2 setups for disk encryption may be vulnerable to physical attacks.
- Attackers can exploit filesystem confusion to gain access to encrypted data.
- Using a TPM pin or proper LUKS identity verification can enhance security.
- Many existing guides do not address these vulnerabilities, leaving users at risk.
- Users should assess their threat model to determine the necessity of additional security measures.
Related
Secure Boot useless on PCs from major vendors after key leak
A study by Binarily found that hundreds of PCs from major manufacturers are vulnerable due to a leaked 12-year-old test platform key, allowing attackers to bypass Secure Boot protections.
How to verify boot firmware integrity if you prioritize neutralizing Intel ME?
Securing computer boot firmware poses challenges, especially with me_cleaner disabling TPM. Methods include using cameras, physical containers, and regular firmware checks, though detecting modifications remains difficult. Vigilance is crucial.
Authenticated Boot and Disk Encryption on Linux (2021)
Linux distributions often inadequately implement Full Disk Encryption, UEFI SecureBoot, and TPMs, leaving critical components vulnerable to attacks, unlike other operating systems that offer stronger security measures.
Almost Secure (2011)
The blog post outlines classic vulnerabilities in devices, including mass storage issues, inadequate cryptographic practices, poor input sanitization, risks from /dev/mem, and boot sequence failures that expose systems.
TPM 2.0 – a necessity for a secure and future-proof Windows 11
TPM 2.0 is essential for Windows 11, enhancing security through advanced encryption and integration with Windows features. Organizations must assess hardware compatibility and plan upgrades to ensure data protection.
- Many users express skepticism about the security of passwordless disk encryption, emphasizing the importance of using a PIN or password for added protection.
- Several commenters discuss the complexity and potential pitfalls of TPM implementations, suggesting that the process can be error-prone and vulnerable to exploitation.
- There are suggestions for improving security, such as using read-only root filesystems, integrity checks, and custom firmware certificates.
- Concerns are raised about the trustworthiness of the TPM and the implications of relying on it for security, especially regarding potential manufacturer vulnerabilities.
- Some users inquire about the applicability of these vulnerabilities in other systems, such as Windows with BitLocker, highlighting a broader concern about disk encryption security.
As soon as a volume is decrypted, initrd will write `volume-key` to PCR 15, so any further executables can no longer access the data stored in the TPM.
[0]: https://0pointer.de/blog/brave-new-trusted-boot-world.html
Then I read about the implementation details[0], and it's a complex bloody mess with an unending chain of brittle steps and edge cases, that are begging for a mistake and get exploited. So here we are.
I'm convinced that "measure the kernel" into "measure the initrd" into "show login screen" is all it should take.
Entering a password on boot isn't even that much work
Store the root hash of the dm verity formatted rootfs in the PCR. If a malicious partition is presented to initrd, its root hash will not match the trusted one stored in the TPM.
Or if you need a writeable rootfs, use fs verity and store the signature of init into the PCR. The trusted init signature won’t match signature of malicious init.
LUKS for encryption and verity for integrity/verification.
Also AFAIK there is no standard way to guess the new PCRs on reboot so you can't pre-update them before rebooting. So you either need to unlock manually or use a network decryption like dracut-sshd.
I am the author of one of the older guides https://blastrock.github.io/fde-tpm-sb.html .
I was wondering about the solution you propose which seems a bit complicated to me. Here's my idea, please tell me if I'm completely wrong here.
What if I put a file on the root filesystem with some random content (say 32 bytes), let's name it /prehash. I hash this file (sha256, blake2, whatever). Then, in the signed initrd, just after mounting the filesystem, I assert that hash(/prehash) == expected_hash or crash the system otherwise. Do you think it would be enough to fix the issue?
I personally replace the firmware certificates (PK, KEK, db, dbx, …) with my own and sign every kernel/initrd update, I also unlock my disks with a passphrase anyways, but I'm on the fence WRT if it's more secure than TPM.
Yes in theory TPM key extraction is feasible (and even easy if it's performed by a chip other than your CPU https://pulsesecurity.co.nz/articles/TPM-sniffing ) but it is harder than filming/watching you type the passphrase or installing a discrete key-logger ?
Does the default configuration not somehow tangle a user-entered password to authentication against the TPM?
That's still not perfect (i.e. how do you make PIN/password entry non-keyloggable), but anything else, in particular extending the trusted computing base to the entire kernel and the hardware it runs on and hoping that they will both be bug-free and impossible to impersonate, seems like a bad idea.
The TPM is also in a much better position to properly velocity check PIN/password entries than the OS.
So if you use this PCR state machine, the problem is that the step before initrd doesn't require the correct password to move the PCR forward? It accepts any password that decrypts the next stage, which didn't have its integrity verified here.
Seems there are multiple ways of solving this, and adding integrity checks is only one. It could also let the TPM verify the disk decryption password (when it's needed.)
Edit: never mind, I think it's still vulnerable.
I recently changed motherboard on my laptop, had the bitlocker key if not I was told I'll have to reinstall Windows all over again.
Even with the key, one must decrypt and re-encrypt.
If someone steals the NAS how easily can they get to the data? Assuming volumes are encrypted, but the are automatically mounted on boot?
How to ensure the data is safe in case of theft.
Related
Secure Boot useless on PCs from major vendors after key leak
A study by Binarily found that hundreds of PCs from major manufacturers are vulnerable due to a leaked 12-year-old test platform key, allowing attackers to bypass Secure Boot protections.
How to verify boot firmware integrity if you prioritize neutralizing Intel ME?
Securing computer boot firmware poses challenges, especially with me_cleaner disabling TPM. Methods include using cameras, physical containers, and regular firmware checks, though detecting modifications remains difficult. Vigilance is crucial.
Authenticated Boot and Disk Encryption on Linux (2021)
Linux distributions often inadequately implement Full Disk Encryption, UEFI SecureBoot, and TPMs, leaving critical components vulnerable to attacks, unlike other operating systems that offer stronger security measures.
Almost Secure (2011)
The blog post outlines classic vulnerabilities in devices, including mass storage issues, inadequate cryptographic practices, poor input sanitization, risks from /dev/mem, and boot sequence failures that expose systems.
TPM 2.0 – a necessity for a secure and future-proof Windows 11
TPM 2.0 is essential for Windows 11, enhancing security through advanced encryption and integration with Windows features. Organizations must assess hardware compatibility and plan upgrades to ensure data protection.