<?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>Otphp &lt; 11.4.3 - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/products/otphp--11.4.3/</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 20:54:10 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/products/otphp--11.4.3/feed.xml" rel="self" type="application/rss+xml"/><item><title>spomky-labs/otphp Unbounded Digits Parameter Leads to Denial of Service</title><link>https://feed.craftedsignal.io/briefs/2026-06-otphp-divisionbyzero/</link><pubDate>Thu, 18 Jun 2026 20:54:10 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-06-otphp-divisionbyzero/</guid><description>The spomky-labs/otphp library is vulnerable to a denial of service (GHSA-g7m4-839x-ch6v) where an unbounded 'digits' parameter in an otpauth provisioning URI causes a DivisionByZeroError, leading to unhandled fatal errors in applications trying to generate or verify OTPs.</description><content:encoded><![CDATA[<p>The <code>spomky-labs/otphp</code> library, versions prior to 11.4.3, is affected by a high-severity denial-of-service vulnerability (GHSA-g7m4-839x-ch6v) concerning its handling of OTP provisioning URIs. This vulnerability, disclosed in June 2026, arises when the <code>digits</code> parameter within an <code>otpauth</code> URI is provided with an excessively large value (typically 40 or greater). The library's internal validation for this parameter only checks for a lower bound, lacking an upper bound. During OTP generation or verification, the calculation <code>10 ** digits</code> overflows PHP's integer capacity on 64-bit systems, resulting in an implicit cast to <code>0</code>. A subsequent modulo operation with this zero value triggers a <code>DivisionByZeroError</code>. Critically, this error extends PHP's <code>Error</code> class rather than <code>Exception</code>, meaning it bypasses typical <code>try-catch (\Exception)</code> blocks, leading to unhandled fatal errors and effectively causing a denial of service for any application component attempting to process the malformed OTP object.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts a malicious <code>otpauth</code> provisioning URI containing an unusually large <code>digits</code> parameter, for example, <code>otpauth://totp/Alice?secret=JBSWY3DPEHPK3PXP&amp;digits=50</code>.</li>
<li>A vulnerable PHP application, utilizing <code>spomky-labs/otphp</code> (versions prior to 11.4.3), processes this URI, for instance, by calling <code>OTPHP\Factory::loadFromProvisioningUri()</code>.</li>
<li>The <code>loadFromProvisioningUri()</code> function internalizes the attacker-controlled <code>digits</code> parameter, which bypasses validation due to the lack of an upper bound check.</li>
<li>Later, the application attempts to generate or verify an OTP by invoking methods like <code>at()</code>, <code>now()</code>, or <code>verify()</code> on the <code>OTPHP\OTP</code> object created from the malicious URI.</li>
<li>During the OTP calculation within <code>src/OTP.php:283</code>, the expression <code>10 ** $this-&gt;getDigits()</code> is evaluated using the excessively large <code>digits</code> value.</li>
<li>On 64-bit PHP 8.x, for <code>digits</code> values around 40 or higher, the exponentiation <code>10 ** digits</code> results in an integer overflow, causing PHP to implicitly cast the result to <code>0</code>.</li>
<li>A subsequent modulo operation, <code>($code % 0)</code>, attempts to divide by zero, which triggers a <code>DivisionByZeroError</code>.</li>
<li>As <code>DivisionByZeroError</code> is a PHP <code>Error</code> (not an <code>Exception</code>), it typically bypasses standard error handling, leading to an unhandled fatal error and causing a denial of service for the affected application component.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>The vulnerability can lead to an application-level denial of service. When an application attempts to process a maliciously crafted <code>otpauth</code> URI, the internal <code>DivisionByZeroError</code> leads to an unhandled fatal error, effectively crashing the OTP generation or verification process. This means that users might be unable to log in, perform multi-factor authentication, or complete any transaction relying on OTPs, rendering the affected service partially or fully unavailable. While no specific victim counts are provided, any PHP application utilizing the vulnerable <code>spomky-labs/otphp</code> library for OTP functionality could be impacted.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade the <code>spomky-labs/otphp</code> library to version 11.4.3 or newer immediately to mitigate the vulnerability (GHSA-g7m4-839x-ch6v).</li>
<li>Deploy the Sigma rule &quot;Detect GHSA-g7m4-839x-ch6v OTPHPH Vulnerability Exploitation Attempt&quot; to your web application firewall (WAF) or intrusion detection system (IDS) to block web requests containing suspicious <code>otpauth</code> URIs with large <code>digits</code> parameters.</li>
<li>Implement the Sigma rule &quot;Detect Potential OTP Application Denial of Service (HTTP 5xx Response)&quot; and tune it for high-volume HTTP 5xx responses on OTP-related endpoints as a general indicator of potential DoS.</li>
<li>Enable comprehensive application logging for PHP errors and monitor for <code>DivisionByZeroError</code> messages, particularly those originating from <code>spomky-labs/otphp</code> components.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>php</category><category>denial-of-service</category><category>vulnerability</category><category>ghsa</category></item></channel></rss>