CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-2739

The Ghost in the Machine: How an Empty Number Killed the Node.js Event Loop

Alon Barad
Alon Barad
Software Engineer

Feb 20, 2026·6 min read·66 visits

Executive Summary (TL;DR)

Invoking `maskn(0)` on a BigNumber instance corrupts its internal state by setting its length to 0. This causes critical methods like `toString()` to enter an infinite loop, crashing Node.js applications.

A logic error in the widely used 'bn.js' BigNumber library allows for a Denial of Service via state corruption. By invoking the bitwise masking function with a zero length, an attacker can violate internal object invariants, creating a 'ghost' number with a length of zero. This corrupted state forces subsequent operations like serialization or division into infinite loops, freezing the single-threaded Node.js process instantly.

The Hook: Big Integers, Big Problems

JavaScript has a complicated relationship with numbers. For years, we were stuck with IEEE 754 doubles, meaning anything integer-like above $2^{53}$ was a gamble. Enter bn.js, the unsung hero of the ecosystem. It is the bedrock for elliptic curve cryptography, blockchain implementations, and basically anything in Node.js that needs to count higher than a standard database ID.

But here's the thing about foundational libraries: when they crack, the tremors are felt everywhere. CVE-2026-2739 isn't a buffer overflow or a remote code execution via some complex gadget chain. It's a logic bug. A simple, stupid logic bug that turns a mathematical operation into a weapon of mass thread-destruction.

This vulnerability exploits the internal representation of these big numbers. By asking the library to perform a specific bitwise operation—masking a number with zero bits—we can trick the object into an invalid state. It creates a number that technically exists but has no data. When the library tries to read this 'ghost' number, it panics, loops, and takes your server down with it.

The Flaw: The Impossible Zero

To understand the bug, you have to look under the hood of bn.js. Since JavaScript didn't support 64-bit integers natively for a long time, bn.js implements numbers as an array of 'words' (usually 26-bit chunks) and a length property tracking how many words are in use.

The Invariant: The library relies on a strict invariant: length must always be at least 1. Even the number 0 is represented as words: [0], length: 1. There is no such thing as a number with no words.

The Glitch: The vulnerability lies in maskn(bits) (and imaskn). This function is supposed to keep only the lowest n bits of the number. The logic calculates how many words are needed to hold those bits and truncates the rest.

However, the developers forgot a critical edge case: maskn(0). When you ask for the lowest 0 bits, the calculation effectively wipes the array. Prior to version 5.2.3, this operation would set this.length = 0.

Congratulations. You have created a zombie object. It is a BN instance that violates the fundamental laws of its own universe. It has no length. It is a void.

The Code: Anatomy of a Fix

The fix is almost insultingly simple, which is characteristic of the most dangerous bugs. The developers just needed to ensure that if the masking operation wipes the number clean, it resets to the canonical 'zero' state rather than the 'void' state.

Here is the diff from the patch. Note the explicit check for the zero-length condition:

// lib/bn.js
 
   BN.prototype.imaskn = function imaskn(bits) {
     // ... existing logic truncating words ...
 
     // The Vulnerable State: words might be empty now.
+    // The Fix: Force it back to a valid Zero.
+    if (this.length === 0) {
+      this.words[0] = 0;
+      this.length = 1;
+    }
 
     return this._strip();
   };

Without this guard clause, this.length remains 0. The _strip() method, which is supposed to remove leading zero words, assumes there is at least one word to check. When length is 0, the internal logic of downstream functions collapses.

The Exploit: One Line to Kill

You don't need Metasploit for this. You don't need heap spraying. You just need a Node.js console. The exploitation is trivial because the corruption happens silently. The crash doesn't occur when you create the bad number; it happens when you try to look at it.

The PoC:

const BN = require('bn.js');
 
// Step 1: Create a perfectly normal number
const target = new BN('123456');
 
// Step 2: Corrupt it. 
// We ask for the lowest 0 bits. Theoretically, this is 0.
// Practically, it creates an invalid object.
target.maskn(0);
 
// Step 3: Trigger the infinite loop.
// toString() relies on length to iterate. 
// With length 0, the loop condition is never met or underflows.
console.log("Goodbye, Event Loop...");
target.toString(); 

Why toString() hangs: The toString method usually performs repeated division and modulo operations to convert the number base (e.g., base 10). These algorithms loop while (number > 0). Because the internal state is corrupted (length: 0), the comparison logic fails to report '0', or the division step produces a result that doesn't reduce the problem size, resulting in an infinite while(true) scenario.

The Impact: Asymmetric Warfare

In a threaded environment like Java or C++, a CPU-spinning infinite loop is bad, but it usually only kills one worker thread. The rest of the application limps on.

Node.js is single-threaded. It runs on an event loop. If any operation blocks that loop—like a while(true) caused by a corrupt BigNumber—the entire process stops. It stops accepting HTTP requests. It stops processing database callbacks. It stops responding to health checks.

Attack Vectors:

  1. Smart Contracts/dApps: Many dApps use bn.js to handle token amounts. If a user can pass a parameter that results in a bit-mask of 0, they can freeze the processing node.
  2. Cryptography Handlers: If an implementation derives a mask length from user input (e.g., "give me the last N bits of this key"), sending N=0 triggers the DoS.
  3. Data Serialization: JSON endpoints that accept big integers and perform transformations before saving them are prime targets.

The Fix: Upgrade or Die

If you are running bn.js < 5.2.3, you are vulnerable. The dependency tree of the average Node project is deep and dark; you might not even know you are using it. elliptic, web3.js, and asn1.js all rely on it.

Remediation:

  1. Update Direct Dependencies: npm install bn.js@latest.
  2. Audit Transitive Dependencies: Use npm audit or yarn audit. You will likely need to regenerate lockfiles to force nested dependencies to grab the patched version.
  3. Defensive Coding: If you cannot update immediately, sanitize inputs. Never pass 0 to a bitwise mask function.
// The monkey-patch band-aid
const BN = require('bn.js');
const originalMaskn = BN.prototype.maskn;
BN.prototype.maskn = function(bits) {
  if (bits === 0) return new BN(0);
  return originalMaskn.apply(this, arguments);
};

This is a classic example of why input validation is hard—sometimes the invalid input (0) looks perfectly harmless.

Official Patches

indutny (GitHub)Official patch commit

Fix Analysis (1)

Technical Appendix

CVSS Score
6.9/ 10
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:N/VI:N/VA:L/SC:N/SI:N/SA:N/E:P
EPSS Probability
0.01%
Top 97% most exploited

Affected Systems

Node.js applications using `bn.js`Cryptographic libraries (`elliptic`, `crypto-browserify`)Web3.js and Ethereum-related SDKsASN.1 parsers relying on BigNum arithmetic

Affected Versions Detail

Product
Affected Versions
Fixed Version
bn.js
indutny
< 5.2.35.2.3
AttributeDetail
CWE IDCWE-835
Attack VectorNetwork (AV:N)
CVSS v4.06.9 (Medium)
ImpactDenial of Service (Infinite Loop)
Affected Componentbn.js `maskn`/`imaskn` methods
Exploit StatusPoC Available

MITRE ATT&CK Mapping

T1499.003Endpoint Denial of Service: OS Exhaustion
Impact
CWE-835
Infinite Loop

Loop with Unreachable Exit Condition ('Infinite Loop')

Known Exploits & Detection

GitHub GistProof of Concept demonstrating the infinite loop in bn.js

Vulnerability Timeline

Vulnerability reported by Kr0emer
2026-02-08
Fix committed to main branch
2026-02-19
Release 5.2.3 published to NPM
2026-02-19
CVE-2026-2739 published
2026-02-20

References & Sources

  • [1]GitHub Issue #316: maskn(0) causes infinite loop
  • [2]Snyk Advisory for CVE-2026-2739

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•10 minutes ago•CVE-2026-76485
9.8

CVE-2026-76485: Remote Code Execution in Cisco NX-OS VXLAN OAM (NGOAM)

CVE-2026-76485 is a critical stack-based buffer overflow vulnerability in the VXLAN OAM (NGOAM) parsing component of Cisco NX-OS Software. The flaw enables an unauthenticated, remote attacker to execute arbitrary code with root privileges or trigger a denial of service on affected Nexus switches. This vulnerability is triggered through crafted packets sent to an IP interface. No workarounds are currently available to mitigate the vulnerability while preserving the NGOAM functionality. Cisco has published software patches to address this flaw.

Alon Barad
Alon Barad
1 views•6 min read
•38 minutes ago•CVE-2026-106451
7.3

CVE-2026-106451: Local Privilege Escalation via JNI Extraction TOCTOU in lz4-java

A local privilege escalation and code execution vulnerability exists in the yawkat fork of lz4-java when extracting its bundled JNI shared library into the system temporary directory. Predictable path derivation and lack of exclusive file creation flags allow a local attacker to hijack library loading via a race condition.

Alon Barad
Alon Barad
4 views•6 min read
•about 2 hours ago•CVE-2026-105698
5.4

CVE-2026-105698: Missing Authorization in Deprecated Chat Vertices Endpoints in Langflow

A missing authorization vulnerability in Langflow versions 1.0.0 through 1.10.0 allows authenticated users (and unauthenticated users in versions prior to 1.7.2) to access private workflow structures and execute graph components by targeting deprecated API endpoints.

Amit Schendel
Amit Schendel
4 views•8 min read
•about 3 hours ago•CVE-2026-105697
9.9

CVE-2026-105697: OS Command Injection in Langflow Model Context Protocol Integration

A critical OS command injection vulnerability exists in Langflow's Model Context Protocol (MCP) server integration using stdio transport, allowing unauthenticated remote command execution under default configurations.

Alon Barad
Alon Barad
7 views•5 min read
•about 4 hours ago•CVE-2026-105745
6.7

CVE-2026-105745: Arbitrary Code Execution via Malicious Entrypoint Discovery in Docling base_factory

Docling prior to version 2.131.0 is vulnerable to arbitrary local code execution during module initialization due to incorrect order of operations in its plugin discovery system. Even when the default option to reject external plugins is active, Docling utilizes Pluggy to scan and import entrypoints before performing namespace validation.

Amit Schendel
Amit Schendel
7 views•6 min read
•about 5 hours ago•CVE-2026-105749
6.5

CVE-2026-105749: Unbounded Table Attributes in Docling Backends Leads to Resource Exhaustion

An uncontrolled resource consumption vulnerability exists in the Docling document conversion library. Maliciously structured HTML, JATS, ODS, or BoxNote inputs containing table cells with excessively large 'rowspan' or 'colspan' attribute values trigger algorithmic complexity conditions. This allows unauthenticated remote attackers to initiate resource exhaustion states, crashing or hanging the target document processing pipeline while bypassing configured timeouts.

Amit Schendel
Amit Schendel
10 views•6 min read