Miggo Logo

CVE-2020-29529: Unsafe tar unpacking in HashiCorp go-slug

7.5

CVSS Score
3.1

Basic Information

EPSS Score
0.75796%
Published
2/6/2023
Updated
2/6/2023
KEV Status
No
Technology
TechnologyGo

Technical Details

CVSS Vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
Package NameEcosystemVulnerable VersionsFirst Patched Version
github.com/hashicorp/go-sluggo< 0.5.00.5.0

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot 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.

Vulnerable functions

Only Mi**o us*rs **n s** t*is s**tion

WAF Protection Rules

WAF Rule

**s*i*orp *o-slu* ***or* *.*.* *o*s not ***r*ss *tt*mpts *t *ir**tory tr*v*rs*l involvin* ../ *n* symlinks.

Reasoning

T** vuln*r**ility st*ms *rom two k*y issu*s in t** `Unp**k` *un*tion: *) L**k o* p*t* tr*v*rs*l v*li**tion usin* *l**n** p*t*s *n* strin* pr**ix ****ks, *llowin* '../' s*qu*n**s to *s**p* t** t*r**t *ir**tory. *) **ilur* to v*ri*y t**t *ll p*r*nt p*t