CVE-2021-32841 Path Traversal in SharpZipLib
An attacker can create files outside the intended directory if the destination path lacks a trailing slash, potentially overwriting or creating unintended files.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Local or same network only
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2021-32841?
CVE-2021-32841 is a medium-severity path traversal vulnerability in icsharpcode sharpziplib, published on 26 Jan 2022. It can only be exploited from the same machine or local network, with no action from the victim.
Official description
SharpZipLib (or #ziplib) is a Zip, GZip, Tar and BZip2 library. Starting version 1.3.0 and prior to version 1.3.3, a check was added if the destination file is under destination directory. However, it is not enforced that `destDir` ends with slash. If the `destDir` is not slash terminated like `/home/user/dir` it is possible to create a file with a name thats begins with the destination directory, i.e. `/home/user/dir.sh`. Because of the file name and destination directory constraints, the arbitrary file creation impact is limited and depends on the use case. Version 1.3.3 contains a patch for this vulnerability.
Weakness: CWE-22
Which versions are affected by CVE-2021-32841?
2 open source packages ship an affected version, including SharpZipLib. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
SharpZipLib NuGet | From 1.3.0 | 1.3.3 |
SharpZipLib NuGet | From 1.3.0 | 1.3.3 |
Products include Sharpziplib Project Sharpziplib.
How do I fix CVE-2021-32841?
Upgrade SharpZipLib to 1.3.3 or later.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
Is CVE-2021-32841 being exploited?
It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-32841 exists.
Other vulnerabilities in icsharpcode sharpziplib
Sources
Also known as GHSA-2x7h-96h5-rq84, UBUNTU-CVE-2021-32841.