Description
nanoid (Nano ID) before 5.1.6 contains an infinite loop in the customAlphabet and customRandom functions. When these functions are configured with a size of 0, the internal generation loop never satisfies its exit condition and spins indefinitely, hanging the calling thread.
Recommendation
Update the nanoid package to the latest compatible version. Followings are version details:
Affected version(s): **< 3.3.18 >= 4.0.0, < 5.1.6** Patched version(s): **3.3.18 5.1.6**
References
Could your website be exposed too?
SmartScanner can check your website for nanoid: custom generators can loop indefinitely when size is zero and gives you actionable findings to investigate.
Start a free scanRelated Issues
- nanoid: non-secure generators can loop indefinitely with negative size - CVE-2026-67214
- fflate unzipSync can enter an infinite loop when parsing malformed ZIP64 archives - CVE-2026-45820
- jsrsasign is vulnerable to DoS through Infinite Loop when processing zero or negative inputs - CVE-2026-4598
- figlet is vulnerable to denial of service via unbounded loop when whitespaceBreak is used with a small width - CVE-2026-96780


