{"id":"CVE-2026-75522","aliases":["CVE-2026-75522","GHSA-4c2f-96cf-f5fc"],"related":[],"kind":"vulnerability","state":"published","title":"OpenID4VP: X.509 chain validation accepts a forged certificate that reuses a trusted anchor's Subject DN without verifying its signature","summary":"OpenID4VP is an open-source credential parsing library for SD-JWT VC and mDOC/mDL formats. Prior to 0.8.1, src/trust/ChainBuilder.ts ChainBuilder.tryBuild() terminates chain construction when an attacker-controlled certificate Subject Distinguished Name equals a trusted anchor subject, without verifying cryptographic closure to the anchor public key. A remote unauthenticated attacker can supply a self-signed leaf or intermediate that reuses the trusted Subject Distinguished Name and have credentials signed by the attacker key accepted as issued by the trusted authority. The public src/trust/TrustEvaluator.ts TrustEvaluator.evaluate() path compounds the error by matching a terminus through serialNumber and falling back to anchors[0], which can attribute the forged chain to genuine trusted-authority metadata. This issue is fixed in version 0.8.1.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"OpenID4VP is an open-source credential parsing library for SD-JWT VC and mDOC/mDL formats. Prior to 0.8.1, src/trust/ChainBuilder.ts ChainBuilder.tryBuild() terminates chain construction when an attacker-controlled certificate Subject Distinguished Name equals a trusted anchor subject, without verifying cryptographic closure to the anchor public key. A remote unauthenticated attacker can supply a self-signed leaf or intermediate that reuses the trusted Subject Distinguished Name and have credentials signed by the attacker key accepted as issued by the trusted authority. The public src/trust/TrustEvaluator.ts TrustEvaluator.evaluate() path compounds the error by matching a terminus through serialNumber and falling back to anchors[0], which can attribute the forged chain to genuine trusted-authority metadata. This issue is fixed in version 0.8.1.","source":"cvelist"},{"lang":"en","text":"## Summary\n\n`ChainBuilder` (the private RFC 5280 validator behind `TrustEvaluator` and the public credential-parsing API) terminated chain building on **Subject Distinguished Name string equality** rather than on cryptographic closure to a trust anchor. A certificate whose Subject DN string matched a trusted anchor's Subject DN was accepted as the chain terminus **with no signature verification** against the anchor's public key.\n\nAn attacker who mints a self-signed certificate and copies a trusted anchor's Subject DN string onto it can therefore have that certificate — and any credential signed with its private key — accepted as issued under a trusted authority.\n\n## Impact\n\nA relying party using `@openeudi/openid4vp` to verify OpenID4VP presentations (mdoc / SD-JWT VC) could be induced to accept a **forged credential as genuine**, defeating the trust-anchor model. In an eIDAS / EUDI age- or identity-verification deployment this permits impersonation of a trusted issuer.\n\nExploitable through the public verification path: `TrustEvaluator.evaluate()` returns a successful result (and, due to a secondary fallback, attributes the forged leaf to a real anchor's metadata), so downstream callers see a trusted outcome.\n\n## Details\n\n`src/trust/ChainBuilder.ts`, `tryBuild()`:\n\n```js\nwhile (current.subject !== anchor.subject) { /* verify & climb */ }\n// loop exits when current.subject === anchor.subject\nreturn chain;  // returned WITHOUT verifying `current` against the anchor\n```\n\nThe signature-verified closure path (`if (!issuer)` -> `verifySignature(current, anchor)`) is correct, but the `while` guard provides a second, unverified exit: when a supplied certificate (the leaf, or an attacker-supplied intermediate) has a Subject DN string equal to the anchor's, the loop body never runs, no `verifySignature` call is made, and the chain is returned as valid. The per-certificate checks that do run (validity, algorithm, keyUsage) all operate on the attacker-controlled certificate and do not bind it to the anchor.\n\nSecondary contributing weakness (`src/trust/TrustEvaluator.ts`): the anchor selected for the result was matched by `serialNumber` and **fell back to `anchors[0]`** when no match was found, so the forged leaf was reported alongside a genuine anchor's `trustedAuthorityIds` / provenance.\n\n## Proof of Concept\n\n```js\n// Attacker mints a self-signed cert reusing a trusted anchor's Subject DN.\nconst impostor = selfSigned({ subject: trustedAnchor.subject /* string */ });\n// Vulnerable: resolves to a valid chain [impostor] with no signature check.\nawait new ChainBuilder().build(impostor, [trustedAnchor]);\n```\n\n## Patch\n\n`ChainBuilder.tryBuild()` now requires the terminating certificate to be **byte-identical to the trust anchor** (DER `rawData` comparison) when the loop exits on DN equality; otherwise it throws `CertificateChainError` with `reason: \"signature\"`. Cryptographic closure via `verifySignature(current, anchor)` remains the only other accepted termination. As defense-in-depth, `TrustEvaluator` now selects the terminating anchor by DER byte-identity and throws instead of silently falling back to the first candidate. Fixed in `0.8.1`.\n\n## Workarounds\n\nNone. Upgrade to `0.8.1`.\n\n## Credits\n\nReported by **Reza Shokri** — Quellkern e.U. (https://augenmass.tech), GitHub [@devdotbo](https://github.com/devdotbo). Thanks for the thorough report, the self-contained reproduction, and coordinated disclosure.","format":"markdown","source":"ghsa"}],"published":"2026-11-18T20:50:38.763Z","modified":"2026-11-19T20:45:04.329Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N","score":7.5,"rating":"HIGH"}],"cwes":["CWE-295","CWE-347"],"affected":[{"ranges":[{"version":"< 0.8.1","status":"affected"}],"vendor":"openeudi","product":"openid4vp","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"0.8.1"}],"ecosystem":"npm","package":"@openeudi/openid4vp","purl":"pkg:npm/%40openeudi/openid4vp","source":"ghsa"}],"references":[{"url":"https://github.com/openeudi/openid4vp/security/advisories/GHSA-4c2f-96cf-f5fc","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/openeudi/openid4vp/pull/25","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/openeudi/openid4vp/commit/a3ffd435aadd61aff1f75ec4b2e1a0f44ffabf16","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/openeudi/openid4vp/releases/tag/v0.8.1","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-75522","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/openeudi/openid4vp","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"partial","date":"2026-11-19T15:07:40.823Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-75522","url":"https://www.cve.org/CVERecord?id=CVE-2026-75522","licence":"CVE Terms of Use","modified":"2026-11-19T15:07:45.259Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-4c2f-96cf-f5fc","url":"https://github.com/advisories/GHSA-4c2f-96cf-f5fc","licence":"CC-BY-4.0","modified":"2026-11-19T20:45:04.329Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-75522","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-75522","licence":"Public domain","modified":"2026-11-19T16:21:56.087Z"}],"updatedAt":"2026-11-25T22:59:51.915Z","epss":{"score":0.00242,"percentile":0.16477,"date":"2026-12-01T12:00:22.000Z"}}