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.
High severity with no evidence of exploitation so far.
What to do
- Update PHP to 7.4.30 or 8.0.20 or 8.1.7, whichever matches your release line, or a later version.
- Read the advisory on bugs.php.net for workarounds and exact fixed builds.
- Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.
Affected products and versions
| Vendor | Product | Affected versions | Fixed in |
|---|---|---|---|
| PHP Group | PHP | 7.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.7 | 7.4.30, 8.0.20, 8.1.7 |
| Debian | Debian Linux | 10.0; 11.0 | Not 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 system | Score | Severity | Scored by |
|---|---|---|---|
| CVSS 3.1 | 8.1 | High | CNA (php.net) |
| CVSS 3.1 | 8.1 | High | NVD |
| CVSS 2.0 | 6.8 | Medium | NVD |
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
- CVE record published.
- Record last changed materially (score, affected products, status or references).
References
Advisories
- bugs.php.net/bug.php?id=81720Exploit, Issue Tracking, Mailing List
Third-party and government advisories
- lists.debian.org/debian-lts-announce/2022/12/msg00030.htmlMailing List, Third Party Advisory
- security.gentoo.org/glsa/202209-20Third Party Advisory
- security.netapp.com/advisory/ntap-20220722-0005/Third Party Advisory
- debian.org/security/2022/dsa-5179Third Party Advisory
Other references
Other vulnerabilities in PHP
- 8.1 High severity
PHP Stale Internal Request-State Exploited
- 9.8 Critical severity
PHP Memory Corruption Exploited
- 7.5 High severity
- 7.5 High severity
- 9.8 Critical severity
- 9.8 Critical severity
Spotted an error? Tell us.