{"vuln_id":"GHSA-x692-q9x7-8c3f","aliases":["CVE-2026-17544"],"description":"Out-of-bounds write in bccomp() via crafted operand and scale","published_at":"2026-07-30T11:03:07Z","modified_at":"2026-07-30T11:03:07Z","first_seen_at":"2026-11-22T14:05:37.600326Z","severity":"high","severity_source":"ghsa","cvss_score":null,"cvss_vector":null,"cwe":["CWE-121","CWE-787"],"vendor":null,"product":null,"kev":{"is_kev":false,"date_added":null,"due_date":null,"ransomware":false},"epss":null,"epss_percentile":null,"nvd_status":null,"enriched_at":null,"links":{"nvd":"https://github.com/advisories/GHSA-x692-q9x7-8c3f"},"matched_alias":null,"items":[{"id":12633,"source":{"id":"gh-php-src","name":"PHP releases (GitHub php/php-src tags)"},"title":"GHSA-x692-q9x7-8c3f / CVE-2026-17544: Out-of-bounds write in bccomp() via crafted operand and scale","summary":"Out-of-bounds write in bccomp() via crafted operand and scale\n\nA call to `bccomp()` with attacker-supplied inputs can lead to an out-of-bounds write to either stack or heap memory. The bug occurs in `bc_str2num()` when the scale truncates a number whose trailing zeros are subsequently trimmed.\r\n\r\nhttps://github.com/php/php-src/blob/a480965c90b4f4948f211c8b139788371e031838/ext/bcmath/libbcmath/src/str2num.c#L169-L185\r\n\r\n`str_scale` later determines the number of digits after the decimal point in the resulting string.\r\n\r\nhttps://github.com/php/php-src/blob/a480965c90b4f4948f211c8b139788371e031838/ext/bcmath/libbcmath/src/str2num.c#L203\r\n\r\nThe string is later populated using `bc_copy_and_toggle_bcd(nptr, fractional_ptr, fractional_end)`.\r\n\r\nhttps://github.com/php/php-src/blob/a480965c90b4f4948f211c8b139788371e031838/ext/bcmath/libbcmath/src/str2num.c#L213\r\n\r\nNote that we have shortened the allocated string (`str_scale -= fractional_end - fractional_new_end;`) but have not adjusted `fractional_end` itself. Consequently, `bc_copy_and_toggle_bcd(nptr, fractional_ptr, fractional_end)` will copy the original, untruncated string into a buffer that is too small, leading to an out-of-bounds write.\r\n\r\nBCMath uses a small stack-allocated arena for numbers before falling back to heap allocation, enabling both stack and heap corruption, depending on where the buffer is allocated.\r\n\r\nThe patch adds `fractional_end = fractional_new_end;` after the zero truncation.\r\n\n\nAffected packages: php:ext-bcmath\nPatched: ext-bcmath 8.4.24, ext-bcmath 8.5.9","url":"https://github.com/php/php-src/security/advisories/GHSA-x692-q9x7-8c3f","published_at":"2026-07-30T11:03:07Z","updated_at":"2026-07-30T11:03:07Z","fetched_at":"2026-11-22T14:05:37.431177Z","severity":"critical","cvss_score":9.8,"epss":0.00418,"is_kev":false,"has_exploit":false,"kev_due_date":null,"vendor":"php","product":"ext-bcmath","vuln_id":"CVE-2026-17544","vuln_ids":["CVE-2026-17543","CVE-2026-17544","CVE-2026-7260","GHSA-X692-Q9X7-8C3F"],"tags":["repo-advisory","php","CWE-121","CWE-787","security","repo:php/php-src","stack"],"cluster_id":11742,"links":{"self":"https://vulnwatch.ve1ve2.com/api/v1/items/12633","html":"https://vulnwatch.ve1ve2.com/item/12633"}}]}