CVE-2021-39208
MEDIUM 4.3CVSS 3.1Partial path traversal in sharpcompress
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.
- Published
- 16 Sep 2021
- Last modified
- 8 Jul 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Modified
- Weakness
- CWE-22
- Also known as
- GHSA-jp7f-grcv-6mjf
- Sources
- NVDJSONOSV GHSA-jp7f-grcv-6mjfJSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| OSV | GitHub | CVSS 4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N | |
| NVD | security-advisories@github.com (Secondary) | CVSS 3.1 | MEDIUM 4.3 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N |
| OSV | GitHub | CVSS 3.1 | MEDIUM 4.3 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N |
| NVD | nvd@nist.gov (Primary) | CVSS 2.0 | MEDIUM 4.0 | AV:N/AC:L/Au:S/C:N/I:P/A:N |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| NVD | sharpcompress_project | sharpcompresscpe:2.3:a:sharpcompress_project:sharpcompress:*:*:*:*:*:*:*:* |
< 0.29.0 | 0.29.0 |
| OSV | NuGet | SharpCompress | < 0.29 | 0.29 |
References
- https://github.com/adamhathcock/sharpcompress/pull/614 · Patch, Third Party Advisory, WEB
- https://github.com/adamhathcock/sharpcompress/releases/tag/0.29.0 · Release Notes, Third Party Advisory, WEB
- https://github.com/adamhathcock/sharpcompress/security/advisories/GHSA-jp7f-grcv-6mjf · Exploit, Third Party Advisory, WEB
- https://nvd.nist.gov/vuln/detail/CVE-2021-39208 · ADVISORY
- https://github.com/adamhathcock/sharpcompress/commit/ea5c8dc06314c7a5068e7901c51a625224d2b288 · WEB
- https://github.com/adamhathcock/sharpcompress · PACKAGE
History
- 25 Nov 2026 20:33 UTC · NVD: first stored (published 16 Sep 2021)
- 25 Nov 2026 20:13 UTC · OSV: first stored (published 20 Sep 2021)