Downloads · 30 days
0
tonydav41/tensorizer-poc-truncated-body-uninit-disclosure-2026-05-12
tensorizer-poc-truncated-body-uninit-disclosure-2026-05-12 is a machine learning model from tonydav41. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
PoC for huntr submission against Tensorizer (.tensors) – CoreWeave.
Downloads · 30 days
0
Access
Public
Updated May 12, 2026
Repo size
590 KB
Likes
0
Public
Click a slice to open those files.
.tensors590 KB · 63%
From the Hugging Face model README
.tensors Truncated-Body Uninitialized-Buffer Disclosure PoCPoC for huntr submission against Tensorizer (.tensors) – CoreWeave.
tensorizer.TensorDeserializer trusts the per-tensor data_length field from the file header and allocates a CPU buffer with torch.empty(...), then calls file_.readinto(mv) without checking the return value. If the .tensors file is truncated exactly at the claimed tensor body offset, readinto() returns 0 bytes at EOF, but the loader still wraps the uninitialized torch.empty buffer as a successfully-loaded tensor. The returned tensor contains stale process memory.
coreweave/tensorizer 2.12.1 @ commit 652d3c016c84836bba97153e108821c11428ac40 (main, 2026-04-21)All in tensorizer/serialization.py:
verify_hash defaults to Falsetorch.empty(...) (uninitialized)file_.readinto(mv) return value ignoredcd /tmp/tensorizer-audit
git clone https://github.com/coreweave/tensorizer.git tensorizer
git -C tensorizer checkout 652d3c016c84836bba97153e108821c11428ac40
python3 -m venv venv
./venv/bin/pip install --no-build-isolation --no-deps ./tensorizer
./venv/bin/python tensorizer-audit-harness.py
cat /tmp/TENSORIZER_AUDIT.txt
Verified result (from tensorizer_mff_results.json):
case: truncated_tensor_data
file: truncated_tensor_data.tensors (262,294 bytes)
data_length: 65536
readinto_calls: [(69, 69, 262294), (65536, 0, 262294)]
tensor_shape: (65536,)
contains_sentinel: true
sample: TENSORIZER_AUDIT_SENTINEL:2a38b647fc24447f53b7a3934c607bfc6677dcfed48493feb818e0dc9481c096
The second readinto requested 65,536 tensor bytes, received 0 bytes at EOF, but the loader still returned a (65536,) tensor whose bytes match the prior freed torch.uint8 allocation.
truncated_tensor_data.tensors — malicious file (262 KB; valid metadata + per-tensor header truncated before tensor body)baseline-good.tensors — control valid filetensorizer_mff_results.json — full corpus test results (12 cases)tensorizer-audit-harness.py — reproducer harness with sentinel-injection logicREADME.md — this fileNot a Pickle issue. Uses only the custom Tensorizer binary format. The verify_hash=True parameter (off by default) prevents the bug; the default constructor path is vulnerable. No prior CVE or huntr disclosure for this code path.
Check the return value of readinto() and raise on short reads:
nread = file_.readinto(mv)
if nread is not None and nread != len(mv):
raise IOError(
f"Short read on tensor body: expected {len(mv)}, got {nread}"
)
Defense in depth: zero the buffer before readinto(), or use torch.zeros(...) instead of torch.empty(...).
Reported by lendtrain (huntr) / tonydav41 (HuggingFace). Filed 2026-05-12.