All vulnerabilities

npm

CVE-2026-140099

Forge: RSA multi-prime private keys are read as two-prime keys, and signatures leak a factor of the modulus

Severity
Low 3.7
Published
1 Dec 2026
Last changed
1 Dec 2026
Added to UpHeron
1 Dec 2026
Fixed in
1.4.4
Exploit chance
0.3% in the next 30 daysHigher than 22% of CVEs. EPSS by FIRST, 1 Dec 2026
Weakness
Improper input validation (CWE-20)CWE-325
Attack
Over the network · Only under certain conditions · No login needed · No user action needed
Attacker can
Read some data
CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N
Also known as
GHSA-w73w-hhm4-q25p
Sources
OSV.dev and GitHub

Description

pki.privateKeyFromPem() and pki.privateKeyFromAsn1() ignore the RSAPrivateKey version and the otherPrimeInfos field, so a multi-prime RSA key is read with only its first two primes. Signatures made with such a key are invalid, and each one reveals a factor of the modulus to anyone who sees it. Fixed in node-forge 1.4.4.

RFC 8017 (A.1.2) allows RSA private keys with more than two primes: version 1, with the extra primes in otherPrimeInfos. node-forge only supports two-prime keys, but pki.privateKeyFromAsn1() in lib/rsa.js (used by pki.privateKeyFromPem(), PKCS#8 and PKCS#12 key parsing) never checked the version, and ASN.1 validation ignores the extra field. A multi-prime key is therefore read as if it were a two-prime key with modulus n, primes p and q, and the CRT values for p and q.

forge's private-key operation uses the CRT with p and q, so its result is correct modulo p*q but not modulo the remaining primes.

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

Workarounds

Don't use multi-prime RSA keys with node-forge. Before loading a key from an untrusted or unknown source, check that its RSAPrivateKey version is 0. Multi-prime keys that were used to sign with node-forge should be replaced, since their signatures reveal a factor of the modulus.

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

About node-forge

Weekly downloads (npm)
52,415,507npm, 1 Dec 2026

References