Ai nanoid
nanoid: Integer Overflow or Wraparound
nanoid is a secure, URL-friendly, unique string ID generator for JavaScript. Prior to versions 3.3.12 and 5.1.11, the nanoid(size) function in index.js and index.cjs coerces the user-influenced size parameter to a signed 32-bit integer, allowing a value of 2147483648 to become -2147483648 and corrupt the process-wide CSPRNG poolOffset in fillPool(), which causes subsequent session tokens, CSRF tokens, API keys, and unique identifiers to become the deterministic string "uuuuuuuuuuuuuuuuuuuuu" until the process restarts. This issue is fixed in versions 3.3.12 and 5.1.11.
Affected versions and mitigation
From the CVE record and the vendor's references.Affected
- < 3.3.12
- >= 4.0.0, < 5.1.11
Fixed in 3.3.12, 5.1.11
Mitigation
Upgrade nanoid to 3.3.12 or 5.1.11 or later.
References
- Vendor advisory github.com/ai/nanoid/security/advisories/GHSA-…
- Patch github.com/ai/nanoid/commit/7087969281cab8ba8a…
- Patch github.com/ai/nanoid/commit/821dfed7b5db7f88e9…
3 more
- Patch github.com/ai/nanoid/commit/b0036ed60dc9facd7f…
- Release notes github.com/ai/nanoid/releases/tag/3.3.12
- Release notes github.com/ai/nanoid/releases/tag/5.1.11
Timeline
Days relative to CVE publicationNo public PoC found yet; not in CISA KEV.
PoC repositories
Found on GitHub.No PoC repositories found yet.