nanoid Infinite Loop via Negative Size in non-secure module
Impact
nanoid before 3.3.16 and 5.1.16 has an infinite loop in its non-secure module when given a negative size, potentially causing a denial-of-service condition if an attacker-controlled negative size is passed to the customAlphabet or nanoid functions. The affected versions are those less than 3.3.16 and 5.1.16. An application is exposed if it passes an unvalidated, attacker-controlled negative size to these functions.
Summarized by @cf/meta/llama-3.3-70b-instruct-fp8-fast. Verify details against the original sources.Affected packages
Affected products
Vendor version evidence. Product records are separate from automatic dependency matching.
nanoid_project · VulnCheck
nanoid
4 ranges
nanoid_project · VulnCheck
nanoid
Package identity
pkg:npm/nanoidExplore nanoid →Identity supplied by VulnCheck. Version matching requires compatible range evidence.
Compare with this publisher’s ranges. This does not inspect your installation.
affected
4.0.0 → before 5.1.16
semver versions
0 → before 3.3.16
semver versions
unaffected
5.1.16
semver versions
3.3.16
semver versions
Other versions: unaffected
Original source description
nanoid (Nano ID) before 3.3.16 and 5.1.16 contains an infinite loop in the customAlphabet and nanoid functions of its non-secure module (nanoid/non-secure). When these functions are given a negative size, the loop counter is decremented from a negative value and never reaches its termination condition, spinning indefinitely and hanging the calling thread. An application that passes an unvalidated, attacker-controlled negative size to these functions is exposed to a denial-of-service condition.
Inside the record
Evidence available
Describes the evidence in this view, not whether the product is safe.
Original records
CVE-2026-67214View the latest unmodified CVE JSON from the official source. It may be newer than this imported page.
cve.new JSON →Underlying weaknesses
The source’s classification of what caused the vulnerability.
Environment requirements
These conditions apply together as specified by the publisher. A matching product name alone does not establish exposure.
VulnCheck · platform conditions
Any condition may hold
Vulnerable product
cpe:2.3:a:nanoid_project:nanoid:*:*:*:*:*:node.js:*:*From (inclusive): 4.0.0
Before: 5.1.16
Vulnerable product
cpe:2.3:a:nanoid_project:nanoid:*:*:*:*:*:node.js:*:*Before: 3.3.16
Original applicability statements
[
{
"nodes": [
{
"operator": "OR",
"cpeMatch": [
{
"vulnerable": true,
"criteria": "cpe:2.3:a:nanoid_project:nanoid:*:*:*:*:*:node.js:*:*",
"versionEndExcluding": "5.1.16",
"versionStartIncluding": "4.0.0"
},
{
"vulnerable": true,
"criteria": "cpe:2.3:a:nanoid_project:nanoid:*:*:*:*:*:node.js:*:*",
"versionEndExcluding": "3.3.16"
}
]
}
]
}
]Contributing organizations · 2
Assigning organization
Additional data publisher
What changed
Follow changesLarge field values are marked as truncated previews. Original source snapshots remain retained.