Downloads · 30 days
0
htdy7703/onnx-save-model-external-offset-disk-dos-poc
onnx-save-model-external-offset-disk-dos-poc is a machine learning model from htdy7703. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This PoC demonstrates a verified ONNX issue in the shipped onnx 1.22.0 wheel:
Downloads · 30 days
0
Access
Public
Updated Jul 8, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py2.1 KB · 39%
From the Hugging Face model README
This PoC demonstrates a verified ONNX issue in the shipped onnx 1.22.0 wheel:
onnx.save_model()raw_dataexternal_data.offset and zero-pads the sidecar file up to that offset before writing the payloadrepro.py: end-to-end reproducer that builds the malicious ONNX blob in memory and proves large sidecar creation through onnx.save_model(blob, model_path)README.md: impact summary and usage notesThe PoC builds a 73-byte malicious ModelProto whose initializer:
data_location=EXTERNALdirect.binexternal_data.offset to 67108864raw_data payloadIt then calls:
onnx.save_model(malicious_blob, model_path)
The expected result is that ONNX creates direct.bin, pads it to 67108864 bytes, writes the payload at that offset, and leaves a sidecar file of 67108865 bytes.
The crafted model is checker-invalid because ONNX requires externally stored tensors not to carry raw_data simultaneously. The issue matters because onnx.save_model() itself accepts raw bytes and does not run onnx.checker.check_model() internally.
python repro.py
Expected signal:
malicious blob bytes: 73checker accepted: Falsesidecar size: 67108865payload at attacker offset: True