CVE-2026-140099: Forge RSA Multi-prime Private Keys Are Vulnerability

LOW
Advisory Identifier: GHSA-w73w-hhm4-q25p
CVSS 3.7
CWE-20 CWE-325
Published
Advisory Summary

CVE-2026-140099 is a LOW (CVSS 3.7) rsa multi-prime private keys are vulnerability (CWE-20: Improper Input Validation) affecting Forge libraries in the npm ecosystem. The issue involves rsa multi-prime private keys are read as two-prime keys, and signatures leak a factor of the modulus. Remediation is available by upgrading affected packages to version 1.4.4.

CVE-2026-140099 at a Glance

CVE Identifier CVE-2026-140099
GHSA Identifier GHSA-w73w-hhm4-q25p
Severity LOW
CVSS v3.1 Base Score 3.7
CWE Classification CWE-20: Improper Input Validation
Affected Product Forge
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 3.7

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality Low (C:L)
Integrity None (I:N)
Availability None (A:N)

How to Fix CVE-2026-140099

To remediate this vulnerability, upgrade all affected Forge dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

node-forge fixed: 1.4.4
npm install node-forge@1.4.4
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls node-forge

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-140099, inspect your project dependencies using npm:

npm ls node-forge

Analyze the terminal output to locate any version of Forge in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.4.4), your application is affected.

Note: The npm ls node-forge command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-20: Improper Input Validation, where the product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly. In Forge, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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

CVE-2026-140099 Affected Forge Versions

1 component(s)
Fixed Versions:
1.4.4
Product / Package Ecosystem Affected Versions Fixed Version
node-forge
npm
< 1.4.4
1.4.4

References

Frequently Asked Questions

What is CVE-2026-140099?
CVE-2026-140099 is a security vulnerability in Forge involving RSA multi-prime private keys are read as two-prime keys, and signatures leak a factor of the modulus under CWE-20: Improper Input Validation.
Which Forge versions are affected?
Affected versions include releases prior to 1.4.4 across affected packages: node-forge.
What version fixes CVE-2026-140099?
Upgrading to 1.4.4 (or the latest patched release for your respective branch) resolves the vulnerability.
Is node-forge affected?
Yes, node-forge is affected in releases prior to 1.4.4. Upgrade your dependency to 1.4.4 or later.
What is the CVSS score of CVE-2026-140099?
CVE-2026-140099 has a CVSS v3.1 base score of 3.7 (LOW) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N.
What CWE is associated with CVE-2026-140099?
CVE-2026-140099 is classified under CWE-20: Improper Input Validation (The product receives input or data, but it does not validate or incorrectly validates that the input has the properties that are required to process the data safely and correctly.).
How can I check npm dependencies for CVE-2026-140099?
Run the dependency tree command: 'npm ls node-forge'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w73w-hhm4-q25p",
  "modified" : "2026-12-01T18:42:05Z",
  "published" : "2026-12-01T18:42:05Z",
  "aliases" : [ "CVE-2026-140099" ],
  "summary" : "Forge: RSA multi-prime private keys are read as two-prime keys, and signatures leak a factor of the modulus",
  "details" : "### Summary\n\n`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.\n\n### Details\n\nRFC 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.\n\nforge'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.\n\nDecryption 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.\n\nThe 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.\n\n### Patches\nFixed in node-forge 1.4.4.\n\n### Workarounds\nDon'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.\n\n### Related\n- RFC 8017, appendix A.1.2 (RSA private key syntax): https://www.rfc-editor.org/rfc/rfc8017#appendix-A.1.2\n- Issue #1143 (RSAPrivateKey version not checked): https://github.com/digitalbazaar/forge/issues/1143\n- 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.\n\n### Proof of concept\n\nGenerate a three-prime key and sign with forge:\n\n    openssl genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 \\\n      -pkeyopt rsa_keygen_primes:3 -out mp3.pem\n\n    var key = forge.pki.privateKeyFromPem(pem);   // <= 1.4.3: loads\n    var md = forge.md.sha256.create();\n    md.update('hello');\n    var s = key.sign(md);\n    // the signature doesn't verify (Node.js crypto.verify() is false), and\n    // gcd(s^e - EM, n), with EM the PKCS#1 v1.5 encoding of SHA-256('hello'),\n    // is a 1366-bit factor of the 2048-bit n\n    // 1.4.4: privateKeyFromPem() throws \"Cannot read private key. Only\n    // two-prime RSAPrivateKey version 0 is supported.\"\n\nRegression tests are in tests/unit/rsa.js (\"RSAPrivateKey version\").\n\n\n### Impact\n\nApplications 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.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:N/A:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "node-forge"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.4.4"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 1.4.3"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/digitalbazaar/forge/security/advisories/GHSA-w73w-hhm4-q25p"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-140099"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/digitalbazaar/forge/issues/1143"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/digitalbazaar/forge/commit/8d1a7bc8ad514e70f85bf5cbe4c60cd52916fdef"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/digitalbazaar/forge"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/digitalbazaar/forge/releases/tag/v1.4.4"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-20", "CWE-325" ],
    "severity" : "LOW",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-12-01T18:42:05Z",
    "nvd_published_at" : "2026-11-30T23:17:24Z"
  }
}