LiveActive security incident?Get immediate response
CVE Record

CVE-2021-39208: WriteEntryToDirectory used for an archive extraction is vulnerable to partial path traversal.

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.

MediumCVSS 4.3Not KEV-listedUpdated
Glexia's TakeAutomated analysismoderate

Security readout for executives and security teams

Plain-English summary

SharpCompress before 0.29.0 can write an extracted archive file just outside the intended directory in some configurations. The impact is limited arbitrary file creation, not full system takeover. Risk is highest where applications extract user-supplied archives using full path extraction.

Executive priority

Treat as a moderate-priority dependency remediation. It is not presented as actively exploited, but archive extraction bugs can become business-relevant when exposed to customer uploads or automated ingestion pipelines.

Technical view

The flaw is a CWE-22 partial path traversal in archive extraction. When ExtractFullPath is true, the prefix check did not require a trailing slash on the destination path, allowing similarly prefixed sibling paths. CVSS is 4.3 with low integrity impact and low privileges required.

Likely exposure

Exposure is limited to applications using SharpCompress versions before 0.29.0, especially code paths that extract archives with ExtractFullPath enabled. Systems not using SharpCompress, not extracting archives, or already on 0.29.0 or later are not indicated as affected by the bundle.

Exploitation context

The source bundle does not show CISA KEV listing or active exploitation evidence. Exploitation depends on an attacker being able to influence archive contents and trigger extraction in an affected application. The advisory describes limited arbitrary file creation constrained by destination and filename conditions.

Researcher notes

Focus review on SharpCompress extraction call sites, destination path normalization, and whether sibling-path writes could affect meaningful application files. The public bundle names the fix version but gives no broader affected product list beyond SharpCompress.

Mitigation direction

  • Upgrade SharpCompress to version 0.29.0 or later.
  • Review vendor advisory and release notes for application-specific guidance.
  • Disable full path extraction where it is not required.
  • Restrict archive extraction to trusted inputs when possible.
  • Add extraction path containment checks around affected workflows.

Validation and detection

  • Inventory .NET projects and lockfiles for SharpCompress versions before 0.29.0.
  • Identify archive extraction paths that enable ExtractFullPath or WriteEntryToDirectory.
  • Confirm whether untrusted or low-privileged users can submit archives.
  • Verify upgraded builds resolve SharpCompress to 0.29.0 or later.
  • Use safe internal tests to confirm extracted files stay inside the destination directory.
Prepared
Confidence
high
Sources
5

Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.

Potential ATT&CK relevance

Conservative CVE-to-ATT&CK context

These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.

ATT&CK lookup starting points

Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.

cwe · medium confidence lookup

CWE-22: File access and web shell behavior lookup

File traversal and upload weaknesses can lead teams to review file, web shell, execution, and collection telemetry. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.

Open ATT&CK lookup
description · low confidence lookup

File access behavior lookup

The CVE wording references file access or upload behavior, so file telemetry and web shell review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.

Open ATT&CK lookup
cve · low confidence lookup

CVE-2021-39208 mapping review

Open the CVE-to-ATT&CK bridge for reviewed, inferred, or future official mappings tied to this CVE.

Open ATT&CK lookup
Vulnerability profileCVE Program record
Severity
Medium
CVSS
4.3 (3.1)
Known Exploited
No
Published

Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N

Official CVE source material

CNA and ADP enrichment extracted from CVE v5

These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.

1CVSS vectors
0Timeline events
0ADP providers
4Source links

CVSS vector scores

1 official score

We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.

ScoreVersionSeverityVectorExploitImpactSource
4.3CVSS 3.1MediumCVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N2.81.4Primary CVE score

Vulnerability scoring details

Base CVSS 3.1 score

4.3Medium
CVSS 3.1 vector shape for CVE-2021-39208Attack VectorAttack ComplexityPrivileges RequiredUser InteractionScopeConfidentiality ImpactIntegrity ImpactAvailability Impact

Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:N/I:L/A:N

Attack Vector
NetworkAdjacentLocalPhysical
Attack Complexity
LowHigh
Privileges Required
NoneLowHigh
User Interaction
NoneRequired
Scope
ChangedUnchanged
Confidentiality Impact
HighLowNone
Integrity Impact
HighLowNone
Availability Impact
HighLowNone
Affected products

Products and packages named in the record

VendorProductVersion / packageStatus
adamhathcocksharpcompress< 0.29.0Listed
Weakness

CWE details

CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.