# GHSA-H548-CR7V-4V97: Presentation holder-binding / nonce replay protection can be bypassed (SD-JWT VC: KB-JWT optional · mDOC: DeviceAuth never verified)

- Database: GitHub
- Severity: CVSS 8.1 (High)
- Published: 2026-07-13
- Modified: 2026-08-20

## Affected versions

- @openeudi/openid4vp (npm): through 0.9.0

## Description

## Summary

`verifyPresentation` / `verifyAuthorizationResponse` return `valid: true` for
presentations that carry **no holder proof-of-possession and are not bound to
the verifier's `nonce`**. Because the issuer-signed material in a presentation
(the SD-JWT issuer JWT + disclosures, or the mDOC `issuerSigned` structure) is
disclosed to *every* verifier and is not secret, an attacker who observes one
presentation — e.g. a malicious or compromised relying party, a logged VP
token, or an intercepted response — can **replay it to any other verifier**
using this library and be accepted as the legitimate holder, **without ever
possessing the holder's private key** and **without satisfying a fresh nonce**.

This directly contradicts the README's stated guarantees:

> `nonce` … **Yes** … Challenge nonce for **replay protection**
> **SD-JWT VC** — full cryptographic verification (issuer JWT signature via
> `x5c`, transitive disclosure-hash check, **key binding JWT signature +
> `sd_hash`, nonce check**).

Two independent code paths are affected.

---

## Finding A — SD-JWT VC: key binding (KB-JWT) is only checked *if present*

`src/parsers/sd-jwt.parser.ts`, "Step 8":

```ts
// Step 8: Verify key binding JWT (if present)
if (parts.kbJwt) {
    ...
    // Validate nonce — must be present and match when KB-JWT is used
    if (kbPayload['nonce'] !== options.nonce) {
        return invalidResult('Key binding JWT nonce does not match');
    }
    // Verify sd_hash ...
}
```

Holder proof-of-possession (KB-JWT signature over the holder key in `cnf`),
the `nonce` check, the `sd_hash` binding, and the `audience` check **all live
inside `if (parts.kbJwt)`**. There is no requirement that a KB-JWT be present —
even when the issuer JWT carries a `cnf` claim (i.e. the credential is
explicitly holder-bound). An attacker simply presents `issuerJwt~disc1~disc2~`
with the trailing KB-JWT removed:

- `parts.kbJwt` is `undefined` → the entire block is skipped.
- The issuer signature and disclosure hashes still validate (they are genuine).
- `options.nonce` is **never consulted**, so the presentation replays across
  sessions and verifiers.
- Result: `valid: true` with the victim's claims.

### Impact
Complete bypass of holder binding and replay protection for SD-JWT VC. Any
party that has seen a victim's SD-JWT presentation can impersonate the holder to
any verifier built on this library.

---

## Finding B — mDOC / ISO 18013-5: DeviceAuth is never verified

`src/parsers/mdoc.parser.ts` verifies `issuerSigned.issuerAuth` (the issuer
COSE_Sign1 over the MSO), MSO validity, and IssuerSignedItem digests — then
returns `valid: true`. It **never reads `deviceSigned` / DeviceAuth**, never
extracts `deviceKeyInfo.deviceKey` from the MSO, and never binds to a
SessionTranscript / OpenID4VP `nonce`. A grep of `src/` for
`deviceSigned|deviceAuth|sessionTranscript|deviceKey` returns nothing.

ISO 18013-5 §9.1.3 requires the mdoc reader to verify **mdoc authentication**:
the holder device proves possession of the private key committed in the MSO by
signing (DeviceSignature) or MACing (DeviceMac) the SessionTranscript, which
binds the presentation to the current session/nonce. Omitting this makes the
`issuerSigned` blob a bearer token: anyone who obtains it can replay it.

`options.nonce` (documented as required for replay protection) is accepted but
silently ignored on the mDOC path.

### Impact
Complete absence of holder binding / proof-of-possession for mDOC. A captured
`issuerSigned` structure is replayable to any verifier as `valid: true`.

> Note: the library's own happy-path test fixture (`tests/fixtures/mdoc-helpers.ts`)
> builds `documents: [{ issuerSigned }]` with **no `deviceSigned` member**, and
> the parser tests assert `valid === true` — confirming device authentication is
> entirely unverified.

---

## Proof of Concept

`tests/poc-holder-binding-bypass.spec.ts` (attached) builds a genuine
holder-bound SD-JWT VC, strips the KB-JWT, and shows a replay to a *fresh*
nonce returns `valid: true`; and builds an mDOC with no DeviceAuth and shows it
returns `valid: true`. Both use the library's own test fixtures.

Confirmed on 0.8.1 (vitest 4.1.5) — both assertions pass, i.e. the library
accepts both replayed/holder-unbound presentations:

```
$ npx vitest run tests/poc-holder-binding-bypass.spec.ts
 Test Files  1 passed (1)
      Tests  2 passed (2)
```

Each test asserts the *vulnerable* outcome (`expect(replay.valid).toBe(true)` /
`expect(result.valid).toBe(true)`), so a passing run demonstrates the defect.

---

## Suggested remediation

- **SD-JWT VC:** when the issuer JWT contains a `cnf` claim (or when the caller
  requests holder binding), **require** a KB-JWT and fail closed if absent.
  Always enforce `nonce` (and `audience`, `sd_hash`, `iat` freshness) whenever a
  nonce is supplied by the caller. Consider making holder binding the default
  and requiring an explicit opt-out for the (rare) issuer-only inspection case.
- **mDOC:** implement ISO 18013-5 mdoc authentication — parse `deviceSigned`,
  reconstruct the SessionTranscript from the OpenID4VP handover parameters
  (client_id, response_uri/nonce, mdoc-generated-nonce), extract `deviceKey`
  from the MSO's `deviceKeyInfo`, and verify DeviceSignature/DeviceMac. Fail
  closed when `deviceSigned` is absent. Bind and check the `nonce`.
- Until fixed, the API should not return `valid: true` for presentations it
  cannot holder-bind; at minimum, document the gap prominently.

## Impact
Prior to 0.9.0, @openeudi/openid4vp did not enforce holder binding, so a verifier could accept a presentation the presenting party does not control — including a captured/replayed one — as if it were a valid proof of possession. This affects both credential formats:

- SD-JWT VC: Key-Binding-JWT verification (signature, nonce, sd_hash, audience) was gated on the KB-JWT being present. An attacker could strip the KB-JWT from a captured credential and have it accepted; holder-bound credentials (issuer cnf) were accepted with no proof of possession.
- mDOC (ISO 18013-5): only the issuer signature (issuerAuth/MSO) was verified. deviceSigned / DeviceAuth / the SessionTranscript / the device key were never checked, so a captured issuerSigned payload was a replayable bearer token.
- 
- The result is an authentication/holder-binding bypass: a relying party could be convinced a subject presented a credential when they did not, or accept a presentation replayed from another session.

## Patches
Fixed in 0.9.0 (breaking — holder binding is now fail-closed for both formats):
- SD-JWT VC: a KB-JWT is mandatory whenever the issuer JWT carries cnf (or requireKeyBinding is set); its signature, a non-empty nonce, sd_hash, and audience are enforced.
- mDOC: full ISO 18013-5 §9.1.3 device authentication — the DeviceSignature over DeviceAuthentication/SessionTranscript is verified against the MSO-committed device key; DeviceMac is rejected; missing deviceSigned/transcript/device-key fail closed.
- Adds OID4VP 1.0-Final OpenID4VPHandover SessionTranscript support. The fix is validated both by the OIDF conformance suite (as an independent ISO 18013-5 wallet) and by the reporter's original proof-of-concept.

## Workarounds
None. Upgrade to 0.9.0 — the missing checks cannot be enabled by configuration in earlier versions.

## Credit
Reported by Emir Çoban (@EmirCobanOfficial), who also independently verified the fix. Thank you.

## References

- https://github.com/openeudi/openid4vp/security/advisories/GHSA-h548-cr7v-4v97

Page: https://cve.now/GHSA-H548-CR7V-4V97

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
