Skip to main content

Loop with Unreachable Exit Condition ('Infinite Loop') in bn.js

CVE-2026-2739

  • bn.js
  • org.webjars.npm:bn.js
Severity Medium
Score 5.5/10

Summary

This affects versions of the package bn.js prior to 4.12.3 and 5.x prior to 5.2.3. Calling maskn(0) on any BN instance corrupts the internal state, causing toString(), divmod(), and other methods to enter an infinite loop, hanging the process indefinitely.

  • LOW
  • NETWORK
  • NONE
  • UNCHANGED
  • NONE
  • NONE
  • NONE
  • LOW

CWE-835 - Loop with Unreachable Exit Condition

Loops with multiple exits and flags detract from the quality of an application. They tend to make control structures difficult to understand, and introduce the risk of non-termination and other structural problems. The vulnerability “loop with unreachable exit condition” enables attackers to exploit this flaw, leading to denial of service.

Advisory Timeline

  • Published