CyberSecBulletin
CVE-2022-31625NVD status: Modified

PHP: Release of Invalid Pointer or Reference

CVE-2022-31625 is a high-severity release of invalid pointer or reference vulnerability in PHP from PHP Group, with a CVSS 3.1 base score of 8.1 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. The record lists versions 7.4.30, 8.0.20, 8.1.7 as the first without the flaw, so updating PHP to one of those releases or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 3.79% chance of exploitation within 30 days, which is in the top 9.85% of all scored CVEs.

Next patch cycle

High severity with no evidence of exploitation so far.

What to do

  1. Update PHP to 7.4.30 or 8.0.20 or 8.1.7, whichever matches your release line, or a later version.
  2. Read the advisory on bugs.php.net for workarounds and exact fixed builds.
  3. Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.

Affected products and versions

VendorProductAffected versionsFixed in
PHP GroupPHP7.4.X up to, but not including, 7.4.30; 8.0.X up to, but not including, 8.0.20; 8.1.X up to, but not including, 8.1.77.4.30, 8.0.20, 8.1.7
DebianDebian Linux10.0; 11.0Not stated

Version data comes from the organisation that assigned the CVE. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Attack vector
NetworkCan be exploited remotely over a network, including the internet.
Attack complexity
HighSuccess depends on conditions outside the attacker's control.
Privileges required
NoneNo account or login is needed.
User interaction
NoneNo action by a victim is required.
Scope
UnchangedImpact stays within the vulnerable component.
Confidentiality
HighAll data handled by the component can be read.
Integrity
HighData or code can be modified at will.
Availability
HighThe component can be taken down completely.

Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H. Scored by NVD.

Scoring systemScoreSeverityScored by
CVSS 3.18.1HighCNA (php.net)
CVSS 3.18.1HighNVD
CVSS 2.06.8MediumNVD

Official description

In 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 Postgres database extension, supplying invalid parameters to the parametrized query may lead to PHP attempting to free memory using uninitialized data as pointers. This could lead to RCE vulnerability or denial of service.

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Release of Invalid Pointer or Reference

The product attempts to return a memory resource to the system, but it calls the wrong release function or calls the appropriate release function incorrectly.

How developers prevent this class of flaw

  • Only call matching memory management functions. Do not mix and match routines. For example, when you allocate a buffer with malloc(), dispose of the original pointer with free().
  • When programming in C++, consider using smart pointers provided by the boost library to help correctly and consistently manage memory.
  • Use a vetted library or framework that does not allow this weakness to occur or provides constructs that make this weakness easier to avoid. For example, glibc in Linux provides protection against free of invalid pointers.

More Release of Invalid Pointer or Reference vulnerabilities (CWE-763)

Timeline

  1. CVE record published.
  2. Record last changed materially (score, affected products, status or references).

References

Advisories

Third-party and government advisories

Other vulnerabilities in PHP

All PHP vulnerabilities

Spotted an error? Tell us.