GHSA-jp7f-grcv-6mjf

    Dashboard / Vulnerabilities / GHSA-jp7f-grcv-6mjf

    GHSA-jp7f-grcv-6mjf

    Published: 20 Sept 2021Last Modified: 8 Jul 2026

    Summary: Partial path traversal in sharpcompress

    Details: 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 it is not enforced that fullDestinationDirectoryPath ends with slash: ```csharp public static void WriteEntryToDirectory(IEntry entry, string destinationDirectory, ExtractionOptions? options, Action<string, ExtractionOptions?> write) { string destinationFileName; string file = Path.GetFileName(entry.Key); string fullDestinationDirectoryPath = Path.GetFullPath(destinationDirectory); ... throw new ExtractionException("Entry is trying to write a file outside of the destination directory."); } ``` 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. #### Impact Because of the file name and destination directory constraints the arbitrary file creation impact is limited and depends on the use case.

    Affected packages

    Package

    Name: SharpCompress

    Purl: pkg:nuget/SharpCompress

    Affected ranges

    Type: ECOSYSTEM

    Events:

    Introduced- 0
    Fixed -0.29

    Affected versions

    0.10.0
    0.10.1
    0.10.1.1
    0.10.1.3
    0.10.2
    0.10.3

    Common Vulnerability Scoring System

    Attack Vector
    Network
    Adjacent
    Local
    Physical
    Privileges Required
    None
    Low
    High
    User Interaction
    None
    Required
    Scope
    Unchanged
    Changed
    Confidentiality
    None
    Low
    High
    Integrity
    None
    Low
    High
    Availability
    None
    Low
    High
    GHSA-jp7f-grcv-6mjf | CVE-DB