CVE-2020-29529: Unsafe tar unpacking in HashiCorp go-slug
7.5
CVSS Score
3.1
Basic Information
CVE ID
GHSA ID
EPSS Score
0.75796%
CWE
Published
2/6/2023
Updated
2/6/2023
KEV Status
No
Technology
Go
Technical Details
CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
github.com/hashicorp/go-slug | go | < 0.5.0 | 0.5.0 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from two key issues in the Unpack
function: 1) Lack of path traversal validation using cleaned paths and string prefix checks, allowing '../' sequences to escape the target directory. 2) Failure to verify that all parent path components are not symlinks, enabling extraction through malicious symlink chains. The commit 28cafc5
adds both the path validation (strings.HasPrefix
) and symlink traversal checks (component-by-component Lstat
), confirming these were missing in vulnerable versions. Test cases in slug_test.go
demonstrate exploitation via symlink chains and path traversal filenames, which would have been blocked by the added protections.