Vulnerabilities/

nanoid: non-secure generators can loop indefinitely with negative size

Severity:
High

Description

nanoid (Nano ID) before 5.1.16 contains an infinite loop in the customAlphabet and nanoid functions of its non-secure module (nanoid/non-secure). When these functions are given a negative size, the loop counter is decremented from a negative value and never reaches its termination condition, spinning indefinitely and hanging the calling thread.

Recommendation

Update the nanoid package to the latest compatible version. Followings are version details:

References

Related Issues

Tags:
npm
nanoid
Anything's wrong? Let us know Last updated on August 07, 2026