nanoid is vulnerable to Denial of Service (DoS)
59
Medium Risk
The customAlphabet and customRandom generators in nanoid build an identifier inside a loop that only exits once the requested count of characters is produced. When these functions receive a size of 0, the loop never satisfies its exit condition and spins indefinitely, hanging the calling thread. An application that forwards an unvalidated, externally influenced size of 0 into these functions is exposed to a denial-of-service condition. The fix returns an empty string for a zero size so the loop terminates.
You are affected if you are using a version that falls within the vulnerable range and your application passes an unvalidated, externally influenced size of 0 to the customAlphabet or customRandom functions.
nanoid is vulnerable to Denial of Service (DoS) in versions 0.0.1 - 5.1.5.
Upgrade the org.webjars.npm:nanoid library to the patch version.
Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.
Free. No credit card required.

I consent to receiving marketing communications based on Aikido’s Privacy Policy.
SOC 2Compliant
ISO 27001Compliant