Vulnerability library
Security checkAugust 07, 2026

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

Understand the exposure, see the recommended fix, and check whether your own website has related weaknesses.

High severitynpmnanoid

Check your website

Find this and other vulnerabilities with a free scan.

Your scan runs on your computer. No account required.

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:

  • Affected version(s): **>= 4.0.0, < 5.1.16 < 3.3.16**
  • Patched version(s): **5.1.16 3.3.16**

References

Could your website be exposed too?

SmartScanner can check your website for nanoid: non-secure generators can loop indefinitely with negative size and gives you actionable findings to investigate.

Start a free scan

Related Issues

See something that needs correcting? Let us knowUpdated August 07, 2026