Skip to main content
Mallory
HighPublic exploitVulnerability

CVE-2022-31626: PHP PDO MySQL Password Buffer Overflow Leading to RCE

Published Jun 16, 2022 · Updated 6 days ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 days3 mentions · peak 2 in a dayToday
CVSS8.8High · v3.1
EPSS58.1%99th percentile
CISA KEVNoNot listed
In the wildNonePublic exploit, no exploitation reported
Vendors
Debian ProjectPHP Group
IdentifiersCVE-2022-31626CWE-120 · Buffer Copy without Checking Size…

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.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

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.

Public exploits

Exploits

2 exploits validated by Mallory's analysis. Hidden: 1 rejected by Mallory's analysis as not a working exploit.

View more in app →
CVE-2022-31626-CVE-2024-2961-CVE-2019-6977This repository is a multi-case PHP exploitation research corpus rather than a single exploit. It contains five exploit environments: RCE-CVE-2022-31626, RCE-CVE-2024-2961, SBE-CVE-2019-6977, RCE-N1CTF-php_master, and RCE-SecurinetsCTF-I_hate_php, plus a large Reproduce/ tree for building vulnerable images, validating mitigations, and benchmarking two defensive patch sets (hashtable and refcount guards). Core exploit capability: each main exploit script achieves memory disclosure followed by corruption of Zend/PHP internal structures to redirect execution to system/popen/destructor gadgets, ultimately executing shell commands and exposing output through a file such as 1.php. The payloads are basic hardcoded shell commands (uname/date), so maturity is OPERATIONAL rather than framework-grade weaponized. Per-case structure: - RCE-CVE-2022-31626: Python exploit against a PHP page that accepts MySQL connection parameters and JSON input. The environment includes a rogue_sql_server.py listener on TCP/3306 to emulate a MySQL server and induce the vulnerable state. The exploit performs two leaks (heap and zend), probes candidate libc offsets, then writes a command string and pivots execution to libc system(). - RCE-CVE-2024-2961: Python exploit against a PHP page calling md5_file() on attacker-controlled php://filter/iconv input. It abuses the glibc ISO-2022-CN-EXT conversion path to obtain heap/zend leaks and then corrupts structures to call system(). - RCE-N1CTF-php_master: Includes a full vulnerable PHP web app (DataForm) with session-backed serialized state and compression/inflate operations. The exploit drives the /dataform endpoint through add/insert/append/delete actions, leaks heap data from error snapshots, constructs fake Zend structures, and brute-probes libc deltas until command execution succeeds. - RCE-SecurinetsCTF-I_hate_php: Includes a custom PHP extension (juice.so) implementing xorBMP(). The exploit sends crafted base64 BMPs and JSON layout data to trigger memory corruption, derives heap and PHP text base addresses from returned BMP data, forges a HashTable/frame, and redirects execution to zif_popen. - SBE-CVE-2019-6977: A PHP-only sandbox-bypass / info-leak / code-exec chain. The target script itself contains the exploitation primitives, exposing ?leak and ?pwn modes. The Python wrapper fetches leaked addresses, computes a gadget address, triggers the overwrite, and polls 1.php for command output. Repository support content: - Dockerfiles for each case build pinned PHP source revisions with custom hardening/experimental patches applied. - Reproduce/Patch-hashtable and Reproduce/Patch-refcnt contain mitigation patches, verification harnesses, and benchmark Dockerfiles. These are not exploits; they are defensive evaluation artifacts showing whether the included exploits still succeed after patching. - Reproduce/run_reliability_100.sh and run_performance_tests.sh automate repeated exploit runs and performance measurements. - Misc/static_analysis.ql and patch files document research into allocator/hashtable/refcount hardening. Overall purpose: to provide reproducible exploit demonstrations for several PHP memory-corruption cases and challenge-derived targets, alongside experimental mitigations and benchmarking infrastructure. The code is clearly exploit-oriented, not merely detection, and the included web endpoints, local FastCGI backends, rogue MySQL service, and output files are all fingerprintable operational artifacts.HORKimhab · Disclosed Aug 6, 2026 · python · php · web · network · fileOperationalCVE-2022-31626This repository contains a proof-of-concept exploit for CVE-2022-31626, a buffer overflow vulnerability in PHP's pdo_mysql extension when used with the mysqlnd driver. The exploit is implemented in Python (exploit.py) and targets PHP versions 7.4.x < 7.4.30, 8.0.x < 8.0.20, and 8.1.x < 8.1.7. The exploit works by sending a specially crafted POST request to a PHP endpoint (e.g., mysql_admin.php) with a very long password and specific key/value pairs, triggering a buffer overflow that can leak heap addresses or achieve remote code execution (RCE), depending on configuration. The README.md provides a brief description of the vulnerability. The exploit requires the attacker to be able to supply the MySQL host and password to the PHP application, and the application must expose a vulnerable endpoint. The main attack vector is network-based, targeting a web-accessible PHP script. The code is a proof-of-concept and may require adaptation for different environments.amitlttwo · Disclosed Dec 6, 2022 · python · networkPoC
Exposure surface

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.

VendorProductType
Debian ProjectDebian Linuxoperating_system
PHP GroupPhpapplication
FAQ

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.
Activity feed

Recent activity

12 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.

View more in app →
tenable nessus pluginsNews · Nov 10, 2026Unity Linux 20.1050a / 20.1060a / 20.1070a Security Update: ph... | Tenable®A buffer overflow in PHP's pdo_mysql extension with the mysqlnd driver can allow remote code execution when a third party controls the connection host and password. The advisory identifies affected PHP packages on Unity Linux 20.1050a, 20.1060a, and 20.1070a. The plugin rates the vulnerability High with a CVSS v3 score of 8.8 and reports that exploits are available. Nessus checks the application's self-reported version rather than testing exploitation.Read more ↗tenable nessus pluginsNews · Nov 10, 2026Unity Linux 20.1050a / 20.1060a / 20.1070a Security Update: ph... | Tenable®A buffer overflow in PHP's pdo_mysql extension when using the mysqlnd driver can allow remote code execution if a third party controls the connection host and password. The advisory covers affected PHP packages on Unity Linux 20.1050a, 20.1060a, and 20.1070a. The listed CVSS v3 base score is 8.8 (High). Nessus detection relies on the application's self-reported version rather than testing exploitation.Read more ↗tenable cloud security pluginsNews · Oct 25, 2026Echo: php-7.2: security update to 7.2.34+e1 | Tenable®A buffer overflow vulnerability in PHP's pdo_mysql extension with the mysqlnd driver can allow remote code execution when an attacker controls the connection host and password. The advisory lists PHP 7.4.x before 7.4.30, 8.0.x before 8.0.20, and 8.1.x before 8.1.7 as affected. The Echo plugin also flags its php-7.2 package and recommends updating to 7.2.34+e1 or later. The reported CVSS v3 base score is 8.8 (High).Read more ↗tenable nessus pluginsNews · Oct 1, 2026Rocky Linux 8 [CIQ] Security Update: apcu-panel / libzip / lib... | Tenable®A PHP buffer-overflow vulnerability in which an excessively long password can trigger remote code execution. The notice identifies affected packages on Rocky Linux 8 and directs administrators to apply the CIQ crlsa-2022_5468 advisory updates.Read more ↗
+4 more in the timeline. Sign up to see them
Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidenceEvery report linking this CVE to a named adversary.
Associated malwareMalware families linked to this CVE, with evidence and IOCs.
Detection signaturesYARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity1Community discussion across Reddit, Mastodon, and other social sources.