CVE-2021-39208 Details
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.
Metrics
CVSS 4.0 Severity and Vector Strings:
No CVSS 4.0 data is available for this CVE.
CVSS 3.x Severity and Vector Strings:
No data available for CVSS Version 2.0 on this CVE.
No SSVC data is available for this CVE.
References to Advisories, Solutions, and Tools
By selecting these links, you will be leaving this site. These are references gathered from the official CVE record and are not endorsed by Volerion.
| URL | Source(s) | Tag(s) |
|---|---|---|
| https://github.com/adamhathcock/sharpcompress/pull/614 | CVE | PatchThird Party Advisory |
| https://github.com/adamhathcock/sharpcompress/releases/tag/0.29.0 | CVE | Release NotesThird Party Advisory |
| https://github.com/adamhathcock/sharpcompress/security/advisories/GHSA-jp7f-grcv-6mjf | CVE | ExploitThird Party Advisory |
| https://github.com/adamhathcock/sharpcompress/pull/614 | [email protected] | PatchThird Party Advisory |
| https://github.com/adamhathcock/sharpcompress/releases/tag/0.29.0 | [email protected] | Release NotesThird Party Advisory |
| https://github.com/adamhathcock/sharpcompress/security/advisories/GHSA-jp7f-grcv-6mjf | [email protected] | ExploitThird Party Advisory |
Weakness Enumeration
| CWE-ID | CWE Name | Source |
|---|---|---|
| CWE-22 | Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') | [email protected] |
Affected Products
| Product | Versions |
|---|---|
| sharpcompress project sharpcompress | < 0.29.0 |
CPE
Remediation
| |
Change History
4 change records found show changes
| Date | Action | Recorded By |
|---|---|---|
| Jun 17, 2026 | CVE Modified | [email protected] |
| Nov 21, 2024 | CVE Modified | CVE |
| May 14, 2024 | CVE Modified | [email protected] |
| Sep 28, 2021 | Initial Analysis | [email protected] |