npm
CVE-2026-118781
Forge: Denial of Service via infinite loop in BigInteger.modInverse() with negative input (incomplete fix of CVE-2026-33891)
- Severity
- Low 2.9
- Published
- 30 Oct 2026
- Last changed
- 30 Oct 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 1.4.1
- Exploit chance
- 0.4% in the next 30 daysHigher than 36% of CVEs. EPSS by FIRST, 24 Nov 2026
- Weakness
- Infinite loop (CWE-835)
- Attack
- Needs local access · Only under certain conditions · No login needed · No user action needed
- Attacker can
- Slow it down
- CVSS vector
CVSS:3.1/AV:L/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L- Also known as
- GHSA-h6cr-wjv9-3cpp
- Sources
- OSV.dev and GitHub
Description
BigInteger.prototype.modInverse() in node-forge's bundled jsbn library enters an infinite loop when the value or the modulus is negative, for example when a negative public exponent is passed to forge.pki.rsa.generateKeyPair(). This is an incomplete fix of CVE-2026-33891 (GHSA-5m6q-g25r-mvwx), which handled only a zero value. Fixed in node-forge 1.4.1.
bnModInverse() (lib/jsbn.js, exposed as forge.jsbn.BigInteger.prototype.modInverse) implements the binary extended Euclidean algorithm (Handbook of Applied Cryptography, Algorithm 14.61), which is defined for positive integers. With a negative operand the loop cannot terminate: rShiftTo is an arithmetic shift, so a negative value never moves towards zero, and the loop's exit condition (u reaching zero) is never met. The calling thread spins at 100% CPU indefinitely; in Node.js this blocks the event loop. Memory does not grow.
Workarounds
- Pass only fixed, valid RSA public exponents (e.g. 65537) to key generation, or validate caller-supplied exponents first: an odd integer >= 3.
- Do not call BigInteger#modInverse() with negative operands. Reduce the value modulo a positive modulus first (x.mod(m).modInverse(m)).
Affected software
| Software | Affected versions |
|---|---|
node-forgenpm · osv:npm:node-forge |
|
About node-forge
- Weekly downloads (npm)
- 55,543,907npm, 23 Nov 2026
Vulnerabilities in node-forge
- In our list
- 20
- Published in the last 12 months
- 20
- Critical, last 12 months
- 0
- High, last 12 months
- 7
- Known exploited
- 0
- CVE-2026-125335Forge: Ed25519 signature verification accepts small-order public keysLow 3.7 10 Nov 2026
- CVE-2026-125332Forge: TLS client crash on an unsupported ServerHello compression methodMedium 5.9 10 Nov 2026
- CVE-2026-125333Forge: ReDoS in forge.http response header and cookie trimmingMedium 5.9 10 Nov 2026
- CVE-2026-125334Forge: TLS client crash on a handshake record received without a sessionMedium 5.9 10 Nov 2026
- CVE-2026-118774Forge: Certificate signature verified with the issuer's RSA signature schemeLow 3.7 10 Nov 2026
- CVE-2026-118776Forge: Incomplete PKCS#7 padding validation in AES/DES CBC and ECB decryptionLow 3.7 10 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-118781
- GitHub Advisory Database https://github.com/advisories/GHSA-h6cr-wjv9-3cpp