CWE External 73 Control of File Name or Path

Đang mở
#569 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
35/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
csharp
Lĩnh vực
security

Hướng nghiên cứu

Bắt đầu bằng cách xác định implementation của Create(string fileName) được nêu trong report và xem lại hướng dẫn CWE 73 được liên kết trong issue. Không có source file hoặc test nào được nêu; vì vậy, hãy xác định restriction về path áp dụng và bổ sung coverage cho trường hợp được báo cáo; công việc được xem là hoàn tất khi lỗ hổng được xử lý và finding của Veracode không còn được báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
Ngôn ngữ chính
C#
Star
3.9k
Fork
1k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của icsharpcode/SharpZipLib

Tất cả issue của icsharpcode/SharpZipLib

Issue tương tự

Thêm issue về C#

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.