All vulnerabilities

npm

CVE-2026-118780

Forge: verifyCertificateChain() removes trusted CA certificates with the same subject from the CA store

Severity
Low 3.7
Published
30 Oct 2026
Last changed
30 Oct 2026
Added to UpHeron
23 Nov 2026
Fixed in
1.4.1
Exploit chance
0.2% in the next 30 daysHigher than 7% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Improper certificate validation (CWE-295)CWE-471
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Slow it down
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L
Also known as
GHSA-4487-j8r4-4g2f
Sources
OSV.dev and GitHub

Description

When a CA store created by pki.createCaStore() holds two or more certificates with the same subject name, pki.verifyCertificateChain() permanently removes those certificates from the store while trying each one as the issuer. A peer can send any certificate that names that subject as its issuer to make all later verifications against those CA certificates fail. Fixed in node-forge 1.4.1.

pki.verifyCertificateChain() (lib/x509.js) asks the CA store for the issuer of each certificate with caStore.getIssuer(). When the store holds several certificates with the same subject, caStore.getIssuer() returns the store's own internal array of those certificates (caStore.certs[hash], built by addCertificate()). verifyCertificateChain() used that array directly as its list of candidate parents and called parents.shift() on it while trying each candidate. Every candidate it tried, including the one that finally verified the certificate, was removed from the store.

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Workarounds

  • Pass a fresh CA store to each pki.verifyCertificateChain() call (for example pki.createCaStore(trustedCerts)), or pass caStore to forge.tls.createConnection() as an array of certificates instead of a store object, so that forge creates a new store per connection.
  • Or wrap the store so that getIssuer() returns a copy:

var getIssuer = caStore.getIssuer; caStore.getIssuer = function(cert) { var r = getIssuer(cert); return Array.isArray(r) ? r.slice() : r; };

Workarounds as given by the GitHub Advisory Database, CC BY 4.0.

Affected software

SoftwareAffected versions
node-forgenpm · osv:npm:node-forge
  • Every version before 1.4.1

About node-forge

Weekly downloads (npm)
55,543,907npm, 23 Nov 2026

References