CVE-2022-31626 mysqlnd/pdo password buffer overflow
A buffer overflow in PHP's mysqlnd driver allows remote code execution if an attacker controls the connection host and password length.
- Exploited in the wild
- Not known
- Login needed
- Any signed-in user
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2022-31626?
CVE-2022-31626 is a high-severity memory corruption vulnerability in Debian Debian Linux, published on 16 Jun 2022. Any signed-in user can exploit it over the network, 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 pdo_mysql extension with mysqlnd driver, if the third party is allowed to supply host to connect to and the password for the connection, password of excessive length can trigger a buffer overflow in PHP, which can lead to a remote code execution vulnerability.
Weakness: CWE-120
Which versions are affected by CVE-2022-31626?
3 open source packages ship an affected version, including libphp, php and php-min. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
libphp Bitnami | From 7.4.0 | 7.4.30, 8.0.20, 8.1.7 |
php Bitnami | From 7.4.0 | 7.4.30, 8.0.20, 8.1.7 |
php-min Bitnami | From 7.4.0 | 7.4.30, 8.0.20, 8.1.7 |
Linux distribution packages (37)
apcu-panel AlmaLinux:8 | All versions | 5.1.20-1.module_el8.6.0+2739+efabdb8f |
libzip AlmaLinux:8 | All versions | 1.7.3-1.module_el8.6.0+2739+efabdb8f |
libzip-devel AlmaLinux:8 | All versions | 1.7.3-1.module_el8.6.0+2739+efabdb8f |
libzip-tools AlmaLinux:8 | All versions | 1.7.3-1.module_el8.6.0+2739+efabdb8f |
php-pear AlmaLinux:8 | All versions | 1:1.10.13-1.module_el8.6.0+3268+b150a051 |
php-pecl-apcu AlmaLinux:8 | All versions | 5.1.20-1.module_el8.6.0+2739+efabdb8f |
php-pecl-apcu-devel AlmaLinux:8 | All versions | 5.1.20-1.module_el8.6.0+2739+efabdb8f |
php-pecl-rrd AlmaLinux:8 | All versions | 2.0.3-1.module_el8.6.0+2739+efabdb8f |
php-pecl-xdebug3 AlmaLinux:8 | All versions | 3.1.2-1.module_el8.6.0+2739+efabdb8f |
php-pecl-zip AlmaLinux:8 | All versions | 1.19.2-1.module_el8.6.0+2739+efabdb8f |
php AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-bcmath AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-cli AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-common AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-dba AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-dbg AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-devel AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-embedded AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-enchant AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-ffi AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-fpm AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-gd AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-gmp AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-intl AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-ldap AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-mbstring AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-mysqlnd AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-odbc AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-opcache AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-pdo AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-pgsql AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-process AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-snmp AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-soap AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
php-xml AlmaLinux:9 | All versions | 8.0.13-2.el9_0 |
apcu-panel Red Hat:enterprise_linux:8::appstream | All versions | 0:5.1.18-1.module+el8.3.0+6678+b09f589e |
apcu-panel Red Hat:enterprise_linux:8::appstream | All versions | 0:5.1.20-1.module+el8.6.0+13671+84712317 |
Products include Debian Debian Linux, Php Php.
How do I fix CVE-2022-31626?
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-31626 being exploited?
There is no known exploitation of CVE-2022-31626 in the wild and no public exploit code.
Public exploit code: 2 proofs of concept on GitHub.
Other vulnerabilities in Debian Debian Linux
Sources
Also known as ALSA-2022:5468, ALSA-2022:5904, BIT-libphp-2022-31626, BIT-php-2022-31626, BIT-php-min-2022-31626, DEBIAN-CVE-2022-31626 and 10 more.