CWE External 73 Control of File Name or Path

Offen
#569 1 Kommentar 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
35/100
Issue-Typ
Bug
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
csharp
Bereich
security

Rechercherichtung

Beginne damit, die im Bericht gezeigte Implementierung von Create(string fileName) zu finden und die in der Issue verlinkten CWE-73-Richtlinien zu prüfen. Es ist weder eine Quelldatei noch ein Test angegeben; definiere daher die entsprechende Pfadbeschränkung und füge eine Abdeckung für den gemeldeten Fall hinzu. Als erledigt gilt die Aufgabe, wenn die Schwachstelle behoben ist und der Veracode-Befund nicht mehr gemeldet wird.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

Steps to reproduce

A recent Veracode scan on our application using the icsharpcode.sharpzilelib.dll has revealed a vulnerability flaw
Vulnerability CWE 73 External Control of File Name or Path.
While the version of the file in use is old and we intend to get the latest version. Can you advise if this can be addressed?
It is also reported the flaw exploitability status is set to 'Neutral'

public static ZipFile Create(string fileName)
{
    if (fileName == null)
    {
        throw new ArgumentNullException(nameof(fileName));
    }

    FileStream fs = File.Create(fileName);

    return new ZipFile
    {
        name_ = fileName,
        baseStream_ = fs,
        isStreamOwner = true
    };
}
Expected behavior

Restrict access from the restricted location of the file system

Actual behavior

Vulnerability CWE 73 reported in Veracode scan

This could allow an attacker to access or modify system files or other files that are critical to the application.
An attacker can specify a path used in an operation on the filesystem.
By specifying the resource, the attacker gains a capability that would not otherwise be permitted.

Please see https://www.veracode.com/security/dotnet/cwe-73

Version of SharpZipLib

0.855.5.452

Obtained from (only keep the relevant lines)
  • Compiled from source, commit: source_
  • Downloaded from GitHub - Yes
  • Package installed using NuGet - Yes
Vorherrschende Sprache
C#
Sterne
3.9k
Forks
1k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus icsharpcode/SharpZipLib

Alle Issues in icsharpcode/SharpZipLib

Ähnliche Issues

Weitere Issues zu C#

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.