CVE-2022-31626: PHP PDO MySQL Password Buffer Overflow Leading to RCE
- Vendors
- Debian ProjectPHP Group
CVE-2022-31626 is a buffer overflow in PHP's mysqlnd connection-password processing when used through the pdo_mysql extension. A third party permitted to supply the connection host and password can trigger the overflow with an excessively long password, potentially enabling remote arbitrary code execution. Affected upstream releases include PHP 7.4.x before 7.4.30, 8.0.x before 8.0.20, and 8.1.x before 8.1.7. Distribution advisories also identify affected older PHP packages.
Impact, mitigation & remediation
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
Impact
What an attacker gets, and what they’ve been doing with it.
Successful exploitation can permit arbitrary code execution in the context of the affected PHP process, potentially exposing sensitive information, allowing unauthorized data modification, and disrupting service. The vulnerability is rated High with a CVSS v3.1 score of 8.8 and high confidentiality, integrity, and availability impacts.
Mitigation
If you can’t patch tonight, do this now.
As an interim risk reduction, prevent untrusted parties from controlling MySQL connection hosts and passwords passed to pdo_mysql, using application-controlled connection settings instead. This removes the documented exploitation precondition but does not replace patching. No separate vendor-provided workaround is identified.
Remediation
Patch, then assume compromise.
Install a vendor-supported PHP release or distribution package containing the fix. The upstream fixes are PHP 7.4.30, 8.0.20, and 8.1.7 for their respective branches. Debian 11 fixes the issue in php7.4 version 7.4.30-1+deb11u1, and Debian 10 fixes it in php7.3 version 7.3.31-1~deb10u2. For other distributions and products embedding PHP, apply the corresponding vendor security update. Account for distribution backports rather than relying solely on the upstream version number.
Exploits
2 exploits validated by Mallory's analysis. Hidden: 1 rejected by Mallory's analysis as not a working exploit.
Affected products & vendors
Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.
References
Frequently asked questions
- Is CVE-2022-31626 exploited in the wild?
- As of Nov 11, 2026, Mallory has no reports of CVE-2022-31626 being exploited in the wild. It is not listed in CISA KEV.
- Is there a public exploit for CVE-2022-31626?
- Yes. Mallory tracks 2 public exploits or proofs of concept for CVE-2022-31626, the earliest disclosed Dec 6, 2022.
- Is there a patch for CVE-2022-31626?
- Install a vendor-supported PHP release or distribution package containing the fix. The upstream fixes are PHP 7.4.30, 8.0.20, and 8.1.7 for their respective branches.
- What products are affected by CVE-2022-31626?
- PHP Group Php and Debian Project Debian Linux.
- How severe is CVE-2022-31626?
- CVE-2022-31626 has a CVSS v3.1 score of 8.8 (High) and an EPSS score of 58.1% (99th percentile) as of Nov 11, 2026.
Recent activity
12 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.