Why is the challenge in publicKey CredentialCreation Options not random

I’ve created a ticket on Github with this question. But then realised it’s probably better to bring it here.

From webauthn.guide:

challenge: The challenge is a buffer of cryptographically random bytes generated on the server, and is needed to prevent “replay attacks”.

From the specs:

As a cryptographic protocol, Web Authentication is dependent upon randomized challenges to avoid replay attacks. Therefore, the values of both PublicKeyCredentialCreationOptions.challenge and PublicKeyCredentialRequestOptions.challenge MUST be randomly generated by Relying Parties in an environment they trust (e.g., on the server-side), and the returned challenge value in the client’s response MUST match what was generated. This SHOULD be done in a fashion that does not rely upon a client’s behavior, e.g., the Relying Party SHOULD store the challenge temporarily until the operation is complete. Tolerating a mismatch will compromise the security of the protocol.
In order to prevent replay attacks, the challenges MUST contain enough entropy to make guessing them infeasible. Challenges SHOULD therefore be at least 16 bytes long.

But the implementation is not random:

createOptions used in register

2 Likes

answer is here:

1 Like