Intel

AIKIDO-2026-347393

nanoid is vulnerable to Denial of Service (DoS)

Denial of Service (DoS)CVE-2026-67214 Published 3 days ago

59

Medium Risk

This Affects:

JAVAnanoid
0.0.1 - 5.1.15
Fixed in 5.1.16
Are you affected? Scan for Free

TL;DR

The customAlphabet and nanoid generators in the non-secure module of nanoid decrement a loop counter until it reaches zero to build an identifier. When these functions receive a negative size, the counter starts below zero and the while (i--) loop never reaches its termination condition, spinning indefinitely and hanging the calling thread. An application that forwards an unvalidated, externally influenced negative size into these functions is exposed to a denial-of-service condition. The fix guards the loop with i-- > 0 so a negative size produces an empty string instead of looping forever.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your application passes an unvalidated, externally influenced negative size to the non-secure customAlphabet or nanoid functions.

Background info

nanoid is vulnerable to Denial of Service (DoS) in versions 0.0.1 - 5.1.15.

How to fix this

Upgrade the org.webjars.npm:nanoid library to the patch version.