You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reject semantically duplicate CBOR keys in passkey attestation objects #69343
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.
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.
Activity
GrantTotinov commentedon Sep 18, 2026
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.