All vulnerabilities

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".

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
nanoidnpm · osv:npm:nanoid
  • Every version before 3.3.12
  • From 4.0.0 before 5.1.11

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
Search the list for nanoid

References