Downloads · 30 days
0
jeikei97/safetensors-zip-polyglot-payload-smuggling
safetensors-zip-polyglot-payload-smuggling is a machine learning model from jeikei97. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
This repository contains a proof of concept for hidden payload smuggling inside a valid .safetensors file.
Downloads · 30 days
0
Access
Public
Updated Jul 16, 2026
Repo size
338 B
Likes
0
Public
Click a slice to open those files.
.py4.2 KB · 45%
From the Hugging Face model README
This repository contains a proof of concept for hidden payload smuggling inside a valid .safetensors file.
A single file can be both:
.safetensors file accepted by official safetensors loaders, andThis breaks a common security expectation around .safetensors as a non-polyglot carrier.
The included artifact embeds an actual malicious .joblib payload inside the ZIP portion. The outer file still parses as a normal safetensors file, while archive-aware tooling can later extract the hidden second-stage payload and trigger it.
The main PoC file is:
artifacts/carrier.safetensorsThe embedded payload is harmless. When the hidden .joblib is extracted and loaded, it creates a local marker file:
INNER_JOBLIB_MARKER.txtartifacts/carrier.safetensorsartifacts/reproduce_output.txtartifacts/sha256sums.txtreproduce.pysafetensors: 0.8.0huggingface_hub: used to verify official local safetensors metadata parsingRun:
python reproduce.py
Expected results:
safe_open(...) accepts the file as a normal safetensors artifactzipfile.is_zipfile(...) returns Truepayload/embedded.joblibhuggingface_hub is installed, its local safetensors parser also returns ordinary metadata.joblib creates the marker fileRun:
python reproduce.py --build
This regenerates artifacts/carrier.safetensors and reruns the verification steps.
From artifacts/reproduce_output.txt:
safe_open_keys: ['archive']safe_open_metadata: {'format': 'np'}zipfile.is_zipfile: Truezip_names: ['payload/embedded.joblib']file_1_output: Zip archive, with extra data prependedhf_metadata: {'format': 'np'}hf_tensor_names: ['archive']marker_exists_after_joblib_load: TrueThis is a practical payload smuggling primitive for a supported high-value format:
safetensors itself..safetensors file can act as a concealed transport carrier for a second malicious artifact.