Repository navigation
Count a malformed PIN of the right length as a wrong PIN - #53
Open
FlorianFranzen wants to merge 2 commits into
Open
FlorianFranzen wants to merge 2 commits into
FlorianFranzen wants to merge 2 commits into
Conversation
FlorianFranzen
force-pushed
the
feat/malformed-pin-retry
branch
from
October 9, 2026 12:21
bf1ac2b to
2a267d6
Compare
Contributor
Author
|
Revised the second commit after testing the branch against the host tools: the new PIN of RESET RETRY COUNTER was validated before the PUK was compared, which answered 6A80 to the all-FF PUK and all-FF new PIN that ykman's |
FlorianFranzen
added a commit
to FlorianFranzen/piv-authenticator
that referenced
this pull request
Oct 16, 2026
This branch has not been deployed
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.
A malformed PIN of the right length (for example eight 0xFF bytes) was rejected by VERIFY as a format error without touching the retry counter. It is now handed to the verification: it can never match the stored PIN, so it burns a retry exactly like a wrong PIN does on a YubiKey. Clients (yubikey.rs, ykman) exhaust the retry counter before RESET exactly this way.
For that reasoning to hold, every stored PIN has to be well formed. CHANGE REFERENCE DATA already validates new PINs; RESET RETRY COUNTER did not, it stored the raw bytes. The second commit makes it validate the new PIN the same way, so a malformed PIN can no longer be stored by any path, and the asymmetry (VERIFY accepts any 8 bytes, the setters do not) is documented in a comment.
Tested in
command_response.ron: two malformed verifications report 2 and 1 remaining, the correct PIN still verifies and resets the counter; a RESET RETRY COUNTER with a malformed new PIN is rejected with IncorrectDataParameter.