CVE-2025-14178
PHP vulnerability analysis and mitigation

Overview

CVE-2025-14178 is a heap buffer overflow vulnerability in PHP's array_merge() function caused by an integer overflow when the total element count of packed arrays exceeds 32-bit limits or HT_MAX_SIZE. It affects PHP versions 8.1.x before 8.1.34, 8.2.x before 8.2.30, 8.3.x before 8.3.29, 8.4.x before 8.4.16, and 8.5.x before 8.5.1. The vulnerability was published on December 27, 2025, with the GitHub Security Advisory (GHSA-h96m-rvf9-jgm2) published by the PHP project on December 18, 2025. It carries a CVSS v3.1 base score of 8.2 (High) (PHP Advisory, Feedly).

Technical details

The root cause is an integer overflow (CWE-190) in the precomputation of element counts within array_merge(), specifically in the expression count += zend_hash_num_elements(Z_ARRVAL_P(arg)), which can overflow a 32-bit integer when merging many large packed arrays. This overflow leads to an out-of-bounds write (CWE-787) — a heap buffer overflow — when the computed count exceeds HT_MAX_SIZE. The vulnerability is exploitable remotely over the network with no authentication or user interaction required, and attack complexity is low. A concrete PoC trigger is: $arr = range(0, 2**29); array_merge($arr, $arr, $arr, $arr, $arr, $arr, $arr, $arr);, or more generally by crafting JSON data decoded into arrays whose combined element count exceeds the 32-bit limit before being passed to array_merge(). The bug has been present in PHP since version 7.1 (PHP Advisory).

Impact

Successful exploitation can result in heap memory corruption or application crashes, affecting both the integrity and availability of the target PHP server. In memory-safe environments the impact would be limited to denial of service (DoS), but in PHP's C runtime, heap corruption opens the door to potential arbitrary code execution or unpredictable process behavior. Confidentiality impact is assessed as none, integrity impact as low, and availability impact as high per the CVSS scoring (PHP Advisory, Feedly).

Exploitability

A proof-of-concept exploit trigger is publicly documented in the official PHP security advisory, and a GitHub repository (gl1tch0x1/PHP_8.1.x_Exploit) referencing exploitation of this vulnerability has been observed (PHP Advisory, Feedly). There is no confirmed evidence of in-the-wild exploitation or threat actor attribution at this time. The EPSS score is approximately 0.04% (very low probability of exploitation in the near term). The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog.

Exploitation steps

  1. Reconnaissance: Identify target servers running vulnerable PHP versions (8.1.x < 8.1.34, 8.2.x < 8.2.30, 8.3.x < 8.3.29, 8.4.x < 8.4.16, 8.5.x < 8.5.1) via version disclosure in HTTP headers, error pages, or banner grabbing tools.
  2. Craft malicious input: Prepare a JSON payload that, when decoded via json_decode(), produces multiple arrays whose combined element count exceeds HT_MAX_SIZE (approximately 2^31) or the 32-bit integer limit. For example, a JSON structure like [array1, array2, ...] where each array has ~2^29 elements and 8 or more arrays are merged.
  3. Deliver payload: Submit the crafted JSON to a vulnerable PHP application endpoint that accepts user-supplied JSON and passes the decoded arrays to array_merge() — e.g., via an HTTP POST request with a large JSON body.
  4. Trigger overflow: The server-side PHP code calls array_merge(...$decoded_arrays), causing the integer overflow in zend_hash_num_elements() precomputation, resulting in a heap buffer overflow.
  5. Achieve impact: Depending on heap layout and PHP build, the outcome ranges from a process crash (DoS) to potential heap corruption enabling further exploitation (PHP Advisory).

Indicators of compromise

  • Network: Unusually large HTTP POST requests (multi-gigabyte or abnormally large JSON bodies) sent to PHP application endpoints; repeated requests causing PHP-FPM or web server worker crashes.
  • Logs: PHP error logs showing fatal errors, segmentation faults, or memory corruption messages originating from array_merge() calls; web server logs showing 500 errors or worker restarts correlated with large request bodies.
  • Process: Unexpected PHP-FPM worker process crashes or restarts; core dump files generated by the PHP process in the working directory or /tmp.
  • File System: Presence of core dump files (e.g., core.*) in PHP process working directories following application crashes.

Mitigation and workarounds

Upgrade PHP to the patched versions: 8.1.34, 8.2.30, 8.3.29, 8.4.16, or 8.5.1 depending on the branch in use. As a temporary workaround, restrict or validate the number and size of arrays passed to array_merge() in application code, and limit the size of user-supplied JSON inputs processed by the application. Network-level controls such as request body size limits (e.g., client_max_body_size in Nginx or LimitRequestBody in Apache) can reduce exposure. Linux distribution vendors including Red Hat, Debian, Ubuntu, SUSE, Slackware, Mageia, and Alpine Linux have released updated packages (PHP Advisory, Red Hat, Ubuntu Advisory).

Community reactions

The PHP project's security team (bukka) published the advisory on December 18, 2025, noting the bug has existed since PHP 7.1 and highlighting that real-world exploitation could occur via crafted JSON data passed to array_merge(). Multiple Linux distribution vendors (Red Hat, Debian, Ubuntu, SUSE, Slackware, Alpine, Mageia) issued security advisories and updated packages promptly. Security scanning vendors Tenable (Nessus) and Qualys added detection plugins shortly after disclosure. Community coverage appeared on security blogs and Linux news aggregators, with the vulnerability described as a significant memory safety issue in PHP's array handling (PHP Advisory).

Additional resources

Linux Distribution fix status

Fix availability across major Linux distributions and their releases.

Debian

Fixed

bookworm

php8.2: 8.2.30-1~deb12u1

Fixed

sid

php8.4: 8.4.16-1

Fixed

trixie

php8.4: 8.4.16-1~deb13u1

Fixed

RHEL / CentOS

Fixed

RHEL 8

:appstream:php:7.4/php/php-0:7.4.33-3.module%2Bel8.10.0%2B23902%2Bd3c8dd8f

Fixed

RHEL 9

:appstream:php-0:8.0.13-2.el9_0.1.src

Fixed

RHEL 10

php-0:8.3.19-1.el10_0.1.src

Fixed

Alpine

Fixed

edge

php83: 8.3.29-r0, 8.4.16-r0, 8.5.1-r0

Fixed

v3.19

php81: 8.1.34-r0

Fixed

v3.22

php82: 8.2.30-r0, 8.3.29-r0, 8.4.16-r0

Fixed

v3.23

php83: 8.3.29-r0, 8.4.16-r0, 8.5.1-r0

Fixed

SourceThis report was generated using AI

Related PHP vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2026-47156CRITICAL9.3
  • PHP logoPHP
  • mantisbt/mantisbt
NoYesSep 09, 2026
CVE-2026-85400HIGH7.5
  • PHP logoPHP
  • cpe:2.3:a:typo3:typo3
NoYesSep 08, 2026
CVE-2026-53637MEDIUM6.5
  • PHP logoPHP
  • sylius/sylius
NoYesSep 08, 2026
CVE-2026-53639MEDIUM6.3
  • PHP logoPHP
  • sylius/sylius
NoYesSep 08, 2026
CVE-2026-53638MEDIUM4.3
  • PHP logoPHP
  • sylius/sylius
NoYesSep 08, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management