Skip to content

Request Payload has no request-level nonce, so replay protection is not guaranteed #63

Todo

Description

@julescafik

Problem: RequestPayload has no nonce or timestamp of its own. The only nonce is EncryptionContext.nonce (6.2), whose purpose is not defined and which is absent when ISO/IEC 18013-5 session encryption is used. On the DC API and OpenID4VP paths the channel binding can be static (web origin, client identifier, request URI), so nothing guarantees that two sessions differ.

Impact: Where request bytes and channel binding repeat across sessions, a captured presentation verifies again. Section 8 says the transcript prevents replay, but the draft does not require any per-request fresh value, so this holds only if implementations add one. A nonce field alone would not close the gap: unless the Verifier checks each response against the nonce it issued for that session and accepts it only once, a resubmitted presentation still verifies.

Potential resolution: Add a mandatory nonce field to RequestPayload, generated fresh per request from a cryptographically secure source. State that the Verifier shall accept a response only for a nonce it issued and has not already consumed. Define the purpose of EncryptionContext.nonce, or remove it if the request-level nonce replaces it. Add a security consideration covering static channel bindings.

Downstream impact:

Verifier: must generate, store and consume a nonce per session. Stateless or load-balanced back ends need shared state to enforce single use. Until this is fixed, each Verifier has to add its own replay defence on the DC API and OpenID4VP paths.

Relying party: on those paths, unless its Verifier adds such a defence, it cannot treat a presentation as proof that the credential was presented live in this session. A presentation previously captured at the same relying party could be replayed to support an account opening the holder never took part in, which undermines the identity-proofing record.

Activity

  1. andrewhughes3000 commented on Oct 26, 2026

    @andrewhughes3000
    Member

    WG to comment on why this nonce requirement is already or not satisfied.

  2. julescafik commented on Nov 5, 2026

    @julescafik
    Author

    For WG review:

    Test: replay against the draft as written

    I built a test to check this issue against the -00 Editor’s Copy. A response captured in one session verifies again in a later session, and the proposed resolution stops it. Noting every verdict below comes from cryptography and not scripted output.

    Setup: a genuine holder completes session 1. An attacker who captured the encrypted response, for example through a malicious extension or a compromised script on the relying party’s page, later opens session 2 at the same relying party and submits the captured response.

    Results:

    1. Draft as written, DC API path, verifier configuration unchanged between sessions. The wallet transcript in session 2 is identical to session 1. The replay is accepted.
    2. Draft as written, OpenID4VP path, bound by oidc4vp_client_id. The wallet transcript is identical. The replay is accepted.
    3. Draft plus a fresh EncryptionContext.nonce, but the Verifier does not check it. The wallet transcript differs. The replay is still accepted.
    4. Draft plus a fresh nonce, and the Verifier binds it to its own session. The wallet transcript differs. The replay is rejected with HPKE_DECRYPT_FAILED.
    5. Proposed resolution: a mandatory request nonce, accepted only once. The wallet transcript differs. The replay is rejected with NONCE_REPLAYED.

    What this shows

    Results 1 and 2: on the DC API and OpenID4VP paths, nothing in RequestPayload or ChannelBinding has to change between sessions. The WalletTransactionTranscript is byte-identical, so HPKE decryption succeeds and the device signature verifies. An SD-JWT Key Binding JWT nonce, defined as SHA-256 of the transcript, would also be identical.

    Result 3: a fresh value alone does not close the gap. If the Verifier rebuilds the transcript from the request submitted alongside the response, without checking that it issued that request for this session and has not already consumed it, the replay still verifies.

    Result 4: a careful implementation can block replay today, but only through choices the draft does not require.

    In this scenario the Verifier could make two choices. First, it puts fresh random bytes into EncryptionContext.nonce for every request, which changes request_hash and therefore the transcript. Second, when a response arrives, it rebuilds the transcript from its own stored record of the session it is verifying, not from request data submitted alongside the response. With both in place, the captured response was sealed under session 1’s transcript, the Verifier opens it with session 2’s transcript, and HPKE decryption fails.

    Neither choice is required by the draft:

    The draft gives EncryptionContext.nonce no defined purpose. It does not say who generates it, that it must be fresh, how much entropy it needs, or that the Verifier must check it. A Verifier that fills it from configuration, as in Results 1 and 2, conforms to the draft.

    The draft does not require the HPKE key to be ephemeral. A Verifier that generated a new key pair per request and discarded the private key afterwards would also block this replay, but the draft describes the key only as the reader’s public key, and a long-term key conforms.

    The draft says nothing about Verifier state. It does not require the Verifier to keep a record of the requests it issued, to verify a response only against the request issued for that session, or to refuse a second response for a session that has already completed. Result 3 shows the consequence: a Verifier with a fresh nonce that rebuilds the transcript from caller-supplied request data accepts the replay. Stateless and load-balanced deployments tend toward exactly that design, because session state has to be shared across back ends.

    Even this careful Verifier is only partly protected. Session binding stops a response from being replayed into a different session, but nothing in the draft stops the same response from being submitted twice within the session it was issued for. Blocking that requires the Verifier to mark the session or its nonce as consumed after the first response, which is the single-use rule the proposed resolution adds. (This case follows from the same logic but was not run as a separate scenario in the proof of concept.)

    The outcome is that replay protection on the DC API and OpenID4VP paths depends on each implementer independently making the right undocumented choices. A relying party cannot tell from conformance to the draft whether its Verifier made them, and the wallet cannot detect the difference at all, since the requests look the same to it. The transcript section states that messages from one session cannot be replayed in another, but as written that holds only for implementations that go beyond the draft. The proposed resolution turns these choices into requirements: a mandatory fresh nonce in RequestPayload, and a rule that the Verifier accepts a response only for a nonce it issued and has not already consumed.

    Result 5: a mandatory per-request nonce with single-use acceptance rejects the replay before decryption.

    How I am interpreting the existing specifications and how they handle this:

    ISO/IEC 18013-7 Annex C (DC API): the verifier-generated nonce is carried in EncryptionInfo, which is hashed with the origin into the SessionTranscript. The same replay fails.

    OpenID4VP 1.0: the Verifier’s nonce is bound into the mdoc SessionTranscript through the OpenID4VP handover, and into the nonce claim of the SD-JWT Key Binding JWT. The same replay fails.

    ISO/IEC 18013-5 (proximity): there is no explicit nonce. Freshness comes from ephemeral keys instead. The SessionTranscript contains the DeviceEngagement, which carries the mdoc’s ephemeral key (EDeviceKey), and the reader’s ephemeral key (EReaderKey). Both are generated for each session, and the session encryption keys are derived from them. A response captured in one session neither decrypts nor verifies in another.

    The draft keeps most of this protection for proximity. Its engagement fields (qr_device_engagement and the NFC handover fields) carry the DeviceEngagement and therefore EDeviceKey, so proximity transcripts differ per session. This is why the issue is limited to the DC API and OpenID4VP paths. On those paths there is no engagement and no ephemeral key exchange, so the 18013-5 mechanism contributes nothing, and the draft drops the nonce that 18013-7 Annex C and OpenID4VP 1.0 rely on without supplying a replacement

    Side finding, which can be filed separately:

    1. The ChannelBinding keys in the prose table and the CDDL disagree (dc_api_origin is 8 in the prose and 7 in the CDDL; oidc4vp_client_id is 7 and 6), and nfcv2_handover is missing from the CDDL. Noting my testing used the CDDL keys.
  3. andrewhughes3000 commented on Nov 5, 2026

    @andrewhughes3000
    Member

    WG discussion - please review.
    This will be raised during the Transcript call.

  4. awoie commented on Nov 16, 2026

    @awoie
    Contributor

    WG discussion:

    Remarks:
    If a single-use nonce is required, it must not be used more than once. However, enforcement strictness varies across implementations, and some systems lack the capability to support single-use nonces.

    Conclusion:

    • Spec coverage: A nonce is already included in the specification, so this should not pose an issue.
    • Conditional use (ISO 18013-5): The nonce is only conditional when another encryption mechanism is used. This is the case for ISO 18013-5, where the session transcript is the nonce. For SD-JWT VC, some representation of the session transcript is included to prevent cross-transport replay attacks.

    @julescafik Since you joined at the end of the meeting, I had no chance to ask you if you are ok with this conclusion. Please reply here if you don't agree with this conclusion.

  5. julescafik commented on Nov 16, 2026

    @julescafik
    Author

    @awoie thank you, I had a conflict and tried to make it to part of the meeting, apologies for my absence.

    I agree on the conditional use text. It covers when the nonce is absent, however it does not state a requirement for when the nonce is present. I request adding clarification to the EncryptionContext.nonce definition: ‘The Verifier shall generate a new nonce for each request’. Without it, a Verifier that reuses the nonce value conforms to the draft, and the attached test shows a captured response can then verify in a later session on the DC API and OpenID4VP paths.

  6. jogu commented on Nov 26, 2026

    @jogu
    Contributor

    Discussed on today's WG call - consensus to add a sentence as Juliana proposed:

    The Verifier shall generate a new nonce for each request

    Martijn offered to do a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions