Predictable results in nanoid generation when given non-integer values
- Severity:
- Medium
Description
When nanoid is called with a fractional value, there were a number of undesirable effects:
- in browser and non-secure, the code infinite loops on while (size–)
- in node, the value of poolOffset becomes fractional, causing calls to nanoid to return zeroes until the pool is next filled 3.
Recommendation
Update the nanoid package to the latest compatible version. Followings are version details:
Affected version(s): **< 3.3.8 >= 4.0.0, < 5.0.9** Patched version(s): **3.3.8 5.0.9**
References
Related Issues
- @blakeembrey/template vulnerable to code injection when attacker controls template input - CVE-2024-45390
- Generation of Error Message Containing Sensitive Information in zsa - CVE-2024-37162
- Plate media plugins has a XSS in media embed element when using custom URL parsers - CVE-2024-40631
- tiny-secp256k1 vulnerable to private key extraction when signing a malicious JSON-stringifyable message in bundled envir - CVE-2024-49364
You might also like:
- Tags:
- npm
- nanoid
Anything's wrong? Let us know Last updated on November 04, 2025


