Skip to main content

nanoid CVE-2026-67213

| EUVDEUVD-2026-50325 HIGH
Loop with Unreachable Exit Condition (Infinite Loop) (CWE-835)
2026-07-29 VulnCheck GHSA-2v37-7h3g-55p8
8.2
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Identify endpoint exposing nanoid size param
  2. Delivery
    Submit request with size=0
  3. Exploit
    Reach customAlphabet/customRandom call
  4. Execution
    Internal loop never exits
  5. Persist
    Calling thread hangs
  6. Impact
    Service denial for all users

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V15 - Secure Coding and Architecture Loop termination conditions
MITRE ATT&CK

1 technique across 1 tactic: Impact

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that the target application call nanoid's customAlphabet or customRandom function and pass a size (length) argument of exactly 0 that is derived from unvalidated, attacker-controlled input; this precondition is exactly what the CVSS 4.0 AT:P metric encodes. The default nanoid() generator and any usage with a hardcoded or server-validated positive size are NOT exploitable. Limiting factors: the vulnerable custom-generator code path must be reachable by the attacker, the size parameter must flow from untrusted input without a positive-integer check, and impact is confined to availability (thread hang / DoS) with no confidentiality or integrity effect. No authentication or user interaction is required by the library itself (PR:N/UI:N), but real exposure is entirely gated by the consuming application's design.

Impact

The CVSS 4.0 base score is 8.2 (High) with vector AV:N/AC:L/AT:P/PR:N/UI:N and impact isolated to availability (VA:H; VC:N/VI:N). The AT:P (Attack Requirements: Present) metric is the crucial signal: exploitation is not universal against all deployments but requires the specific precondition that the consuming application passes an attacker-influenced size of 0 into customAlphabet/customRandom. There is no EPSS score, no KEV listing, and no confirmed public PoC in the provided data, so the real-world urgency is lower than the raw 8.2 suggests - this is a conditional, library-consumer-dependent DoS rather than a broadly weaponizable RCE. Because impact is availability-only and depends on how downstream code validates input, priority should scale with whether your application exposes an externally controllable ID-length parameter; libraries that hardcode size are effectively unaffected. Note the tension: 'PR:N/UI:N' implies trivial remote triggering, but AT:P and the description ('unvalidated, attacker-controlled size') confirm it only manifests through a particular application code path - verify your own usage before treating this as network-exploitable by default.

Exploit ScenarioDerived

An application exposes an API endpoint that generates identifiers using nanoid's customAlphabet, letting the client specify the ID length. An attacker sends a request with length=0, causing the worker thread/event loop to enter an infinite loop and stop serving all other requests, producing a denial of service. No public exploit code is identified, but the trigger is trivial to craft given a vulnerable code path.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
1 PoC candidate (unverified) Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Jul 29, 2026

Denial-of-service in nanoid (Nano ID) versions before 5.1.6 lets an attacker hang a Node.js/JavaScript thread by supplying a size value of 0 to the customAlphabet or customRandom generator functions, triggering an unbounded internal loop (CWE-835). Only applications that forward an unvalidated, attacker-controlled size parameter to these functions are exposed. A vendor patch exists (5.1.6) and the issue was reported by VulnCheck, but there is no public exploit identified at time of analysis and it is not listed in CISA KEV.

RemediationAI

Vendor-released patch: upgrade to nanoid 5.1.6 or later, which fixes the infinite loop on a 0 size for customAlphabet (fix commit cb3626d0f3342fdf179cd425fd9c4fbb92c7d0e7; release https://github.com/ai/nanoid/releases/tag/5.1.6); run npm/yarn/pnpm update and rebuild lockfiles, and check transitive dependencies with npm ls nanoid since it is frequently pulled in indirectly. If you cannot upgrade immediately, the effective compensating control is input validation at the call site: reject or clamp any size value that is not a positive integer before passing it to customAlphabet/customRandom (e.g. enforce size >= 1), which fully neutralizes the trigger with no functional side effect for legitimate callers. Where the size is derived from user input such as a query parameter or request body, add server-side bounds checking and treat 0 as invalid; the only trade-off is that requests explicitly asking for a zero-length ID are rejected rather than served, which is the correct behavior anyway. Consult the VulnCheck advisory (https://www.vulncheck.com/advisories/nanoid-before-infinite-loop-via-zero-size-in-customalphabet-and-customrandom) for details.

Affected VersionsENISA

nanoid 0 <5.1.6

Affected Packages

npm nanoid fix: 3.3.18, 5.1.6

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

nanoid is an extremely popular, tiny JavaScript unique-string-ID generator (single CPE cpe:2.3:a:nanoid_project:nanoid). The flaw is a CWE-835 'Loop with Unreachable Exit Condition' in the customAlphabet and customRandom factory functions: their generation routine repeatedly appends characters until the produced ID reaches the requested size, but a size of 0 makes the loop's exit condition unsatisfiable, so it spins forever and blocks the calling (typically single-threaded event-loop) thread. The default nanoid() and standard usage are not affected - only the custom-generator paths that accept a caller-provided size. The fix in commit cb3626d0 / release 5.1.6 adds handling so a 0 size no longer loops indefinitely.

Know when Nanoid gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (VulnCheck) PRIMARY 8.2 HIGH
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
vuln.today AI 7.5 HIGH

Availability-only DoS remotely triggerable with no auth or interaction, but only via an application code path passing attacker-controlled size 0, so impact is A:H with C:N/I:N.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
4.0 AV:N/AC:L/AT:P/PR:N/UI:N/VC:N/VI:N/VA:H/SC:N/SI:N/SA:N
SUSE 5.9 MEDIUM
AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:H
Red Hat 7.5 HIGH

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
Present
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
None
Vulnerable system: Integrity
None
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

DescriptionCVE.org

nanoid (Nano ID) before 5.1.6 contains an infinite loop in the customAlphabet and customRandom functions. When these functions are configured with a size of 0, the internal generation loop never satisfies its exit condition and spins indefinitely, hanging the calling thread. An application that passes an unvalidated, attacker-controlled size of 0 to these functions is exposed to a denial-of-service condition.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 227 npm packages depend on nanoid (84 direct, 146 indirect)

Ecosystem-wide dependent count for version 4.0.0.

Latest POC

1 PoC candidate from github (unverified)

Sign in to open the public PoC links collected for this CVE.

Executive ViewAI

Why It Matters

nanoid (Nano ID) versions before 5.1.6 contain a denial-of-service vulnerability that can hang Node.js/JavaScript application threads when unvalidated user input is passed directly to size parameters in the customAlphabet or customRandom functions. Organizations using affected versions in production face potential service availability disruptions and operational impact, particularly in applications that process untrusted user input.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.3%
Top 76% exploitable
Prevalence
Ubiquitous
nanoid is a foundational npm ID library with billions of downloads, pervasive as a transitive dependency
Threat Intel
1
1 sources
Data Quality
8 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Partial

Priority Score

61
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +41
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Denial of Service attacks render applications or systems unavailable by overwhelming resources or triggering failure conditions.

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Desktop 15 SP7 Not-Affected
SUSE Linux Enterprise High Performance Computing 12 Not-Affected
SUSE Linux Enterprise High Performance Computing 15 SP7 Not-Affected
SUSE Linux Enterprise High Performance Computing 15 SP7 Not-Affected
SUSE Linux Enterprise High Performance Computing 15 SP7 Not-Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy