MclDecoder::parseSymbols: unchecked shndx used as index into elfSh array

Đang mở Phù hợp với người mới
#1,040 0 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ó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
70/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
cpp
Lĩnh vực
security

Hướng nghiên cứu

Bắt đầu tại MclDecoder::parseSymbols trong level_zero/experimental/source/mutable_cmdlist/program/mcl_decoder.cpp, khoảng dòng 329, nơi elfSymbol.shndx được dùng làm chỉ số cho program.elfSh mà không kiểm tra giới hạn. Đọc chỗ program.elfSh được xây dựng từ bảng section header gần dòng 199 để xác nhận kích thước của nó. Hoàn thành khi việc truy cập được bảo vệ sao cho shndx ngoài phạm vi sẽ bỏ qua hoặc từ chối symbol mà không đọc vượt quá mảng, kèm theo một test hoặc đầu vào được tạo sẵn để chạy qua nhánh đó.

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

Mô tả

Problem

MclDecoder::parseSymbols (level_zero/experimental/source/mutable_cmdlist/program/mcl_decoder.cpp, line 329) uses elfSymbol.shndx as an index into program.elfSh without bounds checking:

symbol.section = static_cast<Sections::SectionType>(program.elfSh[elfSymbol.shndx].type);

program.elfSh is an ArrayRef constructed from the ELF section header table (line 199). shndx is a 16-bit field from the ELF symbol table, fully attacker-controlled in a crafted binary. If shndx >= program.elfSh.size(), this is an out-of-bounds read at an attacker-chosen index.

UBSan fires on the pointer arithmetic computing the OOB address.

Impact

Out-of-bounds read in the MCL (Mutable Command List) program decoder. Reachable through zexCommandListLoadNativeBinary (Level Zero experimental API). Crash or potential information disclosure from reading memory at an attacker-controlled offset from the section header array.

Suggested fix

Check elfSymbol.shndx < program.elfSh.size() before the array access. Skip or error on the symbol if out of bounds.

Found by BrightSec automated security scanning.

Ngôn ngữ chính
C++
Star
1.5k
Fork
306
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 intel/compute-runtime

Tất cả issue của intel/compute-runtime

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.