<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:webfeeds="http://webfeeds.org/rss/1.0"><channel><title>Nanoid (&gt;= 4.0.0, &lt; 5.1.11) - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/nanoid--4.0.0--5.1.11/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 02 Sep 2026 00:01:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/nanoid--4.0.0--5.1.11/feed.xml" rel="self" type="application/rss+xml"/><image><url>https://feed.craftedsignal.io/favicon-32x32.png</url><title>CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/</link><width>32</width><height>32</height></image><webfeeds:icon>https://feed.craftedsignal.io/favicon.svg</webfeeds:icon><item><title>Integer Overflow Vulnerability in nanoid Leads to Deterministic Token Generation</title><link>https://feed.craftedsignal.io/briefs/2026-09-nanoid-overflow/</link><pubDate>Wed, 02 Sep 2026 00:01:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-09-nanoid-overflow/</guid><description>An integer overflow in the nanoid library allows unauthenticated attackers to permanently corrupt the process-wide CSPRNG pool, forcing all subsequent ID generation to output a deterministic string and enabling mass authentication bypass.</description><content:encoded><![CDATA[<p>The popular npm package <code>nanoid</code> contains an integer overflow vulnerability (CVE-2026-73086) that can be triggered when a user-controlled value is passed to the <code>nanoid(size)</code> function. Specifically, supplying a size value greater than or equal to 2^31 triggers a bitwise OR operation (<code>size |= 0</code>) that causes the value to wrap into a negative signed 32-bit integer. This negative value bypasses the library's CSPRNG pool-refill logic, causing the internal <code>poolOffset</code> to point to an invalid memory index. Subsequent ID generation calls fail to retrieve entropy and instead read <code>undefined</code> from the buffer, resulting in a permanent corruption of the ID generation stream. Every ID produced thereafter becomes the deterministic string &quot;uuuuuuuuuuuuuuuuuuuuu&quot;. This corruption persists process-wide until the application restarts or ~100 million additional IDs are generated. Because <code>nanoid</code> is commonly used for security-critical identifiers such as session tokens and CSRF tokens, this vulnerability allows for trivial session hijacking and authentication bypass across the affected application.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Attacker identifies an API endpoint or application feature that accepts a user-provided integer to determine ID length (e.g., a &quot;token size&quot; or &quot;identifier length&quot; parameter).</li>
<li>Attacker sends a crafted request containing a value greater than or equal to 2,147,483,648 (0x80000000).</li>
<li>The <code>nanoid</code> library's <code>index.js</code> performs <code>size |= 0</code> on the malicious input, causing an integer overflow to -2,147,483,648.</li>
<li>The library passes the negative integer to the <code>fillPool()</code> function, which fails to trigger the entropy refresh logic due to the negative index arithmetic.</li>
<li>The internal <code>poolOffset</code> is updated to a deeply negative value, corrupting the subsequent ID generation loop.</li>
<li>The <code>nanoid</code> function attempts to read from the corrupted pool index, receives <code>undefined</code>, and maps the resulting bitwise operation to the static character 'u'.</li>
<li>The application returns a deterministic &quot;uuuu...&quot; ID to the user, confirming successful exploitation.</li>
<li>Attacker leverages the predictable ID stream to predict future session tokens or forge identifiers for other users, leading to full account takeover or session hijacking.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation results in a complete loss of unpredictability and uniqueness for all identifiers generated by the affected process. This includes session tokens, CSRF tokens, API keys, and database primary keys. An attacker can predict tokens issued to other users, leading to widespread session hijacking and authentication bypass. The vulnerability is highly impactful because the corruption is persistent for the entire process lifetime and requires only a single unauthenticated request.</p>
<h2 id="recommendation">Recommendation</h2>
<ol>
<li>Upgrade <code>nanoid</code> to version 3.3.12 or 5.1.11 (or later) immediately to incorporate input validation that prevents the integer overflow.</li>
<li>Audit all application code paths that pass user-supplied input to the <code>nanoid()</code> function and implement strict server-side validation to ensure the <code>size</code> parameter stays within reasonable, positive bounds.</li>
<li>Deploy monitoring to alert on application process crashes or abnormal token generation patterns that indicate the process may have been subjected to an exploitation attempt.</li>
</ol>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>supply-chain</category><category>vulnerability</category><category>remote-code-execution</category></item></channel></rss>