<?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>Algorithm-Confusion — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/algorithm-confusion/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Fri, 03 Apr 2026 12:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/algorithm-confusion/feed.xml" rel="self" type="application/rss+xml"/><item><title>fast-jwt Library JWT Algorithm Confusion Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2026-04-fast-jwt-bypass/</link><pubDate>Fri, 03 Apr 2026 12:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-04-fast-jwt-bypass/</guid><description>The fast-jwt library is vulnerable to JWT Algorithm Confusion via Whitespace-Prefixed RSA Public Key due to an incomplete fix for CVE-2023-48223, allowing attackers to bypass intended security measures by exploiting leading whitespace in the RSA public key, enabling attackers to sign arbitrary payloads that will be accepted by the verifier, potentially leading to privilege escalation.</description><content:encoded><![CDATA[<p>The fast-jwt library, a popular Node.js package for handling JSON Web Tokens (JWTs), contains a vulnerability related to algorithm confusion. An incomplete fix for CVE-2023-48223 (GHSA-c2ff-88x2-x9pg) allows attackers to bypass intended security measures by exploiting leading whitespace in the RSA public key. Specifically, the <code>publicKeyPemMatcher</code> regex in <code>fast-jwt/src/crypto.js</code> does not account for leading whitespace, causing RSA public keys to be misclassified as HMAC secrets. This allows attackers to forge HS256 tokens using the RSA public key, leading to unauthorized access and privilege escalation. The vulnerability affects fast-jwt versions &lt;= 6.1.0. This issue is a direct bypass of the fix for CVE-2023-48223.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>The attacker identifies a server using the vulnerable fast-jwt library for JWT verification.</li>
<li>The attacker retrieves the server&rsquo;s RSA public key, which is often publicly available.</li>
<li>The attacker adds leading whitespace (e.g., a newline character) to the RSA public key.</li>
<li>The attacker crafts a malicious JWT with the header specifying the HS256 algorithm (<code>alg: 'HS256'</code>).</li>
<li>The attacker sets the payload of the JWT to contain desired claims, such as <code>admin: true</code>.</li>
<li>The attacker uses the whitespace-prefixed RSA public key as the HMAC secret to sign the JWT.</li>
<li>The attacker presents the forged HS256 token to the vulnerable server.</li>
<li>The server, due to the algorithm confusion vulnerability, incorrectly verifies the token using the RSA public key as an HMAC secret and grants unauthorized access based on the claims in the forged token.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability allows attackers to bypass authentication and authorization controls, potentially gaining administrative privileges or access to sensitive data. This could lead to data breaches, system compromise, and reputational damage. The impact is significant due to the widespread use of the fast-jwt library in various applications. This is a direct bypass of the fix for CVE-2023-48223.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade to a patched version of the <code>fast-jwt</code> library that addresses this vulnerability. This will require updating the <code>fast-jwt</code> package in your <code>package.json</code> file and redeploying your application.</li>
<li>As an immediate mitigation, sanitize RSA public keys by trimming leading whitespace before using them with the <code>fast-jwt</code> library. This can be done using the <code>.trim()</code> method in JavaScript before passing the key to the <code>createVerifier</code> function.</li>
<li>Deploy the Sigma rule that detects HS256 tokens being verified with RSA keys based on process creation logs to identify potential exploitation attempts.</li>
<li>Implement logging and monitoring for JWT verification processes to detect anomalies and suspicious activity. Specifically, monitor for instances where HS256 is used with keys that appear to be RSA public keys.</li>
<li>Review and update any existing security controls related to JWT handling to ensure they are effective against this type of algorithm confusion attack.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>jwt</category><category>algorithm-confusion</category><category>vulnerability</category><category>fast-jwt</category><category>nodejs</category></item></channel></rss>