WriteEntryToDirectory used for an archive extraction is vulnerable to partial path traversal.
Key facts
- Attack vector
- Network
- Privileges required
- Low
- User interaction
- None
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- None · Low · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub.
Summary
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.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| adamhathcock | sharpcompress | before 0.29.0 | 0.29.0 | Patch available | CNA |
| — | SharpCompress (NuGet) | before 0.29 | 0.29 | Patch available | GHSA-jp7f-grcv-6mjf |
- sharpcompress Vendoradamhathcock Affected before 0.29.0 Fixed in 0.29.0 Patch available CNA
- SharpCompress (NuGet) Vendor— Affected before 0.29 Fixed in 0.29 Patch available GHSA-jp7f-grcv-6mjf
CPE configurations NVD · 1
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:sharpcompress_project:sharpcompress:*:*:*:*:*:*:*:* | before 0.29.0 | Vulnerable | Sharpcompress Project |
- cpe:2.3:a:sharpcompress_project:sharpcompress:*:*:*:*:*:*:*:* Versions before 0.29.0 Vulnerable ·Sharpcompress Project
Remediation
- Fix · CNA sharpcompress (adamhathcock) Fixed in 0.29.0
- Fix · GHSA-jp7f-grcv-6mjf SharpCompress (NuGet) Fixed in 0.29 Advisory →
Timeline
- 2026-10-02 Threatist record created from CVE-2021-39208
- 2026-10-03 Alias added: GHSA-jp7f-grcv-6mjf
References
Advisory 2
More adamhathcock vulnerabilities
- TI-2026-32672 SharpCompress: Directory traversal via directory entries in WriteToDirectory (zip slip variant) CVSS 3.1MEDIUM 6.5
- TI-2018-16138 Path traversal in SharpCompress CVSS 3.0MEDIUM 5.5
Sources
- CVE-2021-39208 · CVE Program
- CVE-2021-39208 · NVD
- FIRST EPSS
- GHSA-jp7f-grcv-6mjf · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences