CVE-2025-14178
Unknown Unknown - Not Provided
Heap Buffer Overflow in PHP array_merge() Causes Memory Corruption

Publication date: 2025-12-27

Last updated on: 2025-12-27

Assigner: PHP Group

Description
In PHP versions:8.1.* before 8.1.34, 8.2.* before 8.2.30, 8.3.* before 8.3.29, 8.4.* before 8.4.16, 8.5.* before 8.5.1, a heap buffer overflow occurs in array_merge() when the total element count of packed arrays exceeds 32-bit limits or HT_MAX_SIZE, due to an integer overflow in the precomputation of element counts using zend_hash_num_elements(). This may lead to memory corruption or crashes and affect the integrity and availability of the target server.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2025-12-27
Last Modified
2025-12-27
Generated
2026-05-07
AI Q&A
2025-12-27
EPSS Evaluated
2026-05-05
NVD
Affected Vendors & Products
Showing 5 associated CPEs
Vendor Product Version / Range
php php 8.5
php php 8.2
php php 8.3
php php 8.1
php php 8.4
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-787 The product writes data past the end, or before the beginning, of the intended buffer.
CWE-190 The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number.
Attack-Flow Graph
AI Powered Q&A
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

The provided resources do not specify how this vulnerability affects compliance with common standards and regulations such as GDPR or HIPAA.


Can you explain this vulnerability to me?

This vulnerability is a heap buffer overflow in PHP's array_merge() function that occurs when merging packed arrays whose total element count exceeds 32-bit limits or HT_MAX_SIZE. It is caused by an integer overflow during the precomputation of element counts using zend_hash_num_elements(), which can lead to memory corruption or crashes.


How can this vulnerability impact me? :

The vulnerability can lead to memory corruption or crashes on the target server, potentially affecting the server's integrity and availability.


How can this vulnerability be detected on my network or system? Can you suggest some commands?

This vulnerability can be detected by checking if your PHP environment is running a vulnerable version prior to 8.1.34, 8.2.30, 8.3.29, 8.4.16, or 8.5.1. Additionally, detection can involve monitoring for usage of the array_merge() function with very large arrays that could exceed 32-bit limits or HT_MAX_SIZE. A practical test command in PHP to check for vulnerability is to run code that attempts to merge large arrays, such as: ```php $arr = range(0, 2**29); array_merge($arr, $arr, $arr, $arr, $arr, $arr, $arr, $arr); ``` If this causes a crash or memory corruption, the system is vulnerable. For version checking, you can run `php -v` to see the installed PHP version. There are no specific network commands mentioned for detection. [1]


What immediate steps should I take to mitigate this vulnerability?

Immediate mitigation steps include upgrading PHP to a patched version: 8.1.34 or later, 8.2.30 or later, 8.3.29 or later, 8.4.16 or later, or 8.5.1 or later. As a workaround, avoid merging a large number of long arrays using array_merge(), especially when the total element count could exceed 32-bit integer limits or HT_MAX_SIZE. Monitoring and restricting inputs that could lead to large arrays, such as large JSON arrays decoded and passed to array_merge(), can also help mitigate exploitation. [1]


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart