node-forge · Forge: RSA multi-prime private keys are read as two-prime keys, and signatures leak a factor of the modulus
Affects node-forgeSource GCVE Database
Not known to be exploited · CVSS 3.7 Low : upgrade to 1.4.4 when convenient.
Data as of 1 Dec 2026, 19:00 UTC
Thin evidence
One scorer or none| CNA (GitHub_M) | CVSS 3.1 | 3.7 |
|---|
- Patch
- Available – fixed in 1.4.4
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:NExploitation evidence
Disclosed: evidence found.
CVE published 30 Nov 2026
Detectable: no evidence on record.
No public nuclei template indexed
Weaponized: no evidence on record.
No public exploit code indexed in Metasploit or Exploit-DB
Exploited in the wildExploited: no evidence on record.
Not in CISA KEV and no source reports exploitation
Observed by OffSeq MirageSeen by Mirage: no evidence on record.
No attack traffic recorded by OffSeq Mirage sensors
A missing step is not evidence of safety. Sources: cve.org (opens in a new tab), the Metasploit, Exploit-DB and nuclei-templates index as of 1 Dec 2026.
What to do
Upgrade node-forge to 1.4.4.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| npmnode-forge | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
Description
### Summary `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. ### Details 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. For a signature s made this way, s^e equals the encoded message modulo p*q but not modulo n, so gcd(s^e - EM, n) = p*q, where EM is the PKCS#1 encoding of the signed message, which a verifier can compute. One signature therefore splits n into p*q and the product of the other primes. For a three-prime key (the usual case; OpenSSL with `rsa_keygen_primes:3`) this reveals the third prime and leaves a two-prime modulus of about two thirds of the size: for a 2048-bit key, a 1366-bit RSA modulus instead of 2048 bits. Decryption with such a key fails, and the signatures don't verify, so applications that use a multi-prime key with forge see errors immediately. Keys generated by forge, by OpenSSL by default, by Node.js and by most other tools are two-prime and not affected. The fix rejects RSAPrivateKeys with a version other than 0 or with otherPrimeInfos ("Only two-prime RSAPrivateKey version 0 is supported."). This also rejects two-prime keys with an invalid version, as reported in https://github.com/digitalbazaar/forge/issues/1143. ### Patches Fixed in node-forge 1.4.4. ### 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. ### Related - RFC 8017, appendix A.1.2 (RSA private key syntax): https://www.rfc-editor.org/rfc/rfc8017#appendix-A.1.2 - Issue #1143 (RSAPrivateKey version not checked): https://github.com/digitalbazaar/forge/issues/1143 - Boneh, DeMillo and Lipton, "On the Importance of Checking Cryptographic Protocols for Faults" (Eurocrypt 1997): the same gcd recovers factors from a faulty CRT signature. ### Proof of concept Generate a three-prime key and sign with forge: openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 \ -pkeyopt rsa_keygen_primes:3 -out mp3.pem var key = forge.pki.privateKeyFromPem(pem); // <= 1.4.3: loads var md = forge.md.sha256.create(); md.update('hello'); var s = key.sign(md); // the signature doesn't verify (Node.js crypto.verify() is false), and // gcd(s^e - EM, n), with EM the PKCS#1 v1.5 encoding of SHA-256('hello'), // is a 1366-bit factor of the 2048-bit n // 1.4.4: privateKeyFromPem() throws "Cannot read private key. Only // two-prime RSAPrivateKey version 0 is supported." Regression tests are in tests/unit/rsa.js ("RSAPrivateKey version"). ### Impact Applications that load a multi-prime RSA private key with node-forge and sign with it are affected. Each signature reveals the product of two of the key's primes, and so the remaining prime(s), to anyone who sees the signature, which reduces the key's security (for a 2048-bit three-prime key, to that of a 1366-bit RSA key). The signatures are invalid and decryption fails, so the problem is visible to the application. Two-prime keys, which nearly all tools generate, are not affected.
References
- github.com/digitalbazaar/forge/security/advisories/GHSA-w73w-hhm4-q25p (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-140099 (opens in a new tab)
- github.com/digitalbazaar/forge/issues/1143 (opens in a new tab)
- github.com/digitalbazaar/forge/commit/8d1a7bc8ad514e70f85bf5cbe4c60cd52916fdef (opens in a new tab)
- github.com/digitalbazaar/forge (opens in a new tab)
- github.com/digitalbazaar/forge/releases/tag/v1.4.4 (opens in a new tab)