Skip to content

Reject semantically duplicate CBOR keys in passkey attestation objects #69343

Description

@cincuranet

System.Formats.Cbor.CborReader in Strict mode permits non-preferred encodings but checks map-key uniqueness using encoded bytes. Consequently, differently encoded keys can decode to the same string without triggering duplicate-key rejection.

ASP.NET Core Identity's AttestationObject.Parse overwrites previously parsed values when it encounters the same decoded key. An attestation object containing two differently encoded authData keys therefore causes Identity to use the last occurrence. However, VerifyAttestationStatement receives the original attestation object and may interpret it differently.

For example, the text key "authData" has these two valid CBOR encodings:

68    61 75 74 68 44 61 74 61   # Preferred: length 8 encoded in the initial byte
78 08 61 75 74 68 44 61 74 61   # Non-preferred: length 8 encoded in an extra byte

Both decode to the same string, "authData", but their encoded bytes differ. If both appear as keys in one map, they are semantically duplicate keys despite passing a bytewise uniqueness check.

Potential impact: If the relying party’s attestation verifier accepts duplicates and uses the first occurrence, it could approve one set of authenticator data while Identity stores a credential public key from the second. This could bypass the configured attestation policy; it depends on the verifier’s behavior and does not itself bypass registration authorization.

Expected behavior: Reject semantically duplicate attestation-object keys before invoking attestation verification or returning a credential, while preserving support for otherwise valid non-preferred encodings.

Activity

  1. added
    area-identity
    on Sep 16, 2026
  2. GrantTotinov commented on Sep 18, 2026

    @GrantTotinov
    Contributor

    I'd like to work on this, if its still free :)

    Proposed fix: in AttestationObject.ParseCore, keep track of the decoded keys we've already seen (a HashSet) and throw as soon as a key repeats, before the switch that consumes it. That way semantically duplicate keys get rejected no matter how they were encoded on the wire, before the attestation object is ever returned to the caller or handed off to attestation verification, and CborReader itself doesn't need to change.

    I'll add a new PasskeyException factory method for this (something like DuplicateAttestationObjectKey), following the existing pattern in PasskeyExceptionExtensions.cs.

    Let me know if you had something different in mind for the fix.

  3. added
    bug
    on Oct 23, 2026
  4. added this to the .NET 12 Planning milestone on Nov 4, 2026
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-identitybug

    Type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions