Skip to content

fix(webauthn): verify assertion against stored signature count - #20029

Open
Sudhakar7J wants to merge 1 commit into
spring-projects:mainfrom
Sudhakar7J:fix/webauthn-stored-signature-count
Open

Sudhakar7J wants to merge 1 commit into
spring-projects:mainfrom
Sudhakar7J:fix/webauthn-stored-signature-count

Conversation

@Sudhakar7J

Copy link
Copy Markdown

Summary

Webauthn4JRelyingPartyOperations.authenticate(...) built the webauthn4j CredentialRecord from the stored attestation object, so webauthn4j compared the assertion's signCount against the registration-time value instead of the latest value persisted after each successful authentication. The stored signatureCount was written but never used for verification, disabling clone detection for authenticators that implement a signature counter.

Fix: build the CredentialRecord with the stored signature count, carrying over the attestation statement, UV/BE/BS flags, attested credential data, extensions, and transports.

Changes

  • Webauthn4JRelyingPartyOperations.java: build CredentialRecordImpl via the explicit-parameter constructor with credentialRecord.getSignatureCount().
  • Webauthn4jRelyingPartyOperationsTests.java: regression test asserting the counter passed to webauthn4j is the stored value.

Testing

./gradlew :spring-security-webauthn:test

Result: BUILD SUCCESSFUL (full module suite). New test:
authenticateThenWa4jCredentialRecordUsesStoredSignatureCount.

Related

Checklist

  • Regression test added
  • No unrelated changes

Webauthn4JRelyingPartyOperations built the webauthn4j CredentialRecord
from the stored attestation object, so the counter check compared the
assertion's signCount against the registration-time value instead of the
latest value persisted after each successful authentication. This
disabled clone detection for authenticators that implement a signature
counter.

Build the CredentialRecord with the stored signature count, carrying over
the attestation statement, UV/BE/BS flags, attested credential data,
extensions, and transports. Add a regression test asserting the counter
passed to webauthn4j is the stored value.

Fixes spring-projectsgh-19994

Signed-off-by: Sudhakar <sudhakar.jeeva7@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

WebAuthn: authentication compares the signature counter against the registration-time value, not the stored signatureCount

2 participants