CWE External 73 Control of File Name or Path

オープン
#569 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
csharp
領域
security

調査の方向性

まず、レポートに示されている Create(string fileName) の実装を見つけ、issue にリンクされている CWE 73 のガイダンスを確認してください。ソースファイルもテストも指定されていないため、適用するパス制限を定義し、報告されたケースのカバレッジを追加してください。脆弱性が解消され、Veracode で finding が報告されなくなれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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
主要言語
C#
スター
3.9k
フォーク
1k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

icsharpcode/SharpZipLib のほかの issue

icsharpcode/SharpZipLib の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。