Advisory

GHSA-2v37-7h3g-55p8

Also known as: CVE-2026-67213

Summary

nanoid: custom generators can loop indefinitely when size is zero

Details

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.

Severity

High Basis: The source's own band: HIGH

Dates

Published
2026-07-29 15:31 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

nanoid

npm · All systems

Affected

  • introduced 0, fixed 3.3.18 (semver)

Fixed versions

3.3.18

Fix

nanoid

npm · All systems

Affected

  • introduced 4.0.0, fixed 5.1.6 (semver)

Fixed versions

5.1.6

Fix

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: GitHub Advisory Database (reviewed advisories) · CC BY 4.0

Sources & licences