npm
CVE-2026-73086
nanoid: Integer Overflow or Wraparound
- Severity
- High 7.4
- Published
- 1 Sept 2026
- Last changed
- 1 Sept 2026
- Added to UpHeron
- 22 Oct 2026
- Fixed in
- 3.3.12, 5.1.11
- Exploit chance
- 0.3% in the next 30 daysHigher than 22% of CVEs. EPSS by FIRST, 19 Nov 2026
- Weakness
- Integer overflow (CWE-190)
- Attack
- Over the network · Only under certain conditions · No login needed · No user action needed
- Attacker can
- Read data · Change data
- CVSS vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:N- Also known as
- GHSA-xwg4-73v4-xw9w
- Sources
- OSV.dev and GitHub
Description
An integer overflow in nanoid(size) permanently corrupts the process-wide CSPRNG pool, causing all subsequent ID generation to return the deterministic string "uuuuuuuuuuuuuuuuuuuuu". Any application that passes user-influenced values to the size parameter loses all randomness guarantees for session tokens, CSRF tokens, and unique identifiers until process restart.
nanoid() at index.js:101 coerces the size parameter with size |= 0, which converts it to a signed 32-bit integer. When size >= 2^31 (e.g., 2147483648), this wraps to -2147483648.
The negative value is passed to fillPool() (index.js:15):
Neither branch triggers, so the pool is never refreshed. poolOffset becomes ~-2.1 billion.
Subsequent nanoid() calls execute:
pool[negative_index] returns undefined. undefined & 63 evaluates to 0. urlAlphabet[0] is 'u'. Every ID becomes "uuuuuuuuuuuuuuuuuuuuu".
Affected software
| Software | Affected versions |
|---|---|
nanoidnpm · osv:npm:nanoid |
|
About nanoid
- Weekly downloads (npm)
- 375,837,087npm, 15 Nov 2026
Vulnerabilities in nanoid
- In our list
- 4
- Published in the last 12 months
- 3
- Critical, last 12 months
- 0
- High, last 12 months
- 3
- Known exploited
- 0
- CVE-2026-67214nanoid: non-secure generators can loop indefinitely with negative sizeHigh 5.9 29 Jul 2026
- CVE-2026-67213nanoid: custom generators can loop indefinitely when size is zeroHigh 5.9 29 Jul 2026
- CVE-2024-55565Predictable results in nanoid generation when given non-integer valuesMedium 4.3 9 Dec 2024
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-73086
- GitHub Advisory Database https://github.com/advisories/GHSA-xwg4-73v4-xw9w