If your PHP 8.4 or 8.5 app leans on BCMath for precise number crunching, give this one a few minutes.
At a glance
- CVE: CVE-2026-17544
- Severity: 9.8 (Critical) at NVD. PHP’s own score is 8.1 (High) on CVSS 4.0.
- Affected: PHP 8.4 before 8.4.24 and 8.5 before 8.5.9, in the
bcmathextension. PHP 8.2 and 8.3 aren’t listed as affected. - Known exploited: No. It’s not on CISA’s KEV list.
What’s going on
bccomp() compares two arbitrary-precision numbers, passed in as strings, up to a given number of decimal places (the “scale”). When BCMath turns a string into its internal number format, it cuts the fractional part down to that scale and then trims any trailing zeros. The bug is in that last step: BCMath shrinks the space it sets aside for the digits but still copies the original, untrimmed digits into it, so it writes past the end of the buffer.
BCMath keeps small numbers in a little scratch area on the stack and only moves to the heap for bigger ones, so this can corrupt either stack or heap memory. At the very least that can crash PHP, and both NVD and PHP score it as high impact across the board.
So who’s at risk? Apps on PHP 8.4 or 8.5 that feed attacker-supplied numbers into bccomp(). Don’t forget your dependencies: searching vendor/ as well as your own code for bccomp( gives you a quick picture.
Timeline
- Disclosed: 2026-07-30 (PHP’s advisory went public with the fixed releases)
- Patch released: 2026-07-30 (PHP 8.4.24 and 8.5.9)
- CVE published at NVD: 2026-07-30
== UPDATE ==
The July 2026 releases of PHP 8.4 and 8.5 fix it.
- Patch available: Yep.
- Fixed in: PHP 8.4.24, 8.5.9.
- How to apply: Update PHP through your package manager (or PHP distribution) to the fixed release or anything newer on your branch, then restart your web server and any PHP-FPM pools so every worker loads the new build. As of this write-up, the newest releases are 8.4.28 and 8.5.13, and they include later security fixes too. If you use your distro’s PHP packages, install the distro’s security update; distros often backport the fix without bumping to the upstream version number.
- If you can’t patch yet: PHP’s advisory doesn’t offer a workaround. If nothing on the server uses BCMath, disabling the
bcmathextension takes the buggy code out of the picture. If you do need it, upgrading is the fix.