The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2022-31626

CVE-2022-31626: PHP pdo_mysql Buffer Overflow RCE Flaw

CVE-2022-31626 is a buffer overflow vulnerability in PHP's pdo_mysql extension that enables remote code execution when excessive password lengths are used. This article covers technical details, affected versions, and mitigation.

Published: February 17, 2026

CVE-2022-31626 Overview

CVE-2022-31626 is a buffer overflow vulnerability affecting 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 within the pdo_mysql extension when using the mysqlnd driver. When a third party is allowed to supply the host to connect to and the password for the connection, an excessively long password can trigger a buffer overflow in PHP, potentially leading to remote code execution.

Critical Impact

This buffer overflow vulnerability in PHP's pdo_mysql extension can be exploited by attackers to achieve remote code execution on affected systems, potentially leading to complete system compromise.

Affected Products

  • PHP 7.4.x versions below 7.4.30
  • PHP 8.0.x versions below 8.0.20
  • PHP 8.1.x versions below 8.1.7
  • Debian Linux 10.0
  • Debian Linux 11.0

Discovery Timeline

  • 2022-06-16 - CVE-2022-31626 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2022-31626

Vulnerability Analysis

This vulnerability is classified as CWE-120 (Buffer Copy without Checking Size of Input), commonly known as a classic buffer overflow. The flaw resides in how PHP's pdo_mysql extension with the mysqlnd driver handles password authentication during database connection establishment.

When an application allows user-controlled input for database connection parameters, particularly the password field, attackers can supply a password of excessive length. The mysqlnd driver fails to properly validate the length of the password before copying it into a fixed-size buffer, resulting in a buffer overflow condition.

The attack requires network access and low privileges, but no user interaction is needed. Successful exploitation can lead to complete compromise of confidentiality, integrity, and availability of the affected system.

Root Cause

The root cause of CVE-2022-31626 is insufficient bounds checking in the mysqlnd driver's password handling routine within the pdo_mysql extension. The driver allocates a fixed-size buffer for password storage but does not verify that the incoming password length fits within this buffer before performing the copy operation. This classic buffer overflow pattern allows an attacker to overwrite adjacent memory regions.

Attack Vector

The attack vector for this vulnerability requires specific conditions to be met:

  1. The target application must use PHP's pdo_mysql extension with the mysqlnd driver
  2. The application must allow third-party input to control the database host and password parameters
  3. The attacker submits an excessively long password string during connection establishment

When these conditions are met, the attacker-supplied oversized password overwrites memory beyond the allocated buffer. Depending on the memory layout and exploitation technique, this can lead to arbitrary code execution, allowing the attacker to run malicious code with the privileges of the PHP process.

The vulnerability is exploited over the network, making it particularly dangerous for web applications that accept user input for database connection parameters, such as multi-tenant applications or database administration tools.

Detection Methods for CVE-2022-31626

Indicators of Compromise

  • Abnormally long password strings in MySQL/MariaDB connection attempts exceeding typical password lengths
  • PHP process crashes or unexpected terminations, particularly during database connection operations
  • Unusual memory access patterns or segmentation faults in PHP error logs
  • Signs of code execution following pdo_mysql connection attempts

Detection Strategies

  • Monitor PHP error logs for buffer overflow indicators, memory corruption, or segmentation faults related to pdo_mysql operations
  • Implement input validation rules to flag excessively long password strings in database connection parameters
  • Deploy runtime application self-protection (RASP) solutions to detect memory corruption attempts
  • Use SentinelOne's behavioral AI to identify anomalous process behavior indicative of exploitation

Monitoring Recommendations

  • Enable comprehensive logging for PHP applications, capturing connection parameters (excluding actual passwords)
  • Monitor for unusual PHP process behavior, including unexpected child processes or network connections
  • Track PHP version inventory across your environment to identify unpatched instances
  • Configure alerts for MySQL/MariaDB authentication failures with unusually large connection payloads

How to Mitigate CVE-2022-31626

Immediate Actions Required

  • Upgrade PHP to version 7.4.30, 8.0.20, or 8.1.7 or later depending on your PHP branch
  • Audit applications to identify any that allow user-controlled database connection parameters
  • Implement strict input validation on any user-supplied database connection strings, particularly password length limits
  • Consider using a Web Application Firewall (WAF) to filter excessively long password inputs

Patch Information

PHP has released security patches addressing this vulnerability. Organizations should upgrade to the following versions or later:

  • PHP 7.4.x: Upgrade to 7.4.30 or later
  • PHP 8.0.x: Upgrade to 8.0.20 or later
  • PHP 8.1.x: Upgrade to 8.1.7 or later

For detailed information, refer to PHP Bug Report #81719. Distribution-specific patches are also available via Debian Security Advisory DSA-5179, Gentoo GLSA 202209-20, and respective Fedora package announcements.

Workarounds

  • Restrict user input for database connection parameters; never allow untrusted input to control host or password values
  • Implement application-level password length validation before passing to PDO connection functions
  • Use connection pooling or centralized database connection management to reduce exposure
  • Consider switching to mysqli with a different driver if pdo_mysql with mysqlnd cannot be immediately patched
bash
# Verify your PHP version and check for vulnerable installations
php -v

# Check for pdo_mysql extension with mysqlnd driver
php -i | grep -i "pdo_mysql\|mysqlnd"

# Update PHP on Debian/Ubuntu systems
sudo apt update && sudo apt upgrade php

# Update PHP on RHEL/CentOS/Fedora systems
sudo dnf update php

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechPhp

  • SeverityHIGH

  • CVSS Score8.8

  • EPSS Probability11.68%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-120
  • Technical References
  • Debian LTS Announcement December 2022

  • Fedora Package Announcement

  • Fedora Package Announcement

  • Gentoo GLSA 202209-20

  • NetApp Security Advisory NTAP-20220722-0005

  • Debian Security Advisory DSA-5179
  • Vendor Resources
  • PHP Bug Report #81719
  • Related CVEs
  • CVE-2024-1874: PHP proc_open() RCE Vulnerability

  • CVE-2024-8926: PHP Command Injection RCE Vulnerability

  • CVE-2024-4577: PHP CGI on Windows RCE Vulnerability

  • CVE-2024-5585: PHP proc_open() RCE Vulnerability
Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English