<?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>Composer/Web-Token - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/vendors/composer/web-token/</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, 18 Jun 2026 21:15:29 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/vendors/composer/web-token/feed.xml" rel="self" type="application/rss+xml"/><item><title>PHP JWT Library PBES2-HS*+A*KW Unbounded p2c Iteration Count Leads to DoS</title><link>https://feed.craftedsignal.io/briefs/2026-06-php-jwt-pbes2-dos/</link><pubDate>Thu, 18 Jun 2026 21:15:29 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-06-php-jwt-pbes2-dos/</guid><description>An unauthenticated attacker can exploit a vulnerability in the PHP JWT Library's PBES2AESKW::unwrapKey() function when processing JWE tokens that use PBES2-HS*+A*KW algorithms by crafting a JWE with an excessively large 'p2c' (PBKDF2 iteration count) parameter in the JOSE header, forcing the server to perform an unbounded and CPU-intensive PBKDF2 computation, resulting in a CPU-amplification denial of service.</description><content:encoded><![CDATA[<p>A high-severity denial-of-service vulnerability (CWE-400) has been discovered in the PHP JWT Library (composer/web-token/jwt-library and jwt-framework), affecting versions prior to 3.4.10, 4.0.7, and 4.1.7. This flaw allows an unauthenticated attacker to trigger an unbounded CPU consumption on a server processing JSON Web Encryption (JWE) tokens. Specifically, when JWEs utilize password-based key-encryption algorithms (PBES2-HS256+A128KW, PBES2-HS384+A192KW, PBES2-HS512+A256KW), the <code>PBES2AESKW::unwrapKey()</code> function reads the <code>p2c</code> (PBKDF2 iteration count) parameter directly from the attacker-controlled JOSE header. The absence of an upper bound on this parameter allows attackers to specify extremely high iteration counts (e.g., 100,000,000 or PHP_INT_MAX), causing the server to expend significant CPU resources on PBKDF2 computations before any key unwrapping validation occurs. This resource exhaustion can lead to severe service degradation or unavailability for targeted applications.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An unauthenticated attacker crafts a malicious JSON Web Encryption (JWE) token.</li>
<li>The attacker manipulates the protected JOSE header of the JWE to include a <code>p2c</code> (PBKDF2 iteration count) parameter with an arbitrarily large integer value (e.g., <code>100,000,000</code> or <code>PHP_INT_MAX</code>).</li>
<li>The attacker sends this crafted JWE token to a vulnerable application endpoint (e.g., via an HTTP header, request body, or URL parameter).</li>
<li>The vulnerable PHP JWT Library receives the JWE and attempts to process it using a registered PBES2-HS*+A*KW algorithm for key unwrapping.</li>
<li>The <code>PBES2AESKW::unwrapKey()</code> function extracts the <code>p2c</code> value from the JOSE header without adequate upper bound validation, as only <code>is_int($p2c) &amp;&amp; $p2c &gt; 0</code> is checked.</li>
<li>The function initiates <code>hash_pbkdf2()</code> with the excessively large <code>p2c</code> value, forcing the server's CPU to perform an intensive, prolonged computation for PBKDF2 key derivation.</li>
<li>The server worker process becomes stalled, consuming significant CPU resources for an extended period (potentially tens of seconds per request), leading to resource exhaustion.</li>
<li>If sufficient malicious JWEs are processed, the application or server becomes unresponsive, resulting in a denial-of-service condition due to uncontrolled resource consumption.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Successful exploitation of this vulnerability leads to a severe denial-of-service (DoS) condition. Attackers can force target servers to dedicate substantial CPU resources to perform computationally expensive PBKDF2 iterations, effectively stalling worker processes. This resource exhaustion prevents legitimate users from accessing the application, resulting in service unavailability and potential data loss if stateful operations are interrupted. While the vulnerability description does not specify observed victim counts or sectors, any application utilizing the affected PHP JWT Library and configured to accept JWEs with PBES2 algorithms is at risk, particularly those exposed to unauthenticated input. The cost to the attacker for generating the malicious JWE is negligible compared to the server's computational burden.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade the <code>composer/web-token/jwt-library</code> to versions 3.4.10, 4.0.7, or 4.1.7, or <code>composer/web-token/jwt-framework</code> to version 4.1.7 or later, which enforce a <code>DEFAULT_MAX_COUNT = 1_000_000</code> for <code>p2c</code>.</li>
<li>If immediate upgrade is not feasible, implement a custom header checker to validate and limit the <code>p2c</code> header parameter for JWEs before they are processed by the vulnerable library, as described in the source.</li>
<li>Disable PBES2 algorithms for JWE decryption if they are not strictly required, especially for tokens originating from untrusted sources.</li>
<li>Deploy the provided Sigma rules to your SIEM to detect attempts to exploit this vulnerability or identify applications configured to use the affected PBES2 algorithms.</li>
<li>Monitor web server and PHP application logs for HTTP requests containing JWEs that use PBES2 algorithms or include abnormally large <code>p2c</code> values, as described in the detection rules.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>denial-of-service</category><category>web</category><category>php</category><category>jwt</category><category>jwe</category><category>cwe-400</category></item><item><title>PHP JWT Framework Algorithm Confusion Vulnerability (TOCTOU)</title><link>https://feed.craftedsignal.io/briefs/2026-06-php-jwt-algo-confusion/</link><pubDate>Thu, 18 Jun 2026 21:14:03 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-06-php-jwt-algo-confusion/</guid><description>A Time-of-Check/Time-of-Use (TOCTOU) vulnerability exists in the `JWSVerifier` and `JWEDecrypter` components of the `web-token/jwt-framework` and `web-token/jwt-library` PHP packages, allowing an attacker to override the integrity-protected `alg` parameter from the unprotected header, leading to authentication bypass and unauthorized access.</description><content:encoded><![CDATA[<p>The <code>web-token/jwt-framework</code> and <code>web-token/jwt-library</code> PHP packages are affected by a Time-of-Check/Time-of-Use (TOCTOU) vulnerability that allows attackers to perform algorithm confusion attacks. Specifically, in <code>JWSVerifier::getAlgorithm()</code> and <code>JWEDecrypter</code>, header merging logic (<code>...</code> spread operator or <code>array_merge()</code>) incorrectly prioritizes the unprotected <code>alg</code> (algorithm) parameter over the integrity-protected one when duplicate keys exist. This means that while the protected header's <code>alg</code> might be validated (e.g., <code>RS256</code>), the actual signature verification or decryption might proceed with an attacker-specified <code>alg</code> from the unprotected header (e.g., <code>HS256</code> or <code>none</code>). This bypasses cryptographic integrity checks, enabling authentication bypass, unauthorized access, or information disclosure, making it critical for applications relying on these libraries for secure JWT handling.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li><strong>Initial Access / Reconnaissance:</strong> An attacker identifies a web application utilizing JSON Web Tokens (JWTs) for authentication or authorization.</li>
<li><strong>Malicious JWT Creation:</strong> The attacker crafts a JWT containing a protected header with a strong, integrity-protected algorithm (e.g., <code>alg: RS256</code>) and an unprotected header specifying a weaker or symmetric algorithm (e.g., <code>alg: HS256</code> or <code>alg: none</code>), intending for the unprotected <code>alg</code> to override the protected one.</li>
<li><strong>Token Submission:</strong> The attacker sends this crafted, malicious JWT to the vulnerable web application, typically within an HTTP <code>Authorization</code> header or as a cookie.</li>
<li><strong>Header Merging (TOCTOU):</strong> Upon receiving the JWT, the application's <code>JWSVerifier</code> or <code>JWEDecrypter</code> component merges the protected and unprotected headers. Due to the vulnerability, the <code>alg</code> parameter from the unprotected header overwrites the <code>alg</code> from the protected header in the internal merged array.</li>
<li><strong>Algorithm Validation (Time-of-Check):</strong> An initial check (e.g., by <code>HeaderCheckerManager</code>) might validate the <code>alg</code> from the <em>protected</em> header (e.g., <code>RS256</code>), which passes, creating a false sense of security.</li>
<li><strong>Signature/Decryption (Time-of-Use):</strong> The <code>JWSVerifier</code> or <code>JWEDecrypter</code> proceeds to verify the JWT signature (or decrypt the payload) using the <code>alg</code> parameter that was <em>overridden</em> by the unprotected header (e.g., <code>HS256</code> or <code>none</code>).</li>
<li><strong>Authentication Bypass / Data Compromise:</strong> If the attacker chose an <code>alg</code> like <code>none</code> or could forge a valid signature for a symmetric key (<code>HS256</code>), the system may successfully validate the JWT.</li>
<li><strong>Impact:</strong> This leads to unauthorized access, impersonation of legitimate users, or decryption of sensitive data, allowing the attacker to bypass authentication mechanisms.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>If exploited, this vulnerability leads to a severe authentication bypass, allowing attackers to forge valid JSON Web Tokens (JWTs) and gain unauthorized access to web applications. This could result in full account takeover, privilege escalation, and access to sensitive data or functionality that should be restricted. The impact is significant for applications that rely on <code>web-token/jwt-framework</code> or <code>web-token/jwt-library</code> for secure session management, API authentication, or inter-service communication. Organizations across all sectors using PHP applications with these specific JWT libraries are at risk, as the integrity of their authentication and authorization mechanisms is compromised.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Immediately update <code>composer/web-token/jwt-framework</code> to a patched version (e.g., newer than 4.2.99) to address the algorithm confusion vulnerability.</li>
<li>Immediately update <code>composer/web-token/jwt-library</code> to a patched version (e.g., &gt;= 3.4.10, &gt;= 4.0.7, &gt;= 4.1.7) to address the algorithm confusion vulnerability.</li>
<li>Review application logs for entries indicating JWT verification failures or unexpected algorithm usage for authentication (refer to the <code>Detect JWT Algorithm Verification Errors</code> rule).</li>
<li>Ensure verbose application logging is enabled for JWT processing and verification steps to aid in detection of anomalous <code>alg</code> parameter usage (refer to the <code>Detect JWT 'none' Algorithm Usage</code> rule).</li>
<li>Deploy the Sigma rules in this brief to your SIEM and tune for your environment, specifically for <code>webserver</code> logs that might contain application-level JWT processing details.</li>
</ul>
]]></content:encoded><category domain="severity">high</category><category domain="type">advisory</category><category>vulnerability</category><category>php</category><category>jwt</category><category>web</category><category>authentication-bypass</category></item></channel></rss>