CVE-2021-32760: Archive package allows chmod of file outside of unpack target directory
5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.35127%
CWE
Published
7/26/2021
Updated
1/31/2024
KEV Status
No
Technology
Go
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:L/I:L/A:L
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
github.com/containerd/containerd | go | < 1.4.8 | 1.4.8 |
github.com/containerd/containerd | go | >= 1.5.0, < 1.5.4 | 1.5.4 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from how symlink handling was implemented in handleLChmod. The pre-patch code used os.Lstat(hdr.Linkname)
to check if the target was a symlink before applying chmod
. This allowed attackers to reference host files via symlinks in crafted images. The patch changes this to os.Lstat(path)
, ensuring permissions are only modified on the extracted symlink file itself, not its external target. The added test case 'HardlinkSymlinkChmod' in tar_test.go
directly validates this fix by ensuring permissions on a file referenced via symlink outside the extraction root remain unchanged.