Skip to content

← Public intelligence

npm package

nanoid

Open actionable advisories and recorded vendor fixes. This public package view has no inventory attached and cannot establish whether your deployment is affected. A vendor fix never resolves your finding; verify your installed version and the source guidance.

Open advisories

5 actionable advisories, newest first. Withdrawn advisories and news are excluded. Coverage is partial.

  1. High, CVSS 7.4npmPublished

    nanoid: Integer Overflow or Wraparound

    CVE-2026-73086 · GHSA-xwg4-73v4-xw9w

    Affected
    • npm nanoid < 3.3.12; >= 4.0.0, < 5.1.11
    Fixed in
    3.3.125.1.11· Vendor fix available
    Issue
    An integer overflow in nanoid(size) permanently corrupts the process-wide CSPRNG pool, causing all subsequent ID generation to return the deterministic string "uuuuuuuuuuuuuuuuuuuuu". Any application that passes user-influenced values to the size parameter loses all randomness guarantees for session tokens, CSRF tokens, and unique identifiers until process restart. Details nanoid() at index.js:101 coerces the size parameter with size |= 0, which converts it to a signed 32-bit integer. When size = 2^31 (e.g., 2147483648), this wraps to -2147483648. The negative value is passed to fillPool() (index.js:15): Neither branch triggers, so the pool is never refreshed. poolOffset becomes ~-2.1 billion. Subsequent nanoid() calls execute: pool[negativeindex] returns undefined. undefined & 63 evaluates to 0. urlAlphabet[0] is 'u'. Every ID becomes "uuuuuuuuuuuuuuuuuuuuu". The corruption is persistent — it affects all subsequent calls in the process until ~100 million calls eventually…

    Recommended action: Upgrade to 5.1.11 or 3.3.12 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:github.comSource checked Evidence →
  2. High, CVSS 8.2npmAmendedPublished

    nanoid: non-secure generators can loop indefinitely with negative size

    CVE-2026-67214 · GHSA-28wg-ghj8-5hjv

    Affected
    • npm nanoid < 3.3.16; >= 4.0.0, < 5.1.16
    Fixed in
    5.1.163.3.16· Vendor fix available
    Issue
    nanoid (Nano ID) before 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.

    Recommended action: Upgrade to 5.1.16 or 3.3.16 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  3. High, CVSS 8.2npmAmendedPublished

    nanoid: custom generators can loop indefinitely when size is zero

    CVE-2026-67213 · GHSA-2v37-7h3g-55p8

    Affected
    • npm nanoid >= 4.0.0, < 5.1.6; < 3.3.18
    Fixed in
    5.1.63.3.18· Vendor fix available
    Issue
    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.

    Recommended action: Upgrade to 5.1.6 or 3.3.18 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  4. Medium, CVSS 4.3npmAmendedPublished

    Predictable results in nanoid generation when given non-integer values

    CVE-2024-55565 · GHSA-mwcw-c2x4-8c55

    Affected
    • npm nanoid >= 4.0.0, < 5.0.9; < 3.3.8
    Fixed in
    5.0.93.3.8· Vendor fix available
    Issue
    When nanoid is called with a fractional value, there were a number of undesirable effects: 1. in browser and non-secure, the code infinite loops on while (size--) 2. in node, the value of poolOffset becomes fractional, causing calls to nanoid to return zeroes until the pool is next filled 3. if the first call in node is a fractional argument, the initial buffer allocation fails with an error Version 3.3.8 and 5.0.9 are fixed.

    Recommended action: Upgrade to 5.0.9 or 3.3.8 by release line, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →
  5. Medium, CVSS 5.5npmAmendedPublished

    Exposure of Sensitive Information to an Unauthorized Actor in nanoid

    CVE-2021-23566 · GHSA-qrpm-p2h7-hrv2

    Affected
    • npm nanoid >= 3.0.0, < 3.1.31
    Fixed in
    3.1.31· Vendor fix available
    Issue
    The package nanoid from 3.0.0, before 3.1.31, are vulnerable to Information Exposure via the valueOf() function which allows to reproduce the last id generated.

    Recommended action: Upgrade to 3.1.31 or later, then redeploy and verify.A vendor fix does not resolve your finding until you verify it in your own systems.

    Sources:osv.dev (1)github.com (2)Source checked Evidence →