Advisory Database
  • Advisories
  • Dependency Scanning
  1. composer
  2. ›
  3. spomky-labs/otphp
  4. ›
  5. GHSA-g7m4-839x-ch6v

GHSA-g7m4-839x-ch6v: spomky-labs/otphp: Unbounded digits parameter in a provisioning URI triggers an uncaught DivisionByZeroError in OTP generation

June 18, 2026

The digits parameter parsed from a provisioning URI is validated only with a lower bound ($value > 0) and has no upper bound (src/OTP.php:353-357). OTP generation computes $code % (10 ** $this->getDigits()) (src/OTP.php:283). When digits is large enough that 10 ** digits overflows PHP’s integer range and the (int) cast yields 0 (around digits >= 40 on 64-bit PHP 8.x), the modulo operand becomes 0 and PHP raises a DivisionByZeroError.

References

  • github.com/FriendsOfPHP/security-advisories/blob/master/spomky-labs/otphp/GHSA-g7m4-839x-ch6v.yaml
  • github.com/Spomky-Labs/otphp/security/advisories/GHSA-g7m4-839x-ch6v
  • github.com/advisories/GHSA-g7m4-839x-ch6v

Code Behaviors & Features

Detect and mitigate GHSA-g7m4-839x-ch6v with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 11.4.3

Fixed versions

  • 11.4.3

Solution

Upgrade to version 11.4.3 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Learn more about CVSS

Weakness

  • CWE-1284: Improper Validation of Specified Quantity in Input
  • CWE-369: Divide By Zero

Source file

packagist/spomky-labs/otphp/GHSA-g7m4-839x-ch6v.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 23 Jun 2026 12:23:27 +0000.