Summary
IncusOS configured systemd-cryptenroll to rely on a TPM policy that would release the LUKS disk key as long as Secure Boot and the expected UKI kernel image were measured, regardless of which root filesystem was actually in use.
An attacker with physical access could swap the encrypted root partition for one they control, boot the system, and run code that retrieves the original disk's LUKS master key from the TPM, enabling offline decryption or tampering with the real root disk without leaving obvious traces.
Affected context
The vulnerability affects IncusOS systems that:
- Use TPM-bound LUKS keys via systemd-cryptenroll as configured by mkosi
- Depend on Secure Boot and UKI measurements for trust, but do not strictly bind the LUKS key release to the original root filesystem
- Allow the initrd to select the root disk based solely on GPT partition identifiers
In such deployments, the TPM policy (PCR7 + permissive PCR11) allows key release after Secure Boot and UKI verification, but does not prevent the system from booting an attacker-controlled root partition that can then request the real disk's LUKS key.
Exploit preconditions
- Attack surface: Physical access while the machine is powered off (or otherwise in a state where the encrypted disk is locked).
- Required access: Ability to:
- Interact with the machine's firmware/boot sequence (e.g., boot from modified storage or attach an alternate disk),
- Swap or substitute the root partition with an attacker-controlled encrypted partition that the system will treat as the root disk.
- Trigger point: System boot with an attacker-controlled root partition whose systemd units execute early in the boot process.
- Why exploitation is possible:
- The TPM policy releases the LUKS key whenever the measured Secure Boot and UKI kernel image match expected PCR values.
- The policy does not enforce that the key can only be accessed from within the initrd or original root filesystem.
- The initrd selects the root disk by GPT partition identifiers, allowing transparent substitution of the real root volume by one under attacker control, without changing the TPM measurement state.
Why this happens
The core issue is a misbinding of cryptographic key release policy to an insufficient set of platform measurements and boot stages.
Instead of constraining TPM-bound LUKS key release to the combination of:
- Expected Secure Boot state,
- Expected UKI/kernel image,
- And the correct, trusted root filesystem context,
the default configuration bound the key only to PCR values (e.g., PCR7 and a permissive PCR11 policy) that remain unchanged even when the root partition is replaced.
This maps to CWE-522: Insufficiently Protected Credentials, because the LUKS master key—effectively a long-term credential protecting the disk contents—is exposed under conditions that are not adequately tied to the integrity of the protected resource. The trust boundary assumes "measured boot == trusted environment," but does not account for the attack surface introduced by disk substitution, allowing attacker-controlled code to legitimately request and exfiltrate the encryption key.
Potential impact
- Attacker may extract the LUKS master key for the real root disk from the TPM.
- Attacker could decrypt the original root filesystem offline and exfiltrate sensitive data (files, credentials, logs, keys).
- Attacker can modify the real root disk contents (e.g., implant backdoors, alter binaries or configuration) and then restore it to service.
- Attack may leave minimal or no obvious forensic evidence, as Secure Boot and UKI verification still succeed and the system appears to have booted normally.
- Long-term confidentiality of data-at-rest can be compromised even if the device is later updated, unless disk keys are rotated.
General mitigation guidance
Effective mitigation focuses on making TPM-bound disk keys only accessible in fully verified and tightly scoped environments, and on treating full-disk encryption keys as long-lived credentials that require strong binding to system integrity:
- Strengthen TPM policy binding:
- Bind key release to PCRs that reflect not only the Secure Boot and UKI image but also the intended boot flow, limiting use to the initrd phase or a minimal trusted environment.
- Use additional PCRs (such as PCRs measuring late boot stages) or equivalent mechanisms to ensure that the key cannot be accessed from arbitrary userspace after pivoting to a different root filesystem.
- Constrain where keys can be used:
- Design TPM/LUKS integration such that key retrieval occurs only inside the initrd or a designated early boot component, not from general-purpose systemd units on the root filesystem.
- Avoid configurations where a booted system can simply request the volume key from the TPM without verifying that it is the original, trusted root partition.
- Limit disk substitution risk:
- Treat root disk identifiers and partition selection as part of the trust model; use mechanisms that validate the root partition against known-good metadata or cryptographic assertions where possible.
- Consider operational controls (e.g., tamper-evident seals, hardware chassis locks) in environments with high physical-access risk, as technical controls alone may not fully mitigate physical attacks.
- Key rotation and recovery planning:
- Plan for periodic rotation of LUKS master keys when feasible, especially after suspected physical compromise.
- Use documented procedures to wipe and rebuild systems when suspicion arises, so that compromised keys are not reused.
How teams detect issues like this
Detecting this class of misbinding vulnerability involves both configuration-level review and code-level analysis:
- Configuration and policy review:
- Examine systemd-cryptenroll and TPM policy settings to confirm which PCRs govern LUKS key release and at what boot stages keys are accessible.
- Review initrd and early-boot configurations to determine whether key retrieval can be triggered from late boot stages or from arbitrary systemd services.
- Static and infrastructure-as-code analysis:
- Use static analysis or configuration scanning tools to flag patterns such as:
- TPM-bound disk keys that are not tied to a minimal boot environment,
- Policies that release secrets based solely on Secure Boot or kernel measurements without considering filesystem integrity.
- Integrate checks into CI pipelines for operating-system images, mkosi configurations, and provisioning scripts to ensure hardened TPM/LUKS bindings.
- Operational monitoring and audit:
- Monitor for unexpected systemd units that interact with TPM key retrieval APIs or LUKS management tools early in the boot sequence.
- Periodically audit systems for unexpected changes to partition layouts, GPT identifiers, and bootloader configurations, especially in environments where physical access cannot be tightly controlled.
- Security testing:
- Incorporate physical-access threat modeling into OS image and full-disk encryption assessments.
- Perform red-team or lab tests where alternative root partitions are introduced to verify that TPM/LUKS policies prevent key release in those scenarios.

