CVE-2022-31625 Freeing unallocated memory in php_pgsql_free_params()

High 8.1 Published Updated

Attackers can trigger remote code execution or denial of service in PHP applications using the PostgreSQL extension by supplying invalid query parameters.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2022-31625?

CVE-2022-31625 is a high-severity memory corruption vulnerability in Debian Debian Linux, published on 16 Jun 2022. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

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: CWE-763, CWE-824, CWE-590

Which versions are affected by CVE-2022-31625?

3 open source packages ship an affected version, including libphp, php and php-min. It affects 2 products.

PackageAffectedFixed in
libphp BitnamiFrom 7.4.07.4.30, 8.0.20, 8.1.7
php BitnamiFrom 7.4.07.4.30, 8.0.20, 8.1.7
php-min BitnamiFrom 7.4.07.4.30, 8.0.20, 8.1.7
Linux distribution packages (37)
apcu-panel AlmaLinux:8All versions5.1.18-1.module_el8.6.0+2750+78feabcb
libzip AlmaLinux:8All versions1.6.1-1.module_el8.6.0+2750+78feabcb
libzip-devel AlmaLinux:8All versions1.6.1-1.module_el8.6.0+2750+78feabcb
libzip-tools AlmaLinux:8All versions1.6.1-1.module_el8.6.0+2750+78feabcb
php AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-bcmath AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-cli AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-common AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-dba AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-dbg AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-devel AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-embedded AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-enchant AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-ffi AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-fpm AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-gd AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-gmp AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-intl AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-json AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-ldap AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-mbstring AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-mysqlnd AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-odbc AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-opcache AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-pdo AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-pear AlmaLinux:8All versions1:1.10.12-1.module_el8.6.0+2750+78feabcb
php-pecl-apcu AlmaLinux:8All versions5.1.18-1.module_el8.6.0+2750+78feabcb
php-pecl-apcu-devel AlmaLinux:8All versions5.1.18-1.module_el8.6.0+2750+78feabcb
php-pecl-rrd AlmaLinux:8All versions2.0.1-1.module_el8.6.0+2750+78feabcb
php-pecl-xdebug AlmaLinux:8All versions2.9.5-1.module_el8.6.0+2750+78feabcb
php-pecl-zip AlmaLinux:8All versions1.18.2-1.module_el8.6.0+2750+78feabcb
php-pgsql AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-process AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-snmp AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-soap AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-xml AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8
php-xmlrpc AlmaLinux:8All versions7.4.19-4.module_el8.6.0+3238+624bf8b8

Products include Debian Debian Linux, Php Php.

How do I fix CVE-2022-31625?

Upgrade libphp to a fixed version for your release line: 7.4.30, 8.0.20 or 8.1.7.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2022-31625 being exploited?

There is no known exploitation of CVE-2022-31625 in the wild and no public exploit code.

All Debian Debian Linux vulnerabilities

Sources

Also known as ALSA-2022:6158, BIT-libphp-2022-31625, BIT-php-2022-31625, BIT-php-min-2022-31625, CLSA-2022-1658171149, CLSA-2022-1658171795 and 7 more.

Is CVE-2022-31625 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free