You need to agree to share your contact information to access this model

This repository is publicly accessible, but you have to accept the conditions to access its files and content.

Log in or Sign Up to review the conditions and access this model content.

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=False rejects the malformed checkpoint
  • mmap=True accepts it
  • loaded tensors contain attacker-controlled / malformed values
  • loaded storage size reflects forged metadata rather than the legitimate record payload size
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support