mcpotato HF staff commited on
Commit
3e749e1
1 Parent(s): d810d6f

feat: build dangerous pickle testing `.dat`

Browse files
Files changed (2) hide show
  1. build_pickles.py +14 -0
  2. danger.dat +0 -0
build_pickles.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import pickle
2
+
3
+
4
+ class MaliciousInject:
5
+ def __init__(self, src: str):
6
+ self._src = src
7
+ def __reduce__(self):
8
+ return eval, (f"exec('''{self._src}''')",), None, None, None
9
+
10
+
11
+ content = MaliciousInject("print('hack3d')")
12
+ with open('danger.dat', 'wb') as f:
13
+ pickle.dump(content, f)
14
+
danger.dat ADDED
Binary file (66 Bytes). View file