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.

Other sources

nanoid before 5.1.6 Infinite Loop via Zero Size in customAlphabet and customRandom

— Microsoft

Affected Software

13 affected componentsFixes available
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
npm/nanoid<3.3.18
3.3.18
npm/nanoid>=4.0.0<5.1.6
5.1.6
All of the following
azurelinux/python-jupytext<0:1.19.6-2.azl4
0:1.19.6-2.azl4
Microsoft Azure Linux=4.0
IBM watsonx.data<=2.4.0 - 2.4.0 patch 8
debian/node-mocha
9.1.4+ds1+~cs28.2.8-1
debian/node-postcss<=8.4.20+~cs8.0.23-1+deb12u1, <=8.4.49+~cs9.2.32-1
8.5.8+~cs9.3.30-1
ubuntu/node-postcss*
ubuntu/node-postcss*
ubuntu/node-postcss*

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/nanoid to a version that resolves this vulnerability.

    Fixed in 3.3.18
  2. Upgrade

    Upgrade npm/nanoid to a version that resolves this vulnerability.

    Fixed in 5.1.6
  3. Upgrade

    Upgrade azurelinux/python-jupytext to a version that resolves this vulnerability.

    Fixed in 0:1.19.6-2.azl4
  4. Upgrade

    Upgrade debian/node-mocha to a version that resolves this vulnerability.

    Fixed in 9.1.4+ds1+~cs28.2.8-1
  5. Upgrade

    Upgrade debian/node-postcss to a version that resolves this vulnerability.

    Fixed in 8.5.8+~cs9.3.30-1
  6. Upgrade

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

    Fixed in 5.1.6
  7. 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 Red Hat·02:01 PM
DescriptionSeverityAffected Software
Data Sourced
via OSV·02:16 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·02:16 PM
DescriptionSeverityWeakness
Event
via NVD·02:16 PM
Advisory Published
via GitHub·03:31 PM
Data Sourced
via GitHub·03:31 PM
DescriptionSeverityWeaknessAffected Software
Aug 18, 2026
Data Sourced
via NVD·02:26 PM
RemedyAffected Software
Updated
via NVD·02:26 PM
Severity
Oct 8, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software
Oct 29, 2026
Updated
via IBM·12:00 AM
Affected Software
Nov 17, 2026
Data Sourced
via Microsoft·06:58 AM
DescriptionSeverityWeaknessAffected Software
Nov 19, 2026
Updated
via IBM·12:00 AM
Affected Software

Parent advisories

This vulnerability appears in the following advisories.

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