Repository navigation
Security: keep enrolled LUKS2 tokens from passing LUKS key checks - #549
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.
…uks-token-keys # Conflicts: # bin/omarchy-provision-owner # test/shell.d/provision-owner-luks-test.sh
This was referenced Sep 25, 2026
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.
cryptsetup open --test-passphrasetries every enrolled LUKS2 token that needs no PIN (TPM2, FIDO2, keyring) before the key it was given. If the token unlocks, it reports success and the token's slot, whatever key was passed. The key checks merged in #517, #532 and #527 relied on it:install/provisioning/luks-rekey.sh, which the Apple path also uses through dispatch since Apple owner provisioning through lifecycle dispatch entrypoints #545)omarchy-drive-password's current-password and new-key checksSo a token left by a previous owner or seller passed for any password. Setup could record the token's slot as the owner's and never add the owner's password. Slot listings also parsed
luksDumpwith a pattern that matchesluks2-keyringtoken lines, so token ids were counted as keyslots, including inomarchy-apple-silicon-boot-check.What changed:
--token-type passphrase-only, a type no token has, so only the key decides.Keyslots:section. For factory reset's throwaway-slot lookup this is hardening only: the old parse still found the right slot there.On cryptsetup 2.8.8,
--disable-external-tokensalone doesn't help (the keyring token is built in), and--key-slot Nstill lets a token bound to slot N answer. Mutating verbs (luksAddKey,luksKillSlot,luksChangeKey) don't consult tokens.The same fix for the upstream-ready branches is on
upstream/47-luks-rekey-journalandupstream/47-drive-password-syncin the fork. The branch merges quattro-upstream after #545. Theomarchy-provision-ownerhunk was dropped because #545 removedrekey_luks_apple, and the Apple token tests were ported to #545's dispatch harness.Testing
luks-rekey-journal-test.sh(full first-boot provisioning) anddrive-password-test.sh. Each uses a file-backed LUKS2 volume with an importedsystemd-tpm2token and a liveluks2-keyringtoken, whose key is in the session keyring. Each run first shows that a bare open with a wrong key reports the token's slot, then checks that setup and the password change accept only real keys. Where the kernel keyring is out of reach (nokeyctl, or Docker's default seccomp profile) they print a skip line.luksDumpwith TPM2 and keyring token lines. On the Apple dispatch path, they cover:./test/allas a non-root user in an arm64 Arch container (cryptsetup 2.8.8), with Docker's default seccomp profile and with seccomp unconfined, pluspackages/omarchy-mac/boot/test/all(119 ok), after the merge. The only failures are the same 5 that base fails (no omarchy-pkgs checkout, Plymouth publish, and the flakysystem-sleep-ownership-migration-test.sh).Second review: no problems found in the production code. It confirmed the cryptsetup behaviour and that no token-blind key check is left. Test gaps it raised in the mx-mac port are fixed there. A later review rated the rebase onto #545 safe.