Miggo Logo

CVE-2021-32840: Path Traversal in SharpZipLib

7.3

CVSS Score
3.1

Basic Information

EPSS Score
0.80715%
Published
2/1/2022
Updated
2/3/2023
KEV Status
No
Technology
TechnologyC#

Technical Details

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:L/I:H/A:L
Package NameEcosystemVulnerable VersionsFirst Patched Version
SharpZipLibnuget< 1.3.31.3.3

Vulnerability Intelligence
Miggo AIMiggo AI

Miggo AIRoot Cause Analysis

The vulnerability stems from improper path validation during TAR extraction. The security advisory and added tests specifically target TarArchive.ExtractContents behavior. The tests demonstrate that when allowTraverse=false, the function previously allowed parent directory traversal. The method's failure to properly sanitize paths and enforce containment within the target directory (via Path.GetFullPath checks and directory termination) made it vulnerable. The patch likely added proper path normalization and validation checks in this method.

Vulnerable functions

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

WAF Protection Rules

WAF Rule

S**rpZipLi* (or #zipli*) is * Zip, *Zip, T*r *n* *Zip* li*r*ry. Prior to v*rsion *.*.*, * T*R *il* *ntry `../*vil.txt` m*y ** *xtr**t** in t** p*r*nt *ir**tory o* `**st*ol**r`. T*is l***s to *r*itr*ry *il* writ* t**t m*y l*** to *o** *x**ution. T** v

Reasoning

T** vuln*r**ility st*ms *rom improp*r p*t* v*li**tion *urin* T*R *xtr**tion. T** s**urity **visory *n* ***** t*sts sp**i*i**lly t*r**t `T*r*r**iv*.*xtr**t*ont*nts` ****vior. T** t*sts **monstr*t* t**t w**n *llowTr*v*rs*=**ls*, t** `*un*tion` pr*vious