CVE-2026-33891
Denial of Service in node-forge BigInteger.modInverse Function
Publication date: 2026-03-27
Last updated on: 2026-04-08
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
| Vendor | Product | Version / Range |
|---|---|---|
| digitalbazaar | forge | to 1.3.3 (inc) |
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-835 | The product contains an iteration or loop with an exit condition that cannot be reached, i.e., an infinite loop. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
CVE-2026-33891 is a Denial of Service (DoS) vulnerability in the node-forge JavaScript library, specifically in the BigInteger.modInverse() function from the bundled jsbn library.
When modInverse() is called with a zero input value, the internal Extended Euclidean Algorithm enters an infinite loop because zero has no modular inverse and the function lacks a proper check for this case.
This causes the Node.js process to hang indefinitely and consume 100% CPU, leading to complete unavailability of the application.
The issue was fixed in version 1.4.0 by adding a guard clause that immediately returns zero if the input is zero, preventing the infinite loop.
How can this vulnerability impact me? :
This vulnerability can cause your Node.js application using node-forge (versions β€ 1.3.1) to become unresponsive due to an infinite loop triggered by a zero input to the modInverse() function.
An attacker can exploit this by supplying crafted input that reaches the vulnerable function, such as in cryptographic operations like DSA/ECDSA signature verification or custom RSA/Diffie-Hellman implementations.
A single malicious request can block the Node.js event loop indefinitely, causing a denial of service and making the application unavailable to legitimate users.
How can this vulnerability be detected on my network or system? Can you suggest some commands?
This vulnerability can be detected by observing if the Node.js process using the node-forge library hangs indefinitely or consumes 100% CPU when processing certain inputs. Specifically, if the BigInteger.modInverse() function is called with a zero value, it causes an infinite loop leading to a denial of service.
A proof-of-concept involves calling modInverse() on a BigInteger instance with zero, which causes the process to hang. To test this, you can run a Node.js script that creates a BigInteger zero and calls modInverse with a modulus, then observe if the process hangs or exits.
Example command to test the vulnerability (in a Node.js environment):
- Create a script (e.g., testModInverse.js) with the following content: ```javascript const BigInteger = require('node-forge').jsbn.BigInteger; const zero = new BigInteger('0'); console.log(zero.modInverse(new BigInteger('3')).toString()); ``` Run the script with `node testModInverse.js`. If the process hangs indefinitely or consumes 100% CPU, the vulnerability is present.
Monitoring your system for Node.js processes stuck at high CPU usage or unresponsive behavior during cryptographic operations involving node-forge can also indicate exploitation attempts.
What immediate steps should I take to mitigate this vulnerability?
The immediate mitigation step is to upgrade the node-forge library to version 1.4.0 or later, where the vulnerability has been patched.
The patch adds a guard clause in the bnModInverse() function to check if the BigInteger instance is zero and immediately return zero instead of entering an infinite loop.
If upgrading immediately is not possible, consider implementing input validation to prevent zero values from being passed to the modInverse() function in your application.
Additionally, monitor your Node.js processes for high CPU usage or hangs and be prepared to restart affected services if exploitation is suspected.
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:
The vulnerability causes a Denial of Service (DoS) by hanging the Node.js process and consuming 100% CPU, leading to complete unavailability of the affected application.
Such unavailability can impact compliance with standards and regulations like GDPR and HIPAA, which require maintaining availability and reliability of systems processing sensitive or personal data.
If an application using node-forge is part of a system handling regulated data, this DoS vulnerability could lead to service interruptions, potentially violating availability requirements under these regulations.