CVE Vulnerabilities

CVE-2022-31625

Free of Memory not on the Heap

Published: Jun 16, 2022 | Modified: Nov 21, 2024
CVSS 3.x
8.1
HIGH
Source:
NVD
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS 2.x
6.8 MEDIUM
AV:N/AC:M/Au:N/C:P/I:P/A:P
RedHat/V2
RedHat/V3
7 MODERATE
CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:L/I:L/A:H
Ubuntu
MEDIUM
root.io logo minimus.io logo echo.ai logo

In PHP versions 7.4.x below 7.4.30, 8.0.x below 8.0.20, and 8.1.x below 8.1.7, when using Postgres database extension, supplying invalid parameters to the parametrized query may lead to PHP attempting to free memory using uninitialized data as pointers. This could lead to RCE vulnerability or denial of service.

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

NameVendorStart VersionEnd Version
PhpPhp7.4.0 (including)7.4.30 (excluding)
PhpPhp8.0.0 (including)8.0.20 (excluding)
PhpPhp8.1.0 (including)8.1.7 (excluding)
Red Hat Enterprise Linux 8RedHatphp:7.4-8060020220811045407.5caa48ff*
Red Hat Enterprise Linux 8RedHatphp:8.0-8070020220801083134.afd00e68*
Red Hat Enterprise Linux 9RedHatphp-0:8.0.20-3.el9*
Red Hat Software Collections for Red Hat Enterprise Linux 7RedHatrh-php73-php-0:7.3.33-1.el7*
Php5Ubuntuesm-infra-legacy/trusty*
Php5Ubuntutrusty*
Php5Ubuntutrusty/esm*
Php7.0Ubuntuesm-infra/xenial*
Php7.0Ubuntuxenial*
Php7.2Ubuntubionic*
Php7.2Ubuntuesm-infra/bionic*
Php7.4Ubuntuesm-infra/focal*
Php7.4Ubuntufocal*
Php7.4Ubuntuupstream*
Php8.0Ubuntuimpish*
Php8.0Ubuntuupstream*
Php8.1Ubuntujammy*
Php8.1Ubuntukinetic*
Php8.1Ubuntulunar*
Php8.1Ubuntuupstream*

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