Skip to content

Avoid Path.GetTempFileName() due to CWE 377 in TarArchive.cs. #543

Closed

Description

@tdhintz

Steps to reproduce

  1. Static code security scan line 827 TarArchive.cs. Example:
    if (asciiTranslate && !entry.IsDirectory)
    {
    if (!IsBinary(entryFilename))
    {
    tempFileName = Path.GetTempFileName();
    using (StreamReader inStream = File.OpenText(entryFilename))
    {
    using (Stream outStream = File.Create(tempFileName))

Expected behavior

Use sufficiently random names for temporary files to prevent attacks which can predict the name of the file. For example, a Guid or crypto generated random number.

Actual behavior

Security scan failure. #537

Version of SharpZipLib

1.3.1

Obtained from (only keep the relevant lines)

  • Package installed using NuGet

Activity

  1. piksel commented on Nov 26, 2020

    @piksel
    Member

    Yeah, not sure how I didn't catch that.

  2. added
    tar
    on Nov 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    securitytar

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions