CVE-2025-14180

7.5 HIGH

📋 TL;DR

This vulnerability in PHP's PDO PostgreSQL driver causes a null pointer dereference when using prepared statements with invalid character sequences, leading to segmentation faults and server crashes. It affects PHP applications using PostgreSQL with PDO::ATTR_EMULATE_PREPARES enabled. The vulnerability impacts availability by causing denial of service.

💻 Affected Systems

Products:
  • PHP
Versions: PHP 8.1.* before 8.1.34, 8.2.* before 8.2.30, 8.3.* before 8.3.29, 8.4.* before 8.4.16, 8.5.* before 8.5.1
Operating Systems: All operating systems running affected PHP versions
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when using PDO PostgreSQL driver with PDO::ATTR_EMULATE_PREPARES enabled. Other database drivers or configurations are not affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server crash leading to sustained denial of service, potentially affecting multiple applications on the same server.

🟠

Likely Case

Application crashes and restarts causing intermittent service disruption and degraded performance.

🟢

If Mitigated

Minimal impact if proper input validation and error handling are implemented at application level.

🌐 Internet-Facing: MEDIUM - Requires specific conditions (PDO PostgreSQL with emulate prepares) and attacker-controlled input, but could be triggered by malicious requests.
🏢 Internal Only: LOW - Internal applications typically have controlled input sources, reducing exposure to malicious character sequences.

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires sending specially crafted input to applications using vulnerable PHP configuration. No authentication needed if application accepts external input.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: PHP 8.1.34, 8.2.30, 8.3.29, 8.4.16, 8.5.1

Vendor Advisory: https://github.com/php/php-src/security/advisories/GHSA-8xr5-qppj-gvwj

Restart Required: Yes

Instructions:

1. Identify PHP version using 'php -v'. 2. Upgrade to patched version via package manager (apt-get upgrade php, yum update php, etc.). 3. Restart web server (apache2 restart, systemctl restart nginx). 4. Verify fix with 'php -v'.

🔧 Temporary Workarounds

Disable PDO::ATTR_EMULATE_PREPARES

all

Disable emulate prepares in PDO PostgreSQL connections to avoid the vulnerable code path.

$pdo->setAttribute(PDO::ATTR_EMULATE_PREPARES, false);

Input Validation Filter

all

Implement input validation to reject invalid character sequences before they reach PDO.

if (!preg_match('/^[\x20-\x7E]+$/', $input)) { throw new Exception('Invalid characters'); }

🧯 If You Can't Patch

  • Implement strict input validation to filter out invalid character sequences (\x00-\x1F, \x7F-\xFF) from user inputs.
  • Use alternative database drivers or switch to native prepared statements by disabling PDO::ATTR_EMULATE_PREPARES.

🔍 How to Verify

Check if Vulnerable:

Check PHP version with 'php -v' and verify if using PDO PostgreSQL with emulate prepares enabled.

Check Version:

php -v | grep -oP 'PHP \K[0-9]+\.[0-9]+\.[0-9]+'

Verify Fix Applied:

After patching, confirm version is 8.1.34+, 8.2.30+, 8.3.29+, 8.4.16+, or 8.5.1+ with 'php -v'.

📡 Detection & Monitoring

Log Indicators:

  • Segmentation fault errors in PHP/webserver logs
  • Unexpected process termination of PHP-FPM or Apache workers
  • PostgreSQL connection errors following PHP crashes

Network Indicators:

  • Sudden increase in HTTP 500 errors
  • Service unavailability patterns coinciding with database queries

SIEM Query:

source="php_error.log" AND ("segmentation fault" OR "null pointer" OR "SIGSEGV")

🔗 References

📤 Share & Export