CVE Database›Document archive›CVE-2026-67213

CVE-2026-67213

nanoid: nanoid: Denial of Service via infinite loop in random ID generation

Loading…

Severity

Important

Red Hat Product Security

7.5

CVSS 3.1

Review impact separately from score.

Published · July 29, 2026

Updated · November 1, 2026

Description

A flaw was found in nanoid (Nano ID), a small, secure, and URL-friendly unique string ID generator. An attacker could exploit this vulnerability by providing a zero-size input to the customAlphabet or customRandom functions. This would cause an infinite loop, leading to a denial of service (DoS) condition by hanging the application's calling thread.

Statement

An algorithmic denial of service flaw was found in the nanoid library. When calling customAlphabet or customRandom with a size parameter of 0, the internal generation loop fails to meet its termination condition. In Node.js or browser execution contexts, an attacker who supplies an unvalidated, zero-value size parameter to these functions causes the thread to enter an infinite loop, driving CPU utilization to 100% and completely blocking event loop execution for that thread.

CVSS score applicability

The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.

Mitigation

To mitigate this issue, ensure application code validates the size parameter passed to customAlphabet or customRandom, rejecting or sanitizing zero-value inputs before passing them to nanoid.

CVSS / CWE

CVSS 3.1 · 7.5
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

CWE-835 · Loop with Unreachable Exit Condition