Repository navigation
Security: keep enrolled LUKS2 tokens from passing LUKS key checks - #275
Merged
Merged
Conversation
cryptsetup open --test-passphrase tries every enrolled LUKS2 token that needs no PIN (TPM2, FIDO2, keyring) before the key it was given, and reports the token's slot whatever that key was. First-boot owner provisioning, the Apple re-key verification, factory reset and omarchy-drive-password all used it to decide whether a password opens the disk and which slot holds it, so a token a previous owner left behind passed for any password: setup could record the token's slot as the owner's and never add the owner's password. Key checks now allow only a token type no token has, or compare the slot a key opens with the slot it should hold. Slot listings read only luksDump's Keyslots section, since a luks2-keyring token line looks like a keyslot.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Security fix for the frozen branch. It is the same fix as omacom#549.
cryptsetup open --test-passphrasetries every enrolled LUKS2 token that needs no PIN (TPM2, FIDO2, keyring) before the key it was given, and reports the token's slot whatever that key was. Here it decided which slot a password opens and whether it opens the disk:luks_slot_forinomarchy-provision-owneromarchy-drive-password(including Change the root LUKS key before syncing login and root passwords #272's checks)A token a previous owner left behind therefore passed for any password. Provisioning could record the token's slot as the owner's, and the generic re-key could keep only that slot and kill the owner's new one. Slot listings also counted
luks2-keyringtoken lines as keyslots, including inomarchy-apple-silicon-boot-check.Key checks now pass
--token-type passphrase-only(a type no token has), or compare the slot a key opens with the slot it should hold. Slot listings read only theKeyslots:section.luks_slot_fornow also runs cryptsetup underLC_ALL=C, since it parses cryptsetup's English output.Testing
drive-password-test.shruns against a real file-backed LUKS2 volume with an importedsystemd-tpm2token and a liveluks2-keyringtoken, whose key is in the session keyring. The test first shows that a bare open with a wrong key reports the token's slot. It skips where the kernel keyring is out of reach.luksDumpparse../test/allas a non-root user in an arm64 Arch container (cryptsetup 2.8.8, seccomp unconfined so the live token runs): the only failures are the same 4 environment failures asorigin/main(no omarchy-pkgs checkout, Plymouth publish). The targeted files were rerun after the last test additions.Second review: no problems found in the production code. The two missing tests it raised (the slot listing in
omarchy-provision-owner, and the resumed-run owner check) were added. Fable re-check owed.