{"answers":{"affected":"2 open source packages ship an affected version, including spomky-labs/otphp.","exploited":"There is no known exploitation of GHSA-g7m4-839x-ch6v in the wild and no public exploit code.","fix":"Upgrade spomky-labs/otphp to 11.4.3 or later.","what":"GHSA-g7m4-839x-ch6v is a denial of service vulnerability in spomky-labs/otphp, published on 18 Jun 2026. An attacker can exploit it over the internet without logging in, with no action from the victim."},"fix_prompt":"Check this codebase for GHSA-g7m4-839x-ch6v and fix it if it is affected.\n\nWhat it is: GHSA-g7m4-839x-ch6v is a denial of service vulnerability in spomky-labs/otphp, published on 18 Jun 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.\nExploitation: There is no known exploitation of GHSA-g7m4-839x-ch6v in the wild and no public exploit code.\n\nAffected packages and fixed versions:\n- spomky-labs/otphp (Packagist): affected all versions; fixed in 11.4.3\n- spomky-labs/otphp (Packagist): affected all versions; fixed in 11.4.3\n\nTask:\n1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.\n2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.\n3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.\n4. Run the tests and summarise what changed and why.\n5. If nothing in the project is affected, say so and change nothing.\n\nReference: https://insights.sbomify.com/GHSA-g7m4-839x-ch6v/ (Markdown: https://insights.sbomify.com/GHSA-g7m4-839x-ch6v/index.md)","id":"GHSA-g7m4-839x-ch6v","markdown":"https://insights.sbomify.com/GHSA-g7m4-839x-ch6v/index.md","name":"GHSA-g7m4-839x-ch6v","record":{"aliases":[],"analysis":{"component_type":"library","fix_type":"patch","impacts":["denial_of_service"],"network_reachable":"yes","non_default_config":false,"product_category":"PHP OTP library","requires_auth":"none","summary":"An attacker can cause a denial of service in the OTP verification path by supplying a provisioning URI with an excessively large digits parameter, triggering an uncaught error.","user_interaction":"not_required","vuln_class":"denial_of_service"},"analysis_generated_by":"qwen3.8-flash-next","assigner":null,"cpe":[],"cvss":{"score":null,"severity":null,"source":null,"vector":null,"version":null},"cwes":[],"description":"## Summary\n\nThe `digits` parameter parsed from a provisioning URI is validated only with a lower bound (`$value \u003e 0`) and has no upper bound (`src/OTP.php:353-357`). OTP generation computes `$code % (10 ** $this-\u003egetDigits())` (`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 \u003e= 40` on 64-bit PHP 8.x), the modulo operand becomes `0` and PHP raises a `DivisionByZeroError`.\n\n## Impact\n\n`OTPHP\\Factory::loadFromProvisioningUri()` forwards the attacker-controlled `digits` query value to `setParameter('digits', $value)`, so a hostile URI such as `otpauth://totp/Alice?secret=JBSWY3DPEHPK3PXP\u0026digits=50` produces an OTP object whose `at()`, `now()`, and `verify()` all throw `DivisionByZeroError`. Because `DivisionByZeroError` extends `Error` (not `Exception`), callers that guard OTP generation with a `catch (\\Exception)` do not catch it, turning a malformed URI into an unhandled fatal error (denial of service of the verification path).\n\nMeasured threshold on PHP 8.3: `digits = 30` works, `digits \u003e= 40` throws `DivisionByZeroError: Modulo by zero`.\n\n## Affected component\n\n- `src/OTP.php:353-357` — `digits` parameter callback (no upper bound)\n- `src/OTP.php:283` — `$code % (10 ** $this-\u003egetDigits())`\n\n## Proof of concept\n\n```php\nuse OTPHP\\Factory;\nuse OTPHP\\InternalClock;\n\n$otp = Factory::loadFromProvisioningUri(\n    'otpauth://totp/Alice?secret=JBSWY3DPEHPK3PXP\u0026digits=50',\n    new InternalClock()\n);\n$otp-\u003eat(0); // DivisionByZeroError: Modulo by zero (escapes catch (\\Exception))\n```\n\n## Remediation\n\nEnforce a sane upper bound on `digits` in the parameter validation callback (e.g. reject values above 8–10, the practical range for OTPs) so that an out-of-range value is rejected with a documented exception instead of producing an object that fails later with an uncatchable `Error`.","ecosystems":["Packagist"],"exploits":{"exploitdb":null,"first_seen":null,"github_poc":null,"max_poc_stars":null,"metasploit":null,"nuclei":null,"refs":[],"tier":null},"has_fix":true,"headline":"The `digits` parameter parsed from a provisioning URI is validated only with a lower bound (`$value \u003e 0`) and has no upper bound","id":"GHSA-g7m4-839x-ch6v","indexable":true,"kev":null,"kind":"advisory","links":{"ecosystem":"Packagist","product":null,"products":[],"type":"denial_of_service","year":"2026"},"n_packages":2,"n_references":null,"packages":[{"ecosystem":"Packagist","fixed":["11.4.3"],"introduced":["0"],"last_affected":[],"package":"spomky-labs/otphp","purl":null,"source":"GHSA-g7m4-839x-ch6v"},{"ecosystem":"Packagist","fixed":["11.4.3"],"introduced":["0"],"last_affected":[],"package":"spomky-labs/otphp","purl":"pkg:composer/spomky-labs/otphp","source":"GHSA-g7m4-839x-ch6v"}],"products":null,"published":"2026-06-18","related":[],"sources":[{"class":"attribution","licence":"CC BY 4.0","name":"GitHub Advisory Database","prefix":"GHSA"}],"ssvc":{"automatable":null,"exploitation":null,"technical_impact":null},"state":null,"updated":null,"vendors":null},"summary":"An attacker can cause a denial of service in the OTP verification path by supplying a provisioning URI with an excessively large digits parameter, triggering an uncaught error.","url":"https://insights.sbomify.com/GHSA-g7m4-839x-ch6v/"}