Files
ai-sec-labs/lab2/load_model.py
2026-07-29 16:50:22 +03:00

12 lines
450 B
Python

#!/usr/bin/env python3
import torch
print("Attempting to load standard checkpoint (unrestricted)...")
try:
# In older versions of PyTorch, weights_only defaulted to False.
# This will trigger the __reduce__ exploit instantly upon reading.
loaded_data = torch.load("compromised_model.pt", weights_only=False)
print("Model loaded successfully (but the exploit already ran!).")
except Exception as e:
print(f"Error occurred: {e}")