CVE-2021-39208
C# vulnerability analysis and mitigation

Overview

SharpCompress, a fully managed C# library for handling various compression types and formats, was found to be vulnerable to partial path traversal in versions prior to 0.29.0. The vulnerability, identified as CVE-2021-39208, was discovered and reported by GHSL team member @JarLob (Jaroslav Lobačevski) on September 3, 2021, and was patched with the release of version 0.29.0 on September 12, 2021 (GitHub Release, GitHub Advisory).

Technical details

The vulnerability exists in the WriteEntryToDirectory function used for archive extraction. When ExtractFullPath is set to true, SharpCompress recreates a directory hierarchy under the destinationDirectory. While the code verifies that the destinationFileName path begins with fullDestinationDirectoryPath to prevent extraction outside the destination directory, it fails to enforce that fullDestinationDirectoryPath ends with a slash. This oversight allows for partial path traversal (GitHub Advisory).

Impact

The vulnerability allows for arbitrary file creation with limited impact due to file name and destination directory constraints. For example, if the destinationDirectory is not slash-terminated (like /home/user/dir), it becomes possible to create a file with a name that begins with the destination directory one level up from the directory (i.e., /home/user/dir.sh) (GitHub Advisory).

Mitigation and workarounds

The vulnerability was patched in SharpCompress version 0.29.0. Users should upgrade to this version or later to address the security issue. The fix ensures proper handling of destination directory paths and includes additional security checks (GitHub Release).

Additional resources


SourceThis report was generated using AI

Related C# vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

CVE-2025-68924CRITICAL9.9
  • C#C#
  • UmbracoForms
NoNoJan 13, 2026
CVE-2025-68618HIGH7.5
  • C#C#
  • ImageMagick-devel-32bit
NoYesDec 30, 2025
CVE-2025-68950MEDIUM6.2
  • C#C#
  • Magick.NET-Q8-AnyCPU
NoYesDec 30, 2025
CVE-2025-67291MEDIUM6.1
  • C#C#
  • Piranha
NoNoDec 22, 2025
CVE-2025-67290MEDIUM6.1
  • C#C#
  • Piranha
NoNoDec 22, 2025

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management