Skip to content

Make acceptable AAGUID ckeck in WebAuthn stricter#48404

Merged
pedroigor merged 3 commits into
keycloak:mainfrom
rmartinc:issue-48388
Apr 27, 2026
Merged

Make acceptable AAGUID ckeck in WebAuthn stricter#48404
pedroigor merged 3 commits into
keycloak:mainfrom
rmartinc:issue-48388

Conversation

@rmartinc

Copy link
Copy Markdown
Contributor

Closes #48388

PR to make the AAGUID check in WebAuthn strict. Previously we were accepting some corner cases that allow to inject the AAGUID from an untrusted source. The PR also limits the AAGUID to not include the none attestation (which is also untrusted). Normally the none format anonymizes the AAGUID to the zero AAGUID, so it's totally useless. I added a note as notable change, but it's between notable and breaking, a proper configuration is OK, but maybe some weird configurations can fail (like allowing none with the zero AAGUID as accepted, it's useless, you are accepting any authenticator with no attestation). I can move the note to a breaking change if you think it's more a breaking change than a notable one. The note is for 26.6.2, I'll move it if not ready for the new version. Tests added but in the old TS, we need to disable the trust-store for keycloak and that is going to be complicated in the new TS. So I prefer to not do it for this PR.

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.forms.MultipleTabsLoginTest#testWithAuthSessionExpiredInTheMiddle_badRedirectUri

Keycloak CI - Forms IT (chrome)

org.opentest4j.AssertionFailedError: Expected ErrorPage but was localhost (https://localhost:8543/auth/realms/test/login-actions/authenticate?execution=0bec3531-f144-465f-97c8-6d8b0e3584a5&client_id=test-app&tab_id=LZ6NbdjwwOM&client_data=eyJydSI6Imh0dHBzOi8vbG9jYWxob3N0Ojg1NDMvYXV0aC9yZWFsbXMvbWFzdGVyL2FwcC9hdXRoIiwicnQiOiJjb2RlIn0) ==> expected: <true> but was: <false>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertTrue.failNotTrue(AssertTrue.java:63)
	at org.junit.jupiter.api.AssertTrue.assertTrue(AssertTrue.java:36)
...

Report flaky test

org.keycloak.testsuite.authz.PolicyEvaluationTest#

Keycloak CI - Base IT (3)

org.opentest4j.AssertionFailedError: expected: <PERMIT> but was: <null>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
...
org.opentest4j.AssertionFailedError: expected: <PERMIT> but was: <null>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
...
org.opentest4j.AssertionFailedError: expected: <PERMIT> but was: <null>
	at org.junit.jupiter.api.AssertionFailureBuilder.build(AssertionFailureBuilder.java:151)
	at org.junit.jupiter.api.AssertionFailureBuilder.buildAndThrow(AssertionFailureBuilder.java:132)
	at org.junit.jupiter.api.AssertEquals.failNotEqual(AssertEquals.java:197)
	at org.junit.jupiter.api.AssertEquals.assertEquals(AssertEquals.java:182)
...

Report flaky test

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@mabartos mabartos self-requested a review April 23, 2026 13:24
@rmartinc rmartinc requested a review from tnorimat April 23, 2026 17:29
@rmartinc

Copy link
Copy Markdown
Contributor Author

@tnorimat I have added you as a reviewer. Your review would be awesome if you have time. If not, don't worry.

@tnorimat

Copy link
Copy Markdown
Contributor

@rmartinc Hello, yes I will review the PR soon.

@tnorimat tnorimat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmartinc Hello, I added minor comments. Could you check them?
Also, it seems that you implemented the tests by arquillian integration test. Is that OK?
It seems that it might be better to implement the tests by new JUnit test.

@rmartinc

Copy link
Copy Markdown
Contributor Author

Thanks @tnorimat! Added the two suggestions. Regarding the tests, yes, it's better to use the new TS. But some of the new tests need to disable the keycloak trustmanger (chrome virtual webauthn authneticator uses a self-signed certificate). In the old TS we do it using a method in the testing API, but that is complicated in the new TS. We have to add that to the new TS before, so I decided to not move this class to the new TS for this PR.

@tnorimat

Copy link
Copy Markdown
Contributor

@rmartinc Thank you for the clarification why using old arquillian integration tests. Yes please keep it.

@tnorimat tnorimat left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mabartos mabartos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmartinc Thanks for the PR! But I think it's the responsibility of the admin to properly set it up the policies. AFAIK, there's no negotiation of the attestation conveyance on the authenticator level, but tied to the policies themselves.

Would it be possible to add some validation even on the admin console to deny this case? Because otherwise the admin is able to set the denied case for policies, but the user will face the error. I think it's better to have some more boundaries here. If we provide just console validation, the existing realms should not be affected at all - or potentially consider to validate it on the server level when accepting these policies.

WDYT?

@rmartinc

Copy link
Copy Markdown
Contributor Author

@mabartos I modified the admin console to not allow none if acceptable AAGUIds are defined. Does this work for you?

Comment thread js/apps/admin-ui/src/authentication/policies/WebauthnPolicy.tsx
@rmartinc

Copy link
Copy Markdown
Contributor Author

Maybe this conflicts with #46960, so better wait the other to be merged and then move this one forward. Let's see if there is a conflict finally.

@mabartos mabartos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmartinc Please try to rebase it as the issue #46960 is already closed.

I see the build failure after the rebase.

Comment thread js/apps/admin-ui/src/authentication/policies/WebauthnPolicy.tsx

@mabartos mabartos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rmartinc LGTM, just a few nitpicks.

Comment thread docs/documentation/upgrading/topics/changes/changes-26_6_2.adoc Outdated
Closes keycloak#48388

Signed-off-by: rmartinc <rmartinc@redhat.com>
…one in admin console

Closes keycloak#48388

Signed-off-by: rmartinc <rmartinc@redhat.com>
Closes keycloak#48388

Signed-off-by: rmartinc <rmartinc@redhat.com>

@mabartos mabartos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Once CI passes, I'm ok with this. @rmartinc Thanks!

@keycloak-github-bot

Copy link
Copy Markdown

Unreported flaky test detected

If the flaky tests below are affected by the changes, please review and update the changes accordingly. Otherwise, a maintainer should report the flaky tests prior to merging the PR.

org.keycloak.testsuite.model.user.UserModelTest#testAddDirtyRemoveFederationUsersInTheSameGroupConcurrent

Keycloak CI - Store Model Tests

org.opentest4j.MultipleFailuresError: 
Multiple Failures (2 failures)
	java.lang.NullPointerException: <no message>
	org.infinispan.commons.IllegalLifecycleStateException: Cache container has been stopped and cannot be reused. Recreate the cache container.
	Suppressed: java.lang.NullPointerException
...

Report flaky test

@keycloak-github-bot keycloak-github-bot Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unreported flaky test detected, please review

@pedroigor pedroigor merged commit e03bc86 into keycloak:main Apr 27, 2026
86 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[CVE-2026-6856] Acceptable AAGUID policy bypass via packed self-attestation in WebAuthn registration

4 participants