Skip to content

require user presence on security key signatures - #11

Open
plotnick wants to merge 1 commit into
mainfrom
sk-user-presence
Open

require user presence on security key signatures#11
plotnick wants to merge 1 commit into
mainfrom
sk-user-presence

Conversation

@plotnick

@plotnick plotnick commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

A security key signature carries a short trailer of a flags byte and a signature counter. The authenticator folds both into the signed data, so a verifier can trust them. Bit 0 of the flags records user presence, the authenticator's assertion that somebody touched the key.

#8 verified sk signatures without looking at the flags. A signature produced without a touch, whether by a key enrolled with no-touch-required or by a purely software authenticator, was therefore accepted. Refuse those by default, as sshd does. Verifiers that deliberately accept no-touch enrollments can relax the check per verification with require_user_presence(false).

The new tests emulate an authenticator in software, which is the only way to produce a signature without user presence set. They check that a touched signature verifies end to end, and that an untouched one is refused by default but accepted under the opt-out. That acceptance shows the refusal comes from the flags rather than from a bad signature. An ignored test runs the same verification against a real key in the SSH agent:

    SSHAUTH_TEST_SK_KEY=<comment or SHA256 fingerprint> \
        cargo test -- --ignored sk_hardware

The signature counter remains unused. Authenticators without a counter legitimately report zero, so the only meaningful check would be per-key monotonicity, which needs state the verifier does not have.

🤖 Disclaimer: LLM assistance was used to find this issue and prepare this patch, but human 👀 and 🧠 reviewed it.

A security key signature carries a short trailer of a flags byte and a
signature counter.  The authenticator folds both into the signed data,
so a verifier can trust them.  Bit 0 of the flags records user
presence, the authenticator's assertion that somebody touched the key.

We were verifying sk signatures without looking at the flags.  A
signature produced without a touch, whether by a key enrolled with
no-touch-required or by a purely software authenticator, was therefore
accepted.  Refuse those by default, as sshd does.  Verifiers that
deliberately accept no-touch enrollments can relax the check per
verification with require_user_presence(false).

The new tests emulate an authenticator in software, which is the only
way to produce a signature without user presence set.  They check that
a touched signature verifies end to end, and that an untouched one is
refused by default but accepted under the opt-out.  That acceptance
shows the refusal comes from the flags rather than from a bad
signature.  An ignored test runs the same verification against a real
key in the SSH agent:

    SSHAUTH_TEST_SK_KEY=<comment or SHA256 fingerprint> \
        cargo test -- --ignored sk_hardware

The signature counter remains unused.  Authenticators without a
counter legitimately report zero, so the only meaningful check would
be per-key monotonicity, which needs state the verifier does not have.

Co-Authored-By: Claude Mythos 5 <noreply@anthropic.com>
@plotnick
plotnick changed the base branch from sk to main August 31, 2026 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant