Advisory

GHSA-mwcw-c2x4-8c55

Also known as: CVE-2024-55565

Summary

Predictable results in nanoid generation when given non-integer values

Details

When nanoid is called with a fractional value, there were a number of undesirable effects:

  1. in browser and non-secure, the code infinite loops on while (size--)
  2. in node, the value of poolOffset becomes fractional, causing calls to nanoid to return zeroes until the pool is next filled
  3. if the first call in node is a fractional argument, the initial buffer allocation fails with an error

Version 3.3.8 and 5.0.9 are fixed.

Severity

Medium Basis: The source's own band: MODERATE

Dates

Published
2024-12-09 03:30 UTC
Modified
2026-09-10 03:50 UTC

Affected packages and fixes

nanoid

npm · All systems

Affected

  • introduced 4.0.0, fixed 5.0.9 (semver)

Fixed versions

5.0.9

Fix

nanoid

npm · All systems

Affected

  • introduced 0, fixed 3.3.8 (semver)

Fixed versions

3.3.8

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