ADVISORIES

GitHub Advisory Database

GHSA-378v-28hj-76wf

bn.js affected by an infinite loop

Moderate CVE-2026-2739

Details

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.

Affected packages

EcosystemPackageAffected versions
npmbn.js
All versions before 4.12.3 (fixed in 4.12.3)
npmbn.js
From 5.0.0 before 5.2.3 (fixed in 5.2.3)

References