CVE-2026-67213: nanoid before 5.1.6 Infinite Loop via Zero Size in customAlphabet and customRandom

Published Jul 29, 2026
·
Updated

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. An application that passes an unvalidated, attacker-controlled size of 0 to these functions is exposed to a denial-of-service condition.

Affected Software

3 affected components
nanoid<5.1.6
Nanoid Project Nanoid Node.js>=3.0.0<3.3.17
Nanoid Project Nanoid Node.js>=5.0.0<5.1.6

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade nanoid (Nano ID) to a version that resolves this vulnerability.

    Fixed in 5.1.6
  2. Configuration

    Ensure the attacker-controlled size passed to nanoid customAlphabet and customRandom is never configured as 0; reject/validate size inputs to be greater than 0 to avoid the infinite generation loop that hangs the calling thread (vulnerable in versions before 5.1.6).

    nanoid (Nano ID) customAlphabet/customRandom size parameter = must be > 0

Event History

Jul 29, 2026
CVE Published
via MITRE·01:32 PM
Data Sourced
via MITRE·01:32 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·02:16 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-67213?

The severity of CVE-2026-67213 is classified as medium with a score of 5.9.

2

How do I fix CVE-2026-67213?

To fix CVE-2026-67213, upgrade nanoid to version 5.1.6 or later.

3

What impact does CVE-2026-67213 have on applications?

CVE-2026-67213 can cause applications to hang indefinitely when using the customAlphabet and customRandom functions with a size of 0.

4

What functions are affected by CVE-2026-67213?

CVE-2026-67213 impacts the customAlphabet and customRandom functions in nanoid versions prior to 5.1.6.

5

When was CVE-2026-67213 published?

CVE-2026-67213 was published on July 29, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203