CVE-2021-32840 Path Traversal in SharpZipLib

High 7.3 Published Updated

Attackers can extract malicious TAR files to write arbitrary files outside the target directory, potentially leading to code execution.

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-32840?

CVE-2021-32840 is a high-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. Prior to version 1.3.3, a TAR file entry `../evil.txt` may be extracted in the parent directory of `destFolder`. This leads to arbitrary file write that may lead to code execution. The vulnerability was patched in version 1.3.3.

Weakness: CWE-22

Which versions are affected by CVE-2021-32840?

2 open source packages ship an affected version, including SharpZipLib. It affects 1 product.

PackageAffectedFixed in
SharpZipLib NuGetAll versions1.3.3
SharpZipLib NuGetAll versions1.3.3

Products include Sharpziplib Project Sharpziplib.

How do I fix CVE-2021-32840?

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-32840 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2021-32840 exists.

Sources

Also known as GHSA-m22m-h4rf-pwq3, UBUNTU-CVE-2021-32840.

Is CVE-2021-32840 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free