YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
onnx-tensorrt parseExternalWeights out-of-bounds pointer (numeric offset, no bounds check)
Gated PoC bundle for a huntr Model File Vulnerability report against onnx/onnx-tensorrt
(the ONNX external-data weight parser used by NVIDIA TensorRT).
What is here
poc_offset_oob.onnx- malicious ONNX model. Its single initializerWis markeddata_location = EXTERNALwithexternal_data:location = weights.binoffset = 1073741824(1 GiB)length = 16
weights.bin- benign 16-byte sidecar. The mmap covers exactly these 16 bytes.make_model.py- script that generated the malicious.onnx(uses theonnxpython package).harness.cpp- faithful standalone ASan harness that reproduces the exact vulnerable logic ofWeightsContext.cpp(parse offset viastd::atoll, mmap coveringfileSize,weightsPtr = base + offsetwith no bounds check, thenconvertDouble()dereference). It parses the offset/length from the SAME.onnxprotobuf that onnx-tensorrt parses.asan_output.txt- captured AddressSanitizer crash output.
Reproduce
protoc --cpp_out=. onnx.proto
clang++ -std=c++17 -fsanitize=address -g -O0 onnx.pb.cc harness.cpp -o harness \
$(pkg-config --cflags --libs protobuf)
./harness poc_offset_oob.onnx
Observed: AddressSanitizer SEGV (READ) at the base + offset dereference.
Root cause
WeightsContext.cpp (branch main):
- line 275 / 279:
offset/lengthcome straight from attacker-controlledexternal_dataviastd::atoll(no range check). - line 202:
mmap(path)maps exactlyfileSizebytes. - line 212:
auto* weightsPtr = static_cast<char*>(memoryMap.first) + offset;- no check thatoffset >= 0,offset <= fileSize, oroffset + length <= fileSize. - line 309 (
convertOnnxWeights, DOUBLE path):convertDouble()dereferencesweightsPtr, readinglengthbytes from the out-of-bounds region.
The only path guard (../ traversal check, lines 166-179) is unrelated to numeric bounds.
This is a legitimate, authorized security-research artifact. Access is gated.
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support