Skip to content

[ABCA] Resolve the attester key from the x5c JOSE header (X.509 trust anchors) in AttestationBasedClientAuthenticator, as done for key attestations since #51042 #52766

Closed

Description

@RastaChaum

Description

AttestationBasedClientAuthenticator (feature client-auth-abca) resolves the Wallet Provider (attester) signing key only through the kid JOSE header, looked up in the JWKS of the trust-material identity providers listed in attester_trust_idps.

A Client Attestation JWT that carries its signing certificate chain in the x5c JOSE header and no kid is rejected before any verification takes place, with Invalid attester kid: null. The x5c header is never read.

This enhancement asks for a second resolution path: when x5c is present, validate the chain against X.509 trust anchors configured on the trust-material identity provider (the mechanism introduced by #51042 for key attestations), and use the leaf certificate's public key to verify the attestation signature.

Discussion

No existing discussion. Closest related issues: #43400 ("Verify that wallet attestations are signed by a trusted entity"), #48270 (TODOs review in the authenticator), #44772 (UI for trust configuration). None of them mention x5c resolution.

Motivation

Specifications

  • draft-ietf-oauth-attestation-based-client-auth-10 (2026-07-06), §9.8, lists three ways for the Authorization Server to resolve the attester key, and names x5c first:

    The x5c header parameter conveys an X.509 certificate chain in the JOSE header of each Client Attestation. Trust is established by validating the chain against a configured trust anchor.

    The authenticator's Javadoc references draft -07, where key discovery was out of scope.

  • OpenID4VCI 1.0, Annex E: "The Authorization Server MUST verify that the Wallet Attestation is signed by an issuer that the Credential Issuer trusts for this purpose" — no constraint on kid vs x5c.

  • The European WE BUILD conformance profile for credential issuance (CS-01 v1.3, §7.4) requires it on both sides:

    • Wallet: "Convey the Wallet Provider signing certificate in the x5c JOSE header of the WIA, with intermediate certificates as needed. The Wallet Provider identity is inferred from this certificate; iss is not used."
    • Issuer: "Verify the WIA signature under the signing certificate in the x5c JOSE header, and verify that this certificate chains to a trust anchor on the Trusted List for Wallet Providers, using x5c intermediate certificates as needed."

Practical impact

The reference wallet of the WE BUILD interoperability test bed sends a Client Attestation with x5c and no kid. A Keycloak issuer therefore cannot pass the token-endpoint test cases of that profile, although the wallet is compliant with both the profile and the latest IETF draft.

Internal inconsistency

Since #51042 (release/26.8.0), Keycloak already validates x5c chains for key attestations at the credential endpoint: TrustMaterialIdentityProvider gained resolveX509Trust(...) / validateX509Chain(...), DefaultTrustIdentityProvider gained useX509 / trustedCertificates / requiredExtendedKeyUsages, and org.keycloak.crypto.X509CertificateChainValidator does the PKIX validation. AttestationBasedClientAuthenticator did not change (same file on main and on 26.7.0) and TrustMaterialRequest does not carry the chain, so the same trust configuration cannot be reused for client attestations — not even by a custom TrustMaterialIdentityProvider.

Details

Current behaviour (26.7.0, unchanged on 26.7.3 and main as of 2026-09-14)

services/src/main/java/org/keycloak/authentication/authenticators/client/AttestationBasedClientAuthenticator.java:

  • findAttesterKey(context, kid, algorithm, issuer) throws IllegalArgumentException("Invalid attester kid: " + kid) when kid is empty;
  • jws.getHeader().getX5c() is never called;
  • isConfigurable() returns false, getConfigProperties() is empty; the only per-client property is attester_trust_idps — nothing can switch to another resolution.

Proposed change

In validateClientAttestationJwt:

  1. if jws.getHeader().getX5c() is non-empty, resolve the key through TrustMaterialResolver.validateX509Chain(session, attesterTrustIdps, request, x5c, alg) (the [OID4VCI] Harden key attestation x5c certificate validation #51042 path), i.e. against the trustedCertificates / EKU of the configured default-trust identity providers; use the validated leaf public key;
  2. otherwise keep the current kid / JWKS path;
  3. fail with invalid_client_attestation when neither resolves.

When both kid and x5c are present, prefer x5c (the WE BUILD profile states the attester identity is inferred from the certificate).

Suggested test: extend OIDCAttestationBasedClientAuthenticationTest with an attester whose attestation carries an x5c chain rooted at a default-trust identity provider configured in X.509 mode, and a negative case with an unchained certificate.

How to reproduce

  1. Keycloak 26.7.x, feature client-auth-abca enabled, a confidential client with clientAuthenticatorType = attestation-based and attester_trust_idps pointing to a default-trust identity provider.
  2. Send a Client Attestation JWT (typ: oauth-client-attestation+jwt) whose JOSE header contains x5c and no kid, with a valid PoP JWT, to the token endpoint.
  3. Response: 400 invalid_client_attestation; server log: Invalid attester kid: null.

Related

Epic #43136 · #44768 · #43400 · #48270 · #44772 · #48268 · PR #51042 (#50518, #50399, #51399)

Activity

  1. mposolda commented on Sep 17, 2026

    @mposolda
    Contributor

    Added as a child to the abca epic. May need to be reviewed...

  2. added 4 commits that reference this issue on Sep 18, 2026
    1991b7a
    e754e99
    463ea6e
    7afd02e
  3. added theissue type on Sep 23, 2026
  4. added
    kind/bug
    on Sep 23, 2026
  5. added
    area/oidc
    on Sep 23, 2026
  6. added 2 commits that reference this issue on Sep 26, 2026
    2ddfff4
    3c328f5
  7. keycloak-github-bot commented on Oct 5, 2026

    @keycloak-github-bot

    Due to the amount of issues reported by the community we are not able to prioritise resolving this issue at the moment.

    If you are affected by this issue, upvote it by adding a 👍 to the description. We would also welcome a contribution to fix the issue.

  8. added a commit that references this issue on Nov 5, 2026
    b04d334
  9. added a commit that references this issue on Nov 5, 2026
    f2d2da5
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/oidchelp wantedkind/bugpriority/normalrelease/27.0.0status/auto-bumpteam/core-protocols

    Type

    Fields

    No fields configured for bug.

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions