Summary
CVE-2026-17544 is a high-severity out-of-bounds write vulnerability (CWE-787 / CWE-121) in the BCMath extension of PHP, affecting versions 8.4.x before 8.4.24 and 8.5.x before 8.5.9. The flaw is reachable via the bccomp() function when supplied with attacker-controlled operands and a scale parameter, and can result in stack or heap memory corruption with potential for Remote Code Execution. It carries a CVSS v4.0 base score of 8.1 (HIGH) with no privileges or user interaction required.
Technical details
- Root cause: In
bc_str2num()(withinext/bcmath/libbcmath/src/str2num.c), when a fractional value is first truncated to a caller-supplied scale and then stripped of trailing zeros, the internal variablestr_scaleis decremented butfractional_endis not updated to match. As a result,bc_copy_and_toggle_bcd()subsequently copies more bytes than were allocated bybc_new_num_nonzeroed(). - Trigger conditions: The vulnerability is reachable via a call to
bccomp($num1, $num2, $scale)— for example,bccomp("1.901", "0", 2)— where numeric inputs are attacker-controlled. Exploitation requires untrusted user input to flow into BCMath comparison functions. - Attack vector: Network — no authentication, no privileges, and no user interaction are required (CVSS v4.0:
AV:N/AC:L/AT:N/PR:N/UI:N). - Memory impact: For small numbers allocated from PHP BCMath’s 256-byte stack arena, the mismatch produces a stack-based out-of-bounds write. Larger allocations fall through to the heap, making heap corruption also possible.
- Potential impact: Memory corruption enabling Remote Code Execution, or severe denial of service; rated High across Confidentiality, Integrity, and Availability (
VC:H/VI:H/VA:Hin CVSS v4.0). - No public proof-of-concept has been observed at time of publication.
Affected software
- PHP 8.4.x — all versions before 8.4.24
- PHP 8.5.x — all versions before 8.5.9
Severity
- CVSS v4.0 Base Score: 8.1 (HIGH)
- Vector:
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:U/AU:N
Mitigation and recommended actions
- Immediate — apply the vendor patch:
- PHP 8.4.x users: upgrade to PHP 8.4.24 or later.
- PHP 8.5.x users: upgrade to PHP 8.5.9 or later.
- If immediate patching is not possible: Review application code to identify any code path where user-supplied values flow into
bccomp()or other BCMath functions, and apply strict input validation and type enforcement to prevent attacker-controlled scale or operand values from reaching the extension. - Network-level mitigation: Where internet-exposed PHP endpoints use BCMath for financial or precision arithmetic, consider placing a Web Application Firewall (WAF) in front to flag or block anomalous numeric payloads while patching is in progress.
IONIX Status
The IONIX research team is tracking ongoing exploitation attempts and recommends immediate patching. Potentially affected assets are outlined in this post.

