CVE-2021-23566 is a medium-severity (CVSS 5.5) CWE-704 vulnerability in nanoid. 4 public exploit references exist, so weaponization risk is real. A fix is available for nanoid — see the affected versions and patch details below.
Exposure of Sensitive Information to an Unauthorized Actor in nanoid
EPSS Exploitation Probability
Probability of exploitation in the next 30 days, from FIRST.org EPSS.
How urgent is this, really
CVE-2021-23566 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.
Where this sits among everything scored
Of 385,386 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.
Real-World Exposure
How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.
nanoidnpmDescription
The package nanoid from 3.0.0 and before 3.1.31 are vulnerable to Information Exposure via the valueOf() function which allows to reproduce the last id generated.
Affected Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | nanoid | ≥ 3.0.0&&< 3.1.31 | 3.1.31npm install nanoid@3.1.31 |
Affected Products
nanoidnanoid_projectResearch use only. For defensive security, authorized penetration testing, and academic research only. Never execute exploit code against systems without explicit written authorization.
The package nanoid from 3.0.0 and before 3.1.31 are vulnerable to Inform…
The package nanoid from 3.0.0 and before 3.1.31 are vulnerable to Inform…
The package nanoid from 3.0.0 and before 3.1.31 are vulnerable to Inform…
The package nanoid from 3.0.0 and before 3.1.31 are vulnerable to Inform…
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for nanoid, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.
Fix
Update nanoid to 3.1.31 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2021-23566 is resolved across your whole dependency graph.
Workarounds
Assume what was exposed is already known: rotate any credential, token or key that the affected component could return, restrict the endpoint to callers that genuinely need it, and strip sensitive fields from responses and error output at the boundary rather than relying on the client not to read them.
Fixing This On Your OS
If you run this on a Linux distribution, patch through your package manager against the distro's own security advisory below — it tracks the exact backported fix for your release, which can ship on a different timeline (and sometimes a different severity) than the upstream project.
| Product | Fixed in | Advisory |
|---|---|---|
| Red Hat OpenShift Container Platform 4.11 | openshift4/ose-thanos-rhel8:v4.11.0-202208020235.p0.gf08da2d.assembly.stream | RHSA-2022:5069 |
| Red Hat OpenShift Data Foundation 4.11 on RHEL8 | odf4/mcg-core-rhel8:v4.11.0-30 | RHSA-2022:6156 |
Frequently Asked Questions
Is CVE-2021-23566 in your dependencies?
Find it across npm, including transitive dependencies.