Downloads · 30 days
0
pragnyanramtha/onnxruntime-bytes-external-data-lfr-poc
onnxruntime-bytes-external-data-lfr-poc is a machine learning model from pragnyanramtha. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This is a benign security PoC for ONNX Runtime external-data handling. It does not execute code, make network connections, persist changes, or access credentials. The local file read is demonstrated with a temporary m…
Downloads · 30 days
0
Access
Public
Updated May 12, 2026
Repo size
306 B
Likes
0
Public
Click a slice to open those files.
.py10.1 KB · 39%
From the Hugging Face model README
This is a benign security PoC for ONNX Runtime external-data handling. It does not execute code, make network connections, persist changes, or access credentials. The local file read is demonstrated with a temporary marker file created by the verifier.
bytes_lfr/cwd_external_data_reader.onnx contains an initializer with:
data_location = EXTERNAL
external_data.location = service_secret.txt
external_data.length = 28
When the same model is loaded from a filesystem path, ONNX Runtime resolves service_secret.txt relative to the model file directory. When the model is loaded from raw bytes with onnxruntime.InferenceSession(model_bytes), ONNX Runtime resolves service_secret.txt relative to the process current working directory. The PoC creates a benign service_secret.txt in a temporary CWD and shows that the model outputs its contents.
This is not a toy output override. The model artifact causes ONNX Runtime to read ambient local filesystem data during normal session creation from bytes. Many model-serving APIs accept uploads as bytes or read a model blob into memory before passing it to ONNX Runtime.
bytes_lfr/cwd_external_data_reader.onnx - ONNX model that references service_secret.txt as external tensor data.bytes_lfr/manifest.json - artifact hash, size, expected marker, and external-data location.make_bytes_lfr_poc.py - generator for the ONNX artifact.verify_bytes_lfr_poc.py - creates a temporary CWD marker file and validates path-load vs byte-load behavior.bytes_lfr_results.json - captured local validation output.research/probe_save_external_data_paths.py - save-side path traversal probe used during research.research/save_path_probe_results.json - save-side path probe results for ONNX 1.21.0.python -m venv .venv
.\.venv\Scripts\python -m pip install -r .\requirements.txt
.\.venv\Scripts\python .\verify_bytes_lfr_poc.py
Expected key result:
ort_bytes_load_from_service_cwd.status loaded
ort_bytes_load_from_service_cwd.output_ascii BENIGN_SERVICE_SECRET_MARKER
ort_bytes_load_without_secret.status blocked
The verifier also confirms that path-loaded ONNX Runtime sessions read the companion file from the model directory instead of the process CWD.
cwd_external_data_reader.onnx 27ba84c9f7343c4c6efea4cbb7c5ac32900d4ba622ed3f25a5ea79d42cfa7293
ModelScan 0.8.8 reports total_issues: 0 and scanned.total_scanned: 0 for the .onnx model in this environment.
If a service accepts an untrusted ONNX model as bytes and calls onnxruntime.InferenceSession(model_bytes), the model can reference and read a file from the service process CWD as external tensor data. The file bytes are then available as normal model output. In real deployments, common CWD files can include .env, config files, local tokens, temporary request data, or adjacent application state.