sk-usbhid: preserve UV requirement for resident keys - #701
sk-usbhid: preserve UV requirement for resident keys#701savely-krasovsky wants to merge 1 commit into
Conversation
When loading resident credentials, derive SSH_SK_USER_VERIFICATION_REQD directly from the credential's credProtect policy. The previous code only preserved the flag when the authenticator did not report the uv capability. As a result, UV_REQUIRED credentials downloaded from authenticators with built-in UV were saved with flags 0x21 instead of 0x25. Do not make preservation of the credential policy depend on the authenticator's current UV capability. Keep compatibility with libfido2 versions without fido_cred_prot().
|
okay I dug a little appanrently this is a case of nice idea, with not the best of executions. the idea was to skip pin prompts on keys with UV but:
in my opinion, the choice on whether to specifically ask for a client-side PIN should not be in the key stub to begin with, just the info on whether the credential needs User verification(generic) or not. with the method to be used being something that should solely be chosen at the point of authentication. At this point one could check
and if the answers are specifically both yes, no and no, then to skip asking for PIN, even if the credential says I want UV. obvious edge case: device with ONLY internal UV (mainly things like Cryptocoin wallets with FIDO): IF UV is blocked, just fail directly. |
|
Thank you for the feedback. I agree that this UV should not have been stored in the first place, but the decision was made and now I don't think we can just drop it, at least for this exact key stub file version. People already have those files with the UV flag enforced based on the fact that the "uv" option was true at the moment they ran |
|
does it let you make credentials with UV required if the key doesnt have Cred Protect? at some point i tried using SSH with FIDO it blocked me for using a key that didnt have it. because if cred protect is required anyway, that wouldnt be a big issue, also OBVIOUSLY the server should be the one to enforce UV on the authentication anyway. also the fact to store UV requirements in the file isnt even the big "issue". the issue is that at least the change assumed "stored uv means ask for PIN", which obviously is not the point. the file can keep the info whether UV as it helps against cred protect bonking when the client isnt aware, just the idea WHICH UV is actually used should not be decided upon a file flag. so I agree with the pull request putting the UV info back and at the same time, the prompt for PIN should be revamped to check for internal UV availability. |
|
No, you cannot use ssh FIDO 2.0 keys without |
|
well if credprotect is mandatory for SSH anyway, whether the option is set in the key stub is basically not relevant anyway especially as the keystub isnt exactly the most tamper proof thing so if someone actually wants to change the flag in the keystub they likely could easily which is why these things should be enforced by the server and maybe credprotect. |
|
My change from that perspective is pretty safe I think. Logic re-haul could be a part of dedicated patchset. |
|
absolutely. your change effectively just reverses a change to make authenticators with internal UV ask for PIN less, that had (in my opinion) a bunch of oversights anyway. |
What changed
Derive
SSH_SK_USER_VERIFICATION_REQDdirectly from a resident credential'scredProtectpolicy when loading it from an authenticator.Set the flag only when the credential reports
FIDO_CRED_PROT_UV_REQUIRED, independently of whether the authenticatorcurrently advertises built-in user verification through the
uvoption.The policy check is guarded by
HAVE_FIDO_CRED_PROTfor compatibility witholder libfido2 versions.
Why
Resident credentials created with
verify-requiredstoreFIDO_CRED_PROT_UV_REQUIREDas a per-credential policy on the authenticator.During
ssh-keygen -Kandssh-add -K,read_rks()currently propagates thispolicy as
SSH_SK_USER_VERIFICATION_REQDonly when the authenticator does notadvertise the
uvcapability.As a result, authenticators with built-in user verification download
verify-requiredresident keys with flags0x21instead of0x25.The authenticator's
uvoption describes a device capability, whilecredProtectdescribes the policy of an individual credential. The credentialpolicy should therefore be preserved independently of the authenticator's
current UV capabilities.
Compatibility
Older FIDO 2.0 authenticators and credentials that do not expose a
credProtectpolicy are unaffected. In that case, libfido2 reports no matchingFIDO_CRED_PROT_UV_REQUIREDvalue, so the OpenSSH UV-required flag is not added.When OpenSSH is built against a libfido2 version without
fido_cred_prot(), policy inference is skipped. This also avoids treating thecompatibility fallback value for an unavailable
credProtectAPI asUV_REQUIRED.The change only affects reconstruction of flags while loading resident keys
through
ssh-keygen -Kandssh-add -K. Credential enrollment, signing, andnon-resident credentials are unchanged.
Validation
Built the portable tree with
--with-security-key-builtinand libfido2 1.16.Tested on an authenticator with built-in user verification:
UV_OPTIONAL_WITH_ID(0x02) downloaded withOpenSSH flags
0x21.UV_REQUIRED(0x03) downloaded with OpenSSHflags
0x25.verify-requiredand confirmed thatit downloaded with flags
0x25.verification and user presence and completed successfully.