CVE-2021-21706

ZipArchive::extractTo may extract outside of destination dir

MEDIUM
6.5
CVSS Score
Published: October 4, 2021 at 04:00 AM UTC
Updated: June 17, 2026 at 03:36 AM UTC
1 product affected across 1 vendorPHP· also runs on 1 platform

Using PHP by PHP Group?

Get instant alerts when new vulnerabilities affect PHP - before attackers find them.

Real-time alertsTrack your software stackFree plan available
Severity
MEDIUM6.5
Exploit prediction
EPSS 1%

Description

In PHP versions 7.3.x below 7.3.31, 7.4.x below 7.4.24 and 8.0.x below 8.0.11, in Microsoft Windows environment, ZipArchive::extractTo may be tricked into writing a file outside target directory when extracting a ZIP file, thus potentially causing files to be created or overwritten, subject to OS permissions.

Affected

Our own answer: ranges merged, affected separated from platform-only, with confidence and review flags.

PHP· PHPdrupal
95%
7.3.0 ≤ v < 7.3.317.3.x ≤ v < 7.3.317.4.0 ≤ v < 7.4.247.4.x ≤ v < 7.4.248.0.0 ≤ v < 8.0.118.0.X ≤ v < 8.0.117.3.x7.4.x8.0.X
Affected range stops below 7.3.31, so it looks safe — our inference, not a vendor statement
Affected range stops below 7.4.24, so it looks safe — our inference, not a vendor statement
Affected range stops below 8.0.11, so it looks safe — our inference, not a vendor statement
microsoft-windows (environment)

Runs on — not affected

The affected product only carries this flaw when running on these platforms. The platforms themselves are not vulnerable.

Remediation

No guide yet

No remediation guidance has been written for this CVE yet. What the record does show:

Patch and advisory references

References (2)

x_refsource_MISCIssue TrackingPatchVendor Advisory
https://bugs.php.net/bug.php?id=81420

CVSS

Attack Vector
NETWORK
Complexity
LOW
Privileges
NONE
User Interaction
REQUIRED
Scope
UNCHANGED
Confidentiality
NONE
Integrity
HIGH
Availability
NONE
Vector?

Quick Info

StatusMODIFIED
CWE
CWE-24CWE-22

Get alerted

Stop reading CVE feeds looking for your own stack

Track the products you run and VulnTracker tells you when a new CVE affects them — with what is known about fixing it, and nothing about the rest.

Free plan, no card