Heap-use-after-free in zend_gc_addref in PHP

php Updated 02 Oct 2025

Summary

17/09/2020
HIGH
Yes i
High
Not published

OSV-2020-1779: Heap-use-after-free in zend_gc_addref. Affects php across 2 version ranges.

>= 4e198c00646604b5fe6726cdc9eba4c2b7861ce2 >= f51bbcc2b2fd54ce75bf7d554a010c5bb5ea991d, < dd4a080133b7b0570b629cdfb7c9e2651bdf88f7

Fixed in dd4a080133b7b0570b629cdfb7c9e2651bdf88f7. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

PHP is a popular general-purpose scripting language that is widely used for web development. It is known for its flexibility and ease of use. The zend_gc_addref function in PHP is responsible for adding a reference to a garbage-collected object. However, a vulnerability has been discovered in this function that can lead to a heap-use-after-free condition. This vulnerability can be exploited by an attacker to execute arbitrary code or cause a denial of service.

Vulnerability Detail

The vulnerability occurs due to a use-after-free bug in the zend_gc_addref function. When a generator object is destroyed, the zend_generator_dtor_storage function is called, which in turn calls zend_generator_update_current. However, if the generator object is modified during the destruction process, a use-after-free condition can occur when zend_generator_update_current tries to access the object. This can lead to a crash or allow an attacker to execute arbitrary code.

How To Fix

Minimum fixed version

dd4a080133b7b0570b629cdfb7c9e2651bdf88f7

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

There is currently no known workaround for this vulnerability. It is recommended to update to a patched version of PHP as soon as possible.

Conclusion

In conclusion, the zend_gc_addref function in PHP is vulnerable to a heap-use-after-free condition. This vulnerability can be exploited by an attacker to execute arbitrary code or cause a denial of service. It is recommended to update to a patched version of PHP to mitigate this vulnerability. For further support on vulnerability remediation, you can contact DevNack.com.

See every vulnerability recorded for php →

Share this vulnerability

FAQ

This vulnerability can be exploited by an attacker to execute arbitrary code or cause a denial of service.

You can use the Vulert playground at Vulert Scanner to check if your application is affected by this vulnerability. Simply upload your package-lock.json file and Vulert will analyze it for any known vulnerabilities, including this one.

Yes, the vulnerability has been fixed in the PHP source code. It is recommended to update to a version of PHP that includes the fix.

No, there are currently no known workarounds for this vulnerability. It is recommended to update to a patched version of PHP.

You can find more information about this vulnerability in the OSS-Fuzz report at https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=25697.

Related vulnerabilities

Recent vulnerabilities recorded for php.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

dd4a080133b7b0570b629cdfb7c9e2651bdf88f7

This is the first release that contains the fix.

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback