---
id: "CVE-2026-118781"
kind: "vulnerability"
aliases: ["CVE-2026-118781"]
title: "node-forge: crafted RSA exponent can hang Node.js event loop"
severity: "low"
cvss: 2.9
epss: null
exploited: false
status: "open"
category: "package"
products: []
ecosystems: []
tags: ["javascript", "node-forge", "node.js", "package"]
not_affected_if: ["no-user-controlled-rsa-exponent", "parse-only-usage"]
published_at: "2026-10-29T19:17:20+00:00"
first_seen_at: "2026-10-29T19:26:47+00:00"
updated_at: "2026-10-29T19:27:37+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-118781", "first_seen_at": "2026-10-29T19:26:47+00:00"}]
---

# node-forge: crafted RSA exponent can hang Node.js event loop

node-forge, a JavaScript TLS and crypto library, could enter an infinite loop in its bundled modInverse routine when given a negative value or modulus. An attacker who controls the RSA public exponent passed to key generation, or a direct modInverse operand, can pin the Node.js process at full CPU and block it.

_Summary, check and fix written by a model from the sources; labelled as such._

## How to check

- Check the installed version of `node-forge` in your lockfile, for example with `npm ls node-forge`.
- Look for code that passes caller-supplied values as RSA public exponents to key generation or calls modInverse directly.

## Fix

- `node-forge` `1.4.1`

## Timeline

- 2026-10-29T19:26:47+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-118781

## From the sources

Forge (also called node-forge) is a native implementation of Transport Layer Security in JavaScript. Prior to 1.4.1, the affected implementation used BigInteger.prototype.modInverse(), bnModInverse(), lib/jsbn.js, RSA public exponent e to process the relevant input or security decision. node-forge's bundled jsbn implementation entered an infinite loop when BigInteger.prototype.modInverse() received a negative value or modulus. An attacker who could control the RSA public exponent passed to key generation, or a direct modInverse() operand, could block the Node.js event loop at full CPU. Parsed DER, PEM, JWK, PKCS#12, X.509, and TLS values are unsigned and cannot trigger this issue. This issue is fixed in version 1.4.1.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
