YAML parser: unchecked node indices in buildTree cause OOB access

Aperta
#1,043 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
cpp
Ambito
security

Direzione di ricerca

Start with NEO::Yaml::buildTree in shared/source/device_binary_format/yaml/yaml_parser.cpp (around line 360) and the YamlParser class in yaml_parser.h, tracing where invalidNodeID is compared against the NodesCache indices. Then check how level_zero/core/source/module/modules_package_binary.cpp passes untrusted YAML into the parser. Done means that every node index is bounds-checked before use and a crafted-input test no longer crashes; the report's three claims should be reproduced before fixing.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Problem

NEO::Yaml::buildTree (shared/source/device_binary_format/yaml/yaml_parser.cpp, line 360) and the YamlParser class (yaml_parser.h) use NodeId indices to navigate a NodesCache (vector of Node). Multiple paths use invalidNodeID (std::numeric_limits<NodeId>::max()) as a sentinel, but the value is also used as an array index before being checked.

Three bugs from the same root cause:

1. DEADLYSIGNAL (crash) at yaml_parser.h:502

buildTree is called with crafted token data. A node index that should be invalidNodeID is instead used to access nodes[], reading past the vector bounds. Process crashes with SIGSEGV.

2. Container out-of-bounds

A crafted input produces a nodeOrdinal or childId that exceeds outNodes.size(). The nodes[childId] access at lines like 504 reads past the vector.

3. Stack buffer overflow at yaml_parser.h:502

Token scanning does not check for NUL termination in all paths. A crafted input causes buildTree to write past a stack-allocated buffer during token processing.

All three are triggered through ModulesPackageBinary::decode (level_zero/core/source/module/modules_package_binary.cpp) which feeds untrusted module binary data into the YAML parser.

Impact

Crash (denial of service). Reachable through zeModuleCreate (Level Zero) when the module binary contains a YAML manifest section. A crafted program binary triggers OOB access in the YAML parser during module loading.

Suggested fix

  1. Validate all NodeId values against outNodes.size() before using them as indices.
  2. Add NUL-termination checks in token scanning paths.
  3. Validate buildTree output node count against input token count as a sanity bound.

Found by BrightSec automated security scanning.

Lingua principale
C++
Stelle
1.5k
Fork
306
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di intel/compute-runtime

Tutte le issue di intel/compute-runtime

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.