Node.js CVE-2026-33891
HIGHAttack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSend request to application using node-forge
-
ExploitTrigger modInverse() with zero input
-
ExecutionExtended Euclidean Algorithm enters infinite loop
-
ImpactProcess hangs and consumes 100% CPU
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A06:2021 - Vulnerable and Outdated Components
ASVS 5.0
V15 - Secure Coding and Architecture Loop termination conditions
MITRE ATT&CK
1 technique across 1 tactic: Impact The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | No special conditions — remote unauthenticated attacker can trigger DoS by sending input causing node-forge's BigInteger.modInverse() to process zero values. Affects all versions of node-forge library when modInverse() is invoked with zero parameter. |
| Impact | Real-world risk is HIGH for applications that expose cryptographic operations to untrusted input. The CVSS 3.1 vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H indicates network-reachable exploitation with low complexity, no privileges required, and no user interaction-a worst-case accessibility profile for availability attacks. A single malicious request can render an entire Node.js application unresponsive by blocking the event loop, affecting all concurrent users. The publicly available proof-of-concept lowers the exploitation barrier significantly, though no CISA KEV listing or active exploitation evidence exists at time of analysis. Attack surface includes any application using node-forge for DSA/ECDSA signature verification (where crafted signatures with s=0 trigger the vulnerability), custom RSA/Diffie-Hellman implementations accepting user parameters, or any cryptographic protocol passing attacker-influenced values to modInverse(). Given node-forge's status as a widely deployed cryptographic library with millions of weekly npm downloads (referenced in tags: Node.js, Microsoft, Apple ecosystems), the blast radius is substantial. This is a genuine priority for organizations running Node.js cryptographic services exposed to untrusted networks, not merely a theoretical high-CVSS issue-the combination of trivial exploitation (AC:L, PR:N), proven POC, and complete availability impact (A:H) against a popular library creates immediate operational risk. |
| Exploit ScenarioDerived | An attacker submits a crafted DSA or ECDSA signature with the s component set to zero to a Node.js web service using node-forge for signature verification. When the verification logic calls s.modInverse(q) to validate the signature, the BigInteger.modInverse() function enters an infinite loop, pinning one CPU core at 100% utilization and blocking the Node.js event loop indefinitely. All subsequent requests to the application hang without response, achieving complete Denial of Service with a single malicious payload. Publicly available exploit code exists demonstrating the vulnerability triggers within 5 seconds, making this trivially exploitable by remote unauthenticated attackers against any exposed cryptographic endpoint. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Mar 26, 2026
The node-forge cryptographic library for Node.js suffers from a complete Denial of Service condition when the BigInteger.modInverse() function receives zero as input, causing an infinite loop that consumes 100% CPU and blocks the event loop indefinitely. All versions of node-forge (npm package) are affected, impacting applications that process untrusted cryptographic parameters through DSA/ECDSA signature verification or custom modular arithmetic operations. CVSS 7.5 (High severity) reflects network-reachable, unauthenticated exploitation with no user interaction required. A working proof-of-concept exists demonstrating the vulnerability triggers within 5 seconds. Vendor patch is available via GitHub commit 9bb8d67b99d17e4ebb5fd7596cd699e11f25d023.
RemediationAI
Vendor-released patch is available via GitHub commit 9bb8d67b99d17e4ebb5fd7596cd699e11f25d023 accessible at https://github.com/digitalbazaar/forge/commit/9bb8d67b99d17e4ebb5fd7596cd699e11f25d023. Organizations should update to the patched version once released to npm by monitoring the official repository at https://github.com/digitalbazaar/forge and consulting the vendor security advisory at https://github.com/digitalbazaar/forge/security/advisories/GHSA-5m6q-g25r-mvwx for release announcements. Until patching is feasible, implement input validation to reject zero values before they reach BigInteger.modInverse() calls, particularly in signature verification and modular arithmetic code paths processing untrusted data. Deploy application-layer rate limiting and request timeouts to contain the impact of potential exploitation attempts. For high-risk deployments, consider isolating cryptographic operations in separate worker processes with resource limits and health monitoring to prevent event loop blocking from cascading to the entire application. Network-level controls such as restricting cryptographic service endpoints to authenticated, trusted clients can reduce attack surface where architecturally viable.
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The vulnerability resides in node-forge's bundled copy of the jsbn (JavaScript Big Number) library, specifically the bnModInverse() function in lib/jsbn.js that implements the Extended Euclidean Algorithm for computing modular multiplicative inverses. Per CPE identifier pkg:npm/node-forge, this affects the npm distribution of node-forge across all published versions. The root cause is CWE-835 (Loop with Unreachable Exit Condition): mathematically, the modular inverse of zero does not exist since gcd(0, m) equals m (not 1) for any modulus m greater than 1, but the implementation lacks input validation before entering the algorithm's main loop. When this equals zero, the loop termination condition becomes unreachable, resulting in infinite execution. This is a classic example of missing domain constraint validation in cryptographic primitives where the algorithm assumes valid mathematical inputs without runtime verification.
Know when Node.js gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Primary rating from Vendor (https://github.com/digitalbazaar/forge).
CVSS VectorVendor: https://github.com/digitalbazaar/forge
Lifecycle Timeline
2DescriptionCVE.org
Summary
A Denial of Service (DoS) vulnerability exists in the node-forge library due to an infinite loop in the BigInteger.modInverse() function (inherited from the bundled jsbn library). When modInverse() is called with a zero value as input, the internal Extended Euclidean Algorithm enters an unreachable exit condition, causing the process to hang indefinitely and consume 100% CPU. Affected Package
Package name: node-forge (npm: node-forge) Repository: https://github.com/digitalbazaar/forge Affected versions: All versions (including latest) Affected file: lib/jsbn.js, function bnModInverse() Root cause component: Bundled copy of the jsbn (JavaScript Big Number) library
Vulnerability Details
Type: Denial of Service (DoS) CWE: CWE-835 (Loop with Unreachable Exit Condition) Attack vector: Network (if the application processes untrusted input that reaches modInverse) Privileges required: None User interaction: None Impact: Availability (process hangs indefinitely) Suggested CVSS v3.1 score: 5.3-7.5 (depending on the context of usage)
Root Cause Analysis
The BigInteger.prototype.modInverse(m) function in lib/jsbn.js implements the Extended Euclidean Algorithm to compute the modular multiplicative inverse of this modulo m. Mathematically, the modular inverse of 0 does not exist - gcd(0, m) = m ≠ 1 for any m > 1. However, the implementation does not check whether the input value is zero before entering the algorithm's main loop. When this equals 0, the algorithm's loop condition is never satisfied for termination, resulting in an infinite loop. The relevant code path in lib/jsbn.js:
javascriptfunction bnModInverse(m) {
// ... setup ...
// No check for this == 0
// Enters Extended Euclidean Algorithm loop that never terminates when this == 0
}Attack Scenario
Any application using node-forge that passes attacker-controlled or untrusted input to a code path involving modInverse() is vulnerable. Potential attack surfaces include:
DSA/ECDSA signature verification - A crafted signature with s = 0 would trigger s.modInverse(q), causing the verifier to hang. Custom RSA or Diffie-Hellman implementations - Applications performing modular arithmetic with user-supplied parameters. Any cryptographic protocol where an attacker can influence a value that is subsequently passed to modInverse().
A single malicious request can cause the Node.js event loop to block indefinitely, rendering the entire application unresponsive.
Proof of Concept
Environment Setup
mkdir forge-poc && cd forge-poc
npm init -y
npm install node-forgeReproduction (poc.js) A single script that safely detects the vulnerability using a child process with timeout. The parent process is never at risk of hanging.
mkdir forge-poc && cd forge-poc
npm init -y
npm install node-forge
# Save the script below as poc.js, then run:
node poc.js'use strict';
const { spawnSync } = require('child_process');
const childCode = `
const forge = require('node-forge');
// jsbn may not be auto-loaded; try explicit require if needed
if (!forge.jsbn) {
try { require('node-forge/lib/jsbn'); } catch(e) {}
}
if (!forge.jsbn || !forge.jsbn.BigInteger) {
console.error('ERROR: forge.jsbn.BigInteger not available');
process.exit(2);
}
const BigInteger = forge.jsbn.BigInteger;
const zero = new BigInteger('0', 10);
const mod = new BigInteger('3', 10);
// This call should throw or return 0, but instead loops forever
const inv = zero.modInverse(mod);
console.log('returned: ' + inv.toString());
`;
console.log('[*] Testing: BigInteger(0).modInverse(3)');
console.log('[*] Expected: throw an error or return quickly');
console.log('[*] Spawning child process with 5s timeout...');
console.log();
const result = spawnSync(process.execPath, ['-e', childCode], {
encoding: 'utf8',
timeout: 5000,
});
if (result.error && result.error.code === 'ETIMEDOUT') {
console.log('[VULNERABLE] Child process timed out after 5s');
console.log(' -> modInverse(0, 3) entered an infinite loop (DoS confirmed)');
process.exit(0);
}
if (result.status === 2) {
console.log('[ERROR] Could not access BigInteger:', result.stderr.trim());
console.log(' -> Check your node-forge installation');
process.exit(1);
}
if (result.status === 0) {
console.log('[NOT VULNERABLE] modInverse returned:', result.stdout.trim());
process.exit(1);
}
console.log('[NOT VULNERABLE] Child exited with error (status ' + result.status + ')');
if (result.stderr) console.log(' stderr:', result.stderr.trim());
process.exit(1);Expected Output
[*] Testing: BigInteger(0).modInverse(3)
[*] Expected: throw an error or return quickly
[*] Spawning child process with 5s timeout...
[VULNERABLE] Child process timed out after 5s
-> modInverse(0, 3) entered an infinite loop (DoS confirmed)
Verified Onnode-forge v1.3.1 (latest at time of writing) Node.js v18.x / v20.x / v22.x macOS / Linux / Windows
Impact
Availability: An attacker can cause a complete Denial of Service by sending a single crafted input that reaches the modInverse() code path. The Node.js process will hang indefinitely, blocking the event loop and making the application unresponsive to all subsequent requests. Scope: node-forge is a widely used cryptographic library with millions of weekly downloads on npm. Any application that processes untrusted cryptographic parameters through node-forge may be affected.
Suggested Fix
Add a zero-value check at the entry of bnModInverse() in lib/jsbn.js:
function bnModInverse(m) {
var ac = m.isEven();
// Add this check:
if (this.signum() == 0) {
throw new Error('BigInteger has no modular inverse: input is zero');
}
// ... rest of the existing implementation ...
}Alternatively, return BigInteger.ZERO if that behavior is preferred, though throwing an error is more mathematically correct and consistent with other BigInteger implementations (e.g., Java's BigInteger.modInverse() throws ArithmeticException).
Blast Radius
ecosystem impact- 183 npm packages depend on node-forge (80 direct, 105 indirect)
Ecosystem-wide dependent count for version 1.4.0.
Executive ViewAI
Node.js applications using the node-forge cryptographic library are vulnerable to complete service disruption through a single malicious cryptographic parameter, allowing unauthenticated remote attackers to crash application instances by triggering an infinite CPU loop in the modular inverse function. Organizations relying on node-forge for signature verification, encryption operations, or any cryptographic processing of untrusted input face immediate availability risk with no authentication barrier to exploitation.
Apply vendor patch. Until patched: (1) implement network-layer rate limiting on cryptographic API endpoints to restrict malformed parameter submission frequency; (2) deploy Web Application Firewall rules to reject requests containing zero-value modular arithmetic parameters in signature verification workflows; (3) segment cryptographic processing components behind authenticated gateways; (4) configure process monitoring and auto-restart policies to mitigate CPU loop impact; (5) audit application logs for repeated modInverse() failures as early detection signal.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.
Affected Products (CPE)CVE.org
Remote code execution in n8n's workflow expression evaluation system allows an authenticated user with workflow creation
A vulnerability in the NuPoint Unified Messaging (NPM) component of Mitel MiCollab through 9.8 SP1 FP2 (9.8.1.201) could
FortiOS and FortiProxy contain an authentication bypass via the Node.js websocket module allowing unauthenticated remote
Denial of service against HTTP/2 server implementations allows remote unauthenticated attackers to exhaust server resour
Eval injection vulnerability in the internals.batch function in lib/batch.js in the bassmaster plugin before 1.5.2 for t
Flowise version 3.0.5 contains a remote code execution vulnerability in the CustomMCP node. The mcpServerConfig paramete
Node.js 8.5.0 before 8.6.0 allows remote attackers to access unintended files, because a change to ".." handling was inc
An issue was discovered in the node-serialize package 0.0.4 for Node.js. Rated critical severity (CVSS 9.8), this vulner
OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph
Directory traversal vulnerability in the st module before 0.2.5 for Node.js allows remote attackers to read arbitrary fi
Multiple SQL injection vulnerabilities in the Manage Accounts page in the AccountManagement.asmx service in the Solarwin
A vulnerability in NuPoint Messenger (NPM) of Mitel MiCollab through 9.8.0.33 allows an unauthenticated attacker to cond
NVD
CVE.org
EPSS
Vulnrichment
GitHub
VulDB
Exploit-DB