Skip to content

CVE-2021-39208 WriteEntryToDirectory used for an archive extraction is vulnerable to partial path traversal.

MediumCVSS 4.3 EPSS 1.2%
Published
Updated
Exploit status
No public exploit known

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.

Upgrade path

3 packages: 2 fixed.

PackageAffectedFixed inStatus
nuget sharpcompress(NuGet) < 0.29; = 0.2.0; = 0.3.0; = 0.4.0 +58 more 0.29 Fixed
sharpcompress project sharpcompress < 0.29.0 0.29.0 Fixed
adamhathcock sharpcompress = < 0.29.0 No fix listed Versions listed

Affected products

ProductAffected versionsFixed in
nuget sharpcompress(NuGet) < 0.29 0.29
nuget sharpcompress(NuGet) = 0.10.0 No fix listed
nuget sharpcompress(NuGet) = 0.10.1 No fix listed
nuget sharpcompress(NuGet) = 0.10.1.1 No fix listed
nuget sharpcompress(NuGet) = 0.10.1.3 No fix listed
nuget sharpcompress(NuGet) = 0.10.2 No fix listed
nuget sharpcompress(NuGet) = 0.10.3 No fix listed
nuget sharpcompress(NuGet) = 0.11.0 No fix listed
nuget sharpcompress(NuGet) = 0.11.1 No fix listed
nuget sharpcompress(NuGet) = 0.11.2 No fix listed
nuget sharpcompress(NuGet) = 0.11.3 No fix listed
nuget sharpcompress(NuGet) = 0.11.4 No fix listed
nuget sharpcompress(NuGet) = 0.11.5 No fix listed
nuget sharpcompress(NuGet) = 0.11.6 No fix listed
nuget sharpcompress(NuGet) = 0.12.0 No fix listed
nuget sharpcompress(NuGet) = 0.12.1 No fix listed
nuget sharpcompress(NuGet) = 0.12.2 No fix listed
nuget sharpcompress(NuGet) = 0.12.3 No fix listed
nuget sharpcompress(NuGet) = 0.12.4 No fix listed
nuget sharpcompress(NuGet) = 0.13.0 No fix listed
nuget sharpcompress(NuGet) = 0.13.1 No fix listed
nuget sharpcompress(NuGet) = 0.14.0 No fix listed
nuget sharpcompress(NuGet) = 0.14.1 No fix listed
nuget sharpcompress(NuGet) = 0.15.0 No fix listed
nuget sharpcompress(NuGet) = 0.15.1 No fix listed
Show 39 more
ProductAffected versionsFixed in
nuget sharpcompress(NuGet) = 0.15.2 No fix listed
nuget sharpcompress(NuGet) = 0.16.0 No fix listed
nuget sharpcompress(NuGet) = 0.16.1 No fix listed
nuget sharpcompress(NuGet) = 0.16.2 No fix listed
nuget sharpcompress(NuGet) = 0.17.0 No fix listed
nuget sharpcompress(NuGet) = 0.17.1 No fix listed
nuget sharpcompress(NuGet) = 0.18.0 No fix listed
nuget sharpcompress(NuGet) = 0.18.1 No fix listed
nuget sharpcompress(NuGet) = 0.18.2 No fix listed
nuget sharpcompress(NuGet) = 0.19.0 No fix listed
nuget sharpcompress(NuGet) = 0.19.1 No fix listed
nuget sharpcompress(NuGet) = 0.19.2 No fix listed
nuget sharpcompress(NuGet) = 0.2.0 No fix listed
nuget sharpcompress(NuGet) = 0.20.0 No fix listed
nuget sharpcompress(NuGet) = 0.21.0 No fix listed
nuget sharpcompress(NuGet) = 0.21.1 No fix listed
nuget sharpcompress(NuGet) = 0.22.0 No fix listed
nuget sharpcompress(NuGet) = 0.23.0 No fix listed
nuget sharpcompress(NuGet) = 0.24.0 No fix listed
nuget sharpcompress(NuGet) = 0.25.0 No fix listed
nuget sharpcompress(NuGet) = 0.25.1 No fix listed
nuget sharpcompress(NuGet) = 0.26.0 No fix listed
nuget sharpcompress(NuGet) = 0.27.0 No fix listed
nuget sharpcompress(NuGet) = 0.27.1 No fix listed
nuget sharpcompress(NuGet) = 0.28.0 No fix listed
nuget sharpcompress(NuGet) = 0.28.1 No fix listed
nuget sharpcompress(NuGet) = 0.28.2 No fix listed
nuget sharpcompress(NuGet) = 0.28.3 No fix listed
nuget sharpcompress(NuGet) = 0.3.0 No fix listed
nuget sharpcompress(NuGet) = 0.4.0 No fix listed
nuget sharpcompress(NuGet) = 0.5.0 No fix listed
nuget sharpcompress(NuGet) = 0.6.0 No fix listed
nuget sharpcompress(NuGet) = 0.7.0 No fix listed
nuget sharpcompress(NuGet) = 0.8.0 No fix listed
nuget sharpcompress(NuGet) = 0.8.1 No fix listed
nuget sharpcompress(NuGet) = 0.8.2 No fix listed
nuget sharpcompress(NuGet) = 0.9.0 No fix listed
sharpcompress project sharpcompress < 0.29.0 0.29.0
adamhathcock sharpcompress = < 0.29.0 No fix listed

References