Description
This affects versions of the package bn.js before 4.12.3 and 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.
Recommendation
Update the bn.js package to the latest compatible version. Followings are version details:
Affected version(s): **>= 5.0.0, < 5.2.3 < 4.12.3** Patched version(s): **5.2.3 4.12.3**
References
Could your website be exposed too?
SmartScanner can check your website for bn.js affected by an infinite loop and gives you actionable findings to investigate.
Start a free scanRelated Issues
- jsrsasign is vulnerable to DoS through Infinite Loop when processing zero or negative inputs - CVE-2026-4598
- protobufjs: Denial of Service via infinite loop in .proto option parsing - CVE-2026-59877
- Mermaid XY Charts are vulnerable to an infinite loop DoS - CVE-2026-71436
- Mermaid Gantt Charts are vulnerable to an Infinite Loop DoS - CVE-2026-41150


