# CVE-2026-67213: nanoid before 5.1.6 Infinite Loop via Zero Size in customAlphabet and customRandom

> An attacker can cause a denial of service by passing a size of zero to nanoid's custom generation functions, hanging the application thread.

- **Severity:** High 8.2 (`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`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 29 Jul 2026
- **Updated:** 8 Oct 2026
- **Also known as:** CLEANSTART-2026-EK72543, CLEANSTART-2026-EO53027, CLEANSTART-2026-SY32977, CLSA-2026-1791200139, CLSA-2026-1791208139, CLSA-2026-1791208360, CLSA-2026-1791282749, DEBIAN-CVE-2026-67213, ECHO-4872-5a8d-5e5f, GHSA-2v37-7h3g-55p8, MINI-2fvm-q397-p484, MINI-3qxx-r2x8-w543, MINI-453m-8ffh-cgc2, MINI-5f7g-qfh6-fj6q, MINI-65jg-99h7-8w43, MINI-65rw-f2gr-fh5c, MINI-6jh5-fh5x-cwmh, MINI-79vq-m7h7-cwqj, MINI-7r22-xhgh-gjm4, MINI-8vqp-j35j-3rrp, MINI-9q65-7j29-gwhh, MINI-hgg3-774m-c38r, MINI-j589-c252-hc9r, MINI-jv49-7998-f4cf, MINI-qp8m-r692-jg46, MINI-qpj7-c985-p9cq, MINI-qwpj-gfvh-2c7g, MINI-rgpx-mqwh-x659, MINI-vvc6-7w8v-x365, MINI-xf26-83fx-r73q, RHSA-2026:47614, ROOT-APP-NPM-CVE-2026-67213, UBUNTU-CVE-2026-67213

## What is CVE-2026-67213?

CVE-2026-67213 is a high-severity denial of service vulnerability in nanoid_project nanoid, published on 29 Jul 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

### Official description

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.

Weakness: CWE-835 (Loop with Unreachable Exit Condition)

## Which versions are affected by CVE-2026-67213?

4 open source packages ship an affected version, including nanoid. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `nanoid` | npm | All versions | 3.3.18 |
| `nanoid` | npm | All versions | 3.3.18 |
| `nanoid` | npm | From 4.0.0 | 5.1.6 |
| `nanoid` | npm | From 4.0.0 | 5.1.6 |
| `jaeger` | Red Hat:hummingbird:1 | All versions | 0:2.20.0-0.6.hum1 |

Products: Nanoid Project Nanoid.

## How do I fix CVE-2026-67213?

Upgrade nanoid to a fixed version for your release line: 3.3.18 or 5.1.6.

## Is CVE-2026-67213 being exploited?

There is no known exploitation of CVE-2026-67213 in the wild and no public exploit code.

## Other vulnerabilities in nanoid_project nanoid

- [CVE-2026-67214](https://insights.sbomify.com/CVE-2026-67214/): nanoid Infinite Loop via Negative Size in non-secure module (high 8.2)
- [CVE-2021-23566](https://insights.sbomify.com/CVE-2021-23566/): Information Exposure (medium 4.0)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2026-67213 and fix it if it is affected.

What it is: CVE-2026-67213 is a high-severity denial of service vulnerability in nanoid_project nanoid, published on 29 Jul 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2026-67213 in the wild and no public exploit code.

Affected packages and fixed versions:
- nanoid (npm): affected all versions; fixed in 3.3.18
- nanoid (npm): affected all versions; fixed in 3.3.18
- nanoid (npm): affected from 4.0.0; fixed in 5.1.6
- nanoid (npm): affected from 4.0.0; fixed in 5.1.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2026-67213/ (Markdown: https://insights.sbomify.com/CVE-2026-67213/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2026-67213
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2026-67213
- OSV: https://osv.dev/vulnerability/CVE-2026-67213

---
From sbomify Insights: https://insights.sbomify.com/CVE-2026-67213/
Summaries are generated and may contain mistakes; the official description above is the record.
