Infinite loop Affecting nanoid package, versions <3.3.17>=4.0.0 <5.1.6


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
0.32% (25th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-JS-NANOID-18506897
  • published2 Aug 2026
  • disclosed29 Jul 2026
  • creditUnknown

Introduced: 29 Jul 2026

NewCVE-2026-67213  (opens in a new tab)
CWE-835  (opens in a new tab)

How to fix?

Upgrade nanoid to version 3.3.17, 5.1.6 or higher.

Overview

Affected versions of this package are vulnerable to Infinite loop through the customRandom function in the customRandom implementation. An attacker can hang the calling thread by supplying a size of 0 to customRandom, which causes its ID generation loop to never reach a terminating condition. This breaks any application path that accepts an unvalidated, attacker-controlled size and passes it into customRandom, leaving the process stuck while handling the request.

References

CVSS Base Scores

version 4.0
version 3.1