CVE-2022-31626
PHP vulnerability analysis and mitigation

Overview

CVE-2022-31626 affects PHP versions 7.4.x below 7.4.30, 8.0.x below 8.0.20, and 8.1.x below 8.1.7. The vulnerability exists in the pdo_mysql extension with mysqlnd driver, where if a third party is allowed to supply host to connect to and the password for the connection, a password of excessive length can trigger a buffer overflow in PHP (PHP Bug, MITRE).

Technical details

The vulnerability stems from a buffer overflow condition in the mysqlnd/pdo password handling. When copying the user-submitted password to a buffer for MySQL server authentication, the code allocates auth_data_len bytes but copies auth_data_len + MYSQLND_HEADER_SIZE bytes, leading to a buffer overflow. This occurs during the legacy authentication method that requires sending a raw password instead of using challenge/response logic (PHP Bug). The vulnerability has been assigned a CVSS score of 8.8 (High) with the vector CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H (NetApp Advisory).

Impact

Successful exploitation of this vulnerability could lead to remote code execution on the affected system. The vulnerability is particularly concerning for applications like Adminer and PHPMyAdmin that handle database connections (PHP Bug).

Exploitability

The vulnerability is exploitable remotely by making PHP connect to a rogue MySQL server. The attacker needs to be able to control both the host to connect to and the password for the connection. This makes it particularly relevant for web applications that allow users to specify database connection parameters (PHP Bug).

Mitigation and workarounds

The vulnerability has been fixed in PHP versions 7.4.30, 8.0.20, and 8.1.7. Users are strongly recommended to upgrade to these versions or later. The fix involves adding the size of the header in the buffer allocation computation (Fedora Update).

Additional resources


SourceThis report was generated using AI

Related PHP vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-wg23-69c2-gjc8CRITICAL9.1
  • PHP logoPHP
  • craftcms/cms
NoYesAug 07, 2026
CVE-2026-71488HIGH7.5
  • PHP logoPHP
  • php-league-commonmark
NoYesAug 06, 2026
CVE-2026-62996MEDIUM6.9
  • PHP logoPHP
  • smarty/smarty
NoYesAug 07, 2026
CVE-2026-62992MEDIUM6.9
  • PHP logoPHP
  • smarty/smarty
NoYesAug 07, 2026
CVE-2026-71478MEDIUM6.1
  • PHP logoPHP
  • league/commonmark
NoYesAug 06, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management