YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
PyTorch mmap weights_only security PoC
Overview
This repository contains a malformed PyTorch ZIP checkpoint demonstrating that the same archive is:
- rejected by
torch.load(..., weights_only=True, mmap=False) - accepted by
torch.load(..., weights_only=True, mmap=True)
File
offset_patched.pt: malformed checkpoint proof of concept
Tested environment
- Python 3.12
- PyTorch 2.12.1+cpu
Reproduction
import torch
torch.load("offset_patched.pt", weights_only=True, mmap=False)
# expected: RuntimeError due to record size mismatch
obj = torch.load("offset_patched.pt", weights_only=True, mmap=True)
print(obj["base"].tolist())
print(obj["view"].tolist())
print(obj["base"].untyped_storage().nbytes())
Expected result
mmap=Falserejects the malformed checkpointmmap=Trueaccepts it- loaded tensors contain attacker-controlled / malformed values
- loaded storage size reflects forged metadata rather than the legitimate record payload size
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support