CVE-2021-39208

Medium

Description

SharpCompress is a fully managed C# library to deal with many compression types and formats. Versions prior to 0.29.0 are vulnerable to partial path traversal. SharpCompress recreates a hierarchy of directories under destinationDirectory if ExtractFullPath is set to true in options. In order to prevent extraction outside the destination directory the destinationFileName path is verified to begin with fullDestinationDirectoryPath. However, prior to version 0.29.0, it is not enforced that fullDestinationDirectoryPath ends with slash. If the destinationDirectory is not slash terminated like `/home/user/dir` it is possible to create a file with a name thats begins as the destination directory one level up from the 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. This issue is fixed in SharpCompress version 0.29.0.

SeverityMedium
CVSS4.3
Exploit probability—
ProductSharpcompress
PublishedSep 16, 2021
First seenSep 16, 2021

How to fix

Update
  • sharpcompress_project sharpcompress0.29.0 or later
  • SharpCompress0.29 or later

Affected products

ProductAffected versionsFixed in
sharpcompress_project sharpcompressv < 0.29.00.29.0
SharpCompressNuGetv < 0.290.29

Check your version

Choose the product and enter the version you run to see whether it falls in the affected range.

In the Intelligence 360 plan

Attack Surface Management

See the assets tied to your domains, the technologies they run and known vulnerabilities in one list.