GHSA-4c2f-96cf-f5fc

Suggest an improvement
Source
https://github.com/advisories/GHSA-4c2f-96cf-f5fc
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-4c2f-96cf-f5fc/GHSA-4c2f-96cf-f5fc.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-4c2f-96cf-f5fc
Aliases
Published
2026-11-19T20:35:57Z
Modified
2026-11-19T20:45:04Z
Severity
  • 7.5 (High) CVSS_V3 - CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N CVSS Calculator
Summary
OpenID4VP: X.509 chain validation accepts a forged certificate that reuses a trusted anchor's Subject DN without verifying its signature
Details

Summary

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.

An 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.

Impact

A 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.

Exploitable 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.

Details

src/trust/ChainBuilder.ts, tryBuild():

while (current.subject !== anchor.subject) { /* verify & climb */ }
// loop exits when current.subject === anchor.subject
return chain;  // returned WITHOUT verifying `current` against the anchor

The 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.

Secondary 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.

Proof of Concept

// Attacker mints a self-signed cert reusing a trusted anchor's Subject DN.
const impostor = selfSigned({ subject: trustedAnchor.subject /* string */ });
// Vulnerable: resolves to a valid chain [impostor] with no signature check.
await new ChainBuilder().build(impostor, [trustedAnchor]);

Patch

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.

Workarounds

None. Upgrade to 0.8.1.

Credits

Reported by Reza Shokri — Quellkern e.U. (https://augenmass.tech), GitHub @devdotbo. Thanks for the thorough report, the self-contained reproduction, and coordinated disclosure.

Database specific
{
    "cwe_ids": [
        "CWE-295",
        "CWE-347"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-11-19T20:35:57Z",
    "nvd_published_at": "2026-11-18T21:18:02Z",
    "severity": "HIGH"
}
References

Affected packages

npm / @openeudi/openid4vp

Package

Name
@openeudi/openid4vp
View open source insights on deps.dev
Purl
pkg:npm/%40openeudi/openid4vp

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
0.8.1

Database specific

last_known_affected_version_range
"<= 0.8.0"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-4c2f-96cf-f5fc/GHSA-4c2f-96cf-f5fc.json"