Can a server-provided DPoP nonce be predictable?

Nonce values are unpredictableRFC 9449 §8MUSTRoles: authorization_server, resource_server

Requirement as recorded in the ProtocolSoup registry

Nonce values MUST be unpredictable.

Read §8 in RFC 9449

Self-test verdict

PassCommit 49e2a4fEvaluated

This is ProtocolSoup's result against its own implementation at the commit shown. It is not a certification of ProtocolSoup or of any other product.

Captured from production

Not captured for this build.

Tests

Implementation

Explainer

What this requires

RFC 9449 Section 8 says an authorization server "MAY supply a nonce value to be included by the client in DPoP proofs sent", and then constrains every value it supplies with this sentence. A client, or anyone watching earlier values, must not be able to work out the next one. Section 9 has resource servers provide nonces "in the same way that authorization servers do as described in Sections 8 and 8.2".

The RFC does not say how to generate the value. It fixes only the syntax (Section 8.1, nonce = 1*NQCHAR) and that "The nonce is opaque to the client."

Unpredictable does not mean single-use. Section 11.1 says "it is acceptable for clients to use the same nonce multiple times and for the server to accept the same nonce multiple times."

Why it exists

Section 11.2 describes the attack the nonce answers: a party in control of the client "can pre-generate DPoP proofs for specific endpoints arbitrarily far into the future by choosing the iat value in the DPoP proof", and copy them to a machine that does not hold the key. It then gives the condition for the defence: "Use of server-provided nonce values that are not predictable by attackers can prevent this attack." If the next nonce can be guessed, the attacker signs proofs over the guessed values ahead of time and the mechanism proves nothing about when a proof was made.

What non-compliance looks like

A server whose nonces are a counter, a timestamp, or a hash of either hands out values an attacker can compute in advance. So does a server that ignores an error from its random source and issues zeroed or empty bytes: every client receives the same guessable value.

How ProtocolSoup tests it

Every nonce space is a NonceIssuer whose random source is crypto/rand. A nonce is the base64url encoding of 24 bytes read from that source, with nothing else mixed in. If the read fails, Issue and Valid return the error, no nonce is issued, and the endpoint answers HTTP 500 with server_error.

TestNonceIssuerDrawsNonceFromRandomSource asserts that a new issuer reads from crypto/rand.Reader, then replaces the source with 24 known bytes and asserts that the nonce is exactly their base64url encoding. TestNonceIssuerFailsClosedWhenEntropyUnavailable replaces the source with one that always fails and asserts that Issue returns an error and an empty nonce.

The captured passing exchange shows a nonce the production token endpoint supplied. No exchange can show that a value was unpredictable, and no request can make the server issue a predictable one, so there is no failing exchange.

Related requirements

All RFC 9449 requirements · OID4VCI protocol page

Can a server-provided DPoP nonce be predictable? · RFC 9449 §8 | ProtocolSoup