CVE-2021-39208
published medium CVSS 3.1 · 4.3WriteEntryToDirectory used for an archive extraction is vulnerable to partial path traversal.
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| adamhathcock | — | sharpcompress< 0.29.0 | Affected | Not stated | GitHub_M |
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.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 4.3 / 10
- Severity
- medium
- Provider
- GitHub_M · cna
- Vector string
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| adamhathcock | sharpcompress | < 0.29.0 (affected) | GitHub_M · cna |
Weaknesses
1- CWE-22 CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
References
3Provider assertions
2GitHub_M · cna
WriteEntryToDirectory used for an archive extraction is vulnerable to partial path traversal.
CVE · adp
CVE Program Container
Provenance
- Schema
- 5.1
- Searchable
- yes
- Content hash
- 1cd9a6163c4b1c27a4cedef761b10e3a08c27dade16e1c238e5d6406c21a72f1
- Ingested
- 23 Sep 2026, 07:55:36 UTC
- Source record
- Official CVE record