CVE Vulnerabilities

CVE-2022-31627

Free of Memory not on the Heap

Published: Jul 28, 2022 | Modified: Nov 21, 2024
CVSS 3.x
9.8
CRITICAL
Source:
NVD
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.x
RedHat/V2
RedHat/V3
7.5 LOW
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Ubuntu
MEDIUM

In PHP versions 8.1.x below 8.1.8, when fileinfo functions, such as finfo_buffer, due to incorrect patch applied to the third party code from libmagic, incorrect function may be used to free allocated memory, which may lead to heap corruption.

Weakness

The product calls free() on a pointer to memory that was not allocated using associated heap allocation functions such as malloc(), calloc(), or realloc().

Affected Software

Name Vendor Start Version End Version
Php Php 8.1.0 (including) 8.1.8 (excluding)
Php5 Ubuntu trusty *
Php7.0 Ubuntu xenial *
Php8.1 Ubuntu devel *
Php8.1 Ubuntu jammy *
Php8.1 Ubuntu kinetic *
Php8.1 Ubuntu upstream *

Potential Mitigations

  • Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid.
  • For example, glibc in Linux provides protection against free of invalid pointers.

References