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

オープン 初心者向け
#1,040 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

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

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
70/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp
領域
security

調査の方向性

level_zero/experimental/source/mutable_cmdlist/program/mcl_decoder.cpp の約329行目にある MclDecoder::parseSymbols から始めてください。ここでは elfSymbol.shndx が境界チェックなしで program.elfSh にインデックスしています。約199行目のセクションヘッダテーブルから program.elfSh がどのように構築されているかを読み、そのサイズを確認してください。範囲外の shndx が配列を超えて読み取ることなくシンボルをスキップまたは拒否するように参照が保護され、そのパスを通るテストまたは細工した入力があれば完了です。

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

説明

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.

主要言語
C++
スター
1.5k
フォーク
304
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

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

intel/compute-runtime のほかの issue

intel/compute-runtime の issue をすべて見る

似ている issue

C++ の issue をもっと見る

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

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