<?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/"><channel><title>Next-Auth - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/next-auth/</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>Thu, 23 Jul 2026 14:45:37 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/next-auth/feed.xml" rel="self" type="application/rss+xml"/><item><title>Auth.js getToken() Vulnerability Leads to Denial of Service</title><link>https://feed.craftedsignal.io/briefs/2026-07-authjs-dos/</link><pubDate>Thu, 23 Jul 2026 14:45:37 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-07-authjs-dos/</guid><description>A vulnerability in the Auth.js `getToken()` helper function (next-auth and @auth/core) allows unauthenticated attackers to trigger an uncaught exception via a malformed `Authorization: Bearer` header, leading to a per-request denial of service in affected applications.</description><content:encoded><![CDATA[<p>A high-severity vulnerability has been identified in the <code>getToken()</code> helper within the <code>next-auth</code> and <code>@auth/core</code> JavaScript libraries, specifically affecting versions <code>&lt;= 5.0.0-beta.25</code> for <code>next-auth</code> and <code>&lt; 0.41.3</code> for <code>@auth/core</code>. This flaw, tracked as CWE-20 (Improper Input Validation), enables an unauthenticated attacker to induce a denial-of-service condition. When an application that directly calls <code>getToken()</code> receives a request with a malformed <code>Authorization: Bearer</code> header containing invalid percent-encoding, the function attempts to URL-decode the value. This decoding step can trigger an uncaught exception if not explicitly handled by the application, causing the request handler to crash or become unresponsive. This impacts application availability, particularly in API routes, middleware, and server-side request handlers where <code>getToken()</code> is commonly employed, though it does not expose sensitive data or bypass authentication.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An unauthenticated attacker crafts an HTTP request targeting a web application that uses the vulnerable <code>getToken()</code> helper.</li>
<li>The attacker includes a malformed <code>Authorization: Bearer</code> header in the request, where the bearer token portion contains invalid percent-encoding (e.g., <code>%xx</code> where <code>xx</code> is not a valid hexadecimal character).</li>
<li>The web application's API route, middleware, or server-side request handler receives the malicious request and calls the <code>getToken()</code> function.</li>
<li>The <code>getToken()</code> function, in the absence of a session cookie, attempts to URL-decode the malformed bearer value from the <code>Authorization</code> header.</li>
<li>Due to the invalid percent-encoding, the URL-decoding process fails and throws an uncaught exception within the <code>getToken()</code> helper.</li>
<li>Unless the application has a specific <code>try/catch</code> block surrounding the <code>getToken()</code> call, this uncaught exception propagates, leading to the crash or unresponsiveness of the request handler.</li>
<li>The application experiences a denial-of-service condition for that specific request, impacting availability.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>The primary impact of this vulnerability is a denial of service (DoS). An unauthenticated request containing a specially crafted, malformed <code>Authorization: Bearer</code> header can cause an unhandled exception in any application handler that invokes the <code>getToken()</code> function directly. This results in the affected request failing to complete, rendering the specific endpoint unavailable for that transaction. The impact is isolated to individual requests and primarily affects application availability. It does not lead to the exposure of tokens, session data, or other sensitive information, nor does it bypass existing authentication mechanisms. The vulnerability is categorized under CWE-20: Improper Input Validation.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade <code>next-auth</code> to a patched version greater than <code>5.0.0-beta.31</code> or <code>4.24.14</code> (or <code>@auth/core</code> to <code>0.41.3</code> or newer) to automatically address the vulnerability.</li>
<li>If immediate upgrade is not possible, implement a <code>try/catch</code> block around all calls to <code>getToken()</code> within your application code to handle potential exceptions gracefully and treat them as an invalid token.</li>
<li>Consider deploying an edge proxy or middleware to strip or normalize incoming <code>Authorization</code> headers with malformed percent-encoding before they reach the application.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>denial-of-service</category><category>vulnerability</category><category>web-application</category><category>javascript</category><category>input-validation</category></item></channel></rss>