Intel

AIKIDO-2026-712572

nanoid is vulnerable to Denial of Service (DoS)

Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published Jul 8, 2026
July 8, 2026

45

CVE Score

Medium

Denial of Service (DoS)

Are you affected? Scan for Free

TL;DR

The internal fillPool helper sizes a random-byte pool directly from the requested ID length and computes Buffer.allocUnsafe(bytes * POOL_SIZE_MULTIPLIER) without validating an upper bound. When code passes an excessively large or negative size to nanoid or random, this drives an oversized memory allocation that throws or exhausts memory and can crash the process. Applications that derive the requested ID length from untrusted input are exposed to a denial-of-service condition. The fix makes fillPool throw a RangeError when the requested size is negative or greater than 1024.

How do I fix this?

Upgrade the nanoid library to the patch version.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your application passes an untrusted or user-controlled size to the ID generator.

Package

Versions

3.1.16 - 3.3.11

Fixed in 3.3.12

4.0.0 - 5.1.10

Fixed in 5.1.11

Background info

nanoid is vulnerable to Denial of Service (DoS) in versions 3.1.16 - 3.3.11 and 4.0.0 - 5.1.10.

Get secure today,
quickly and for free.

Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.

No credit card required | Scan results in 32 seconds.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea