CVE-2026-33891: node-forge Denial of Service via Infinite Loop in BigInteger.modInverse()

node-forge Updated 26 Mar 2026

Summary

26/03/2026
Yes i
High
7.5

CVE-2026-33891: Forge has Denial of Service via Infinite Loop in BigInteger.modInverse() with Zero Input. Affects node-forge versions < 1.4.0. Fixed in 1.4.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Your last release was probably never penetration tested Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

node-forge is a widely used cryptographic library in JavaScript that provides various functionalities for secure communications, including encryption, decryption, and digital signatures. It is particularly popular in Node.js applications due to its ease of use and comprehensive feature set. However, the library has a critical vulnerability that affects its BigInteger.modInverse() function, which can lead to a Denial of Service (DoS) when provided with a zero input.

Vulnerability Detail

The vulnerability arises from an infinite loop in the BigInteger.modInverse() function, which is part of the bundled jsbn library. When this function is called with a zero value as input, it enters an unreachable exit condition in the Extended Euclidean Algorithm, causing the process to hang indefinitely and consume 100% CPU resources. This can lead to a complete Denial of Service, making the application unresponsive to all requests. The vulnerability affects all versions of node-forge, as there is no input validation for zero values in the modInverse() function.

How To Fix

Latest published version: 1.4.0 as of 22 Oct 2026

npm install node-forge@1.4.0

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

If you cannot immediately update the package, you can implement a workaround by ensuring that any input passed to the

modInverse() function is validated to be non-zero. For example, you can add a check before calling modInverse(): if (inputValue === 0) { throw new Error('Input must not be zero');

}

Conclusion

The node-forge library has a critical Denial of Service vulnerability due to an infinite loop in the BigInteger.modInverse() function when called with a zero input. It is essential to update to version 1.4.0 or later to mitigate this risk. Additionally, implementing input validation can help prevent this issue in the interim.

See every vulnerability recorded for node-forge →

Share this vulnerability

FAQ

The CVSS score of this vulnerability is 7.5, indicating a high severity level.

All versions of node-forge are affected by this vulnerability, including the latest version at the time of writing.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Without requiring access to the code or installation, Vulert uses just package-lock.json to check for vulnerabilities.

If you cannot update the package, implement input validation to ensure that zero values are not passed to the modInverse() function.

Yes, a proof of concept is available that demonstrates the infinite loop when calling BigInteger(0).modInverse(3). You can run the provided script to confirm the vulnerability.

Related vulnerabilities

Recent vulnerabilities recorded for node-forge.

How To Fix

Latest published version: 1.4.0 as of 22 Oct 2026

npm install node-forge@1.4.0

The newest release already contains this fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback