CVE-2021-32841: Path Traversal in SharpZipLib
4
Basic Information
Technical Details
Package Name | Ecosystem | Vulnerable Versions | First Patched Version |
---|---|---|---|
SharpZipLib | nuget | >= 1.3.0, < 1.3.3 | 1.3.3 |
Vulnerability Intelligence
Miggo AI
Root Cause Analysis
The vulnerability stems from the ExtractEntry
method's path validation logic. The original code combined destDir
with the entry's filename and checked if the full normalized path started with destDir
. However, if destDir
was not slash-terminated (e.g., /home/user/dir
), an entry named dir.sh
would result in a path like /home/user/dir/dir.sh
, which passes the check. More critically, entries exploiting partial directory matches (e.g., dir.sh
as a sibling file) could bypass containment checks. The patch replaced Path.GetFullPath(destFile)
with the directory portion (destFileDir
), ensuring the parent directory of the extracted file is strictly under destDir
, mitigating partial matches. The commit diff and advisory explicitly reference this function as the patched location, confirming its role in the vulnerability.