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-31625

CVE-2022-31625: PHP PostgreSQL Extension RCE Vulnerability

CVE-2022-31625 is a remote code execution vulnerability in PHP's PostgreSQL extension affecting versions 7.4.x, 8.0.x, and 8.1.x. Invalid query parameters can trigger memory corruption. This article covers technical details, affected versions, impact, and mitigation steps.

Published: February 17, 2026

CVE-2022-31625 Overview

CVE-2022-31625 is a memory corruption 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. When using the PostgreSQL database extension, supplying invalid parameters to parametrized queries may lead to PHP attempting to free memory using uninitialized data as pointers. This vulnerability could result in remote code execution (RCE) or denial of service conditions.

Critical Impact

This vulnerability enables attackers to potentially achieve remote code execution or cause denial of service by exploiting improper memory handling in PHP's PostgreSQL extension when processing malformed query parameters.

Affected Products

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

Discovery Timeline

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

Technical Details for CVE-2022-31625

Vulnerability Analysis

This vulnerability resides in PHP's PostgreSQL database extension (pgsql) and involves improper memory management during parametrized query processing. The core issue stems from the use of uninitialized memory pointers, which are subsequently passed to memory deallocation functions. When invalid parameters are supplied to parametrized queries, the extension fails to properly initialize memory structures before attempting to free them.

The vulnerability is classified under CWE-590 (Free of Memory not on the Heap) and CWE-763 (Release of Invalid Pointer or Reference), indicating that the root cause involves improper pointer management during memory operations. The network-accessible nature of this vulnerability means that web applications using PHP with PostgreSQL backends are potentially at risk if they process user-controlled input in database queries.

Successful exploitation requires the attacker to supply specially crafted invalid parameters to parametrized PostgreSQL queries. While the attack complexity is high due to the specific conditions required for exploitation, the potential impact is severe—attackers could achieve arbitrary code execution within the context of the PHP process or cause application crashes leading to denial of service.

Root Cause

The vulnerability originates from improper initialization of memory structures within PHP's PostgreSQL extension. Specifically, when processing parametrized queries with invalid parameters, the extension allocates memory for parameter handling but fails to properly initialize the associated pointer variables. When the cleanup routines execute, they attempt to free memory using these uninitialized pointers, leading to undefined behavior.

This type of "use of uninitialized pointer" vulnerability can cause the application to attempt freeing arbitrary memory addresses, potentially corrupting heap metadata or other critical data structures. The dual CWE classification (CWE-590 and CWE-763) reflects both the improper memory freeing operation and the use of invalid pointer references.

Attack Vector

The attack vector is network-based, meaning remote attackers can potentially exploit this vulnerability through web applications that utilize PHP with the PostgreSQL extension. The exploitation scenario typically involves:

  1. Identifying a PHP application that uses PostgreSQL parametrized queries
  2. Supplying carefully crafted invalid parameters through user input channels
  3. Triggering the vulnerable code path that leads to uninitialized pointer usage
  4. Achieving either code execution through memory corruption or denial of service through application crash

While no authenticated access is required, the attack complexity is elevated due to the specific conditions needed to trigger the vulnerability successfully. The vulnerability affects the confidentiality, integrity, and availability of the system.

Detection Methods for CVE-2022-31625

Indicators of Compromise

  • Unexpected PHP process crashes or segmentation faults when processing PostgreSQL queries
  • Anomalous memory access patterns in PHP error logs related to the pgsql extension
  • Application instability or unexpected behavior following database query operations
  • Core dump files indicating memory corruption in PHP processes

Detection Strategies

  • Monitor PHP error logs for segmentation faults, memory corruption errors, or pgsql extension failures
  • Implement application-level logging to track parametrized query execution and parameter validation
  • Deploy web application firewalls (WAF) with rules to detect malformed database query parameters
  • Use runtime application self-protection (RASP) solutions to detect anomalous memory operations

Monitoring Recommendations

  • Enable verbose logging for PHP's PostgreSQL extension to capture parameter processing errors
  • Configure system monitoring to alert on PHP process crashes or abnormal terminations
  • Implement database query auditing to identify suspicious or malformed parametrized queries
  • Set up memory monitoring for PHP-FPM or PHP processes to detect unusual allocation patterns

How to Mitigate CVE-2022-31625

Immediate Actions Required

  • Upgrade PHP to version 7.4.30 or later (for 7.4.x branch)
  • Upgrade PHP to version 8.0.20 or later (for 8.0.x branch)
  • Upgrade PHP to version 8.1.7 or later (for 8.1.x branch)
  • Apply vendor security patches for Debian and other affected distributions
  • Review and validate all PostgreSQL parametrized query input handling in applications

Patch Information

Security patches addressing CVE-2022-31625 have been released by PHP and various Linux distributions. The fix ensures proper initialization of memory structures before any deallocation operations occur in the PostgreSQL extension. Administrators should consult the following resources for distribution-specific patches:

  • PHP Bug Report #81720 - Original bug report with technical details
  • Debian Security Advisory DSA-5179 - Debian stable release patches
  • Debian LTS Announcement - Long-term support updates
  • Gentoo GLSA 202209-20 - Gentoo Linux security advisory
  • NetApp Security Advisory - NetApp product updates

Workarounds

  • Implement strict input validation for all parameters passed to PostgreSQL parametrized queries
  • Consider using prepared statements with robust parameter type checking at the application level
  • Deploy web application firewalls to filter potentially malicious query parameters
  • Isolate PHP processes using containers or sandboxing to limit impact of potential exploitation
  • Monitor and limit resource consumption of PHP processes to mitigate denial of service impact
bash
# Verify PHP version after patching
php -v

# Check PostgreSQL extension version
php -m | grep pgsql

# Verify patched version on Debian/Ubuntu
apt-cache policy php8.1-pgsql

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.1

  • EPSS Probability0.77%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityHigh
  • IntegrityNone
  • AvailabilityHigh
  • CWE References
  • CWE-590

  • CWE-763
  • Technical References
  • Debian LTS Announcement December 2022

  • Fedora Package Announcement 1

  • Fedora Package Announcement 2

  • Gentoo GLSA 202209-20

  • NetApp Security Advisory NTAP-20220722-0005

  • Debian Security Advisory DSA-5179
  • Vendor Resources
  • PHP Bug Report #81720
  • 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
Default Legacy - Prefooter | 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