dkteg
commited on
Commit
·
e34f991
1
Parent(s):
4ebeb41
another test
Browse files- testfolder/__pycache__/another_torch.cpython-311.pyc +0 -0
- testfolder/__pycache__/test_module.cpython-311.pyc +0 -0
- testfolder/__pycache__/torch.cpython-311.pyc +0 -0
- testfolder/another_torch.py +11 -0
- testfolder/torch.py +21 -0
- testfolder/vuln.pkl +3 -0
- testfolder/vuln2.pkl +3 -0
- testfolder/vuln_pickle.py +30 -0
testfolder/__pycache__/another_torch.cpython-311.pyc
ADDED
|
Binary file (531 Bytes). View file
|
|
|
testfolder/__pycache__/test_module.cpython-311.pyc
ADDED
|
Binary file (518 Bytes). View file
|
|
|
testfolder/__pycache__/torch.cpython-311.pyc
ADDED
|
Binary file (1.26 kB). View file
|
|
|
testfolder/another_torch.py
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
def run_bash():
|
| 4 |
+
res = os.system("ls -la")
|
| 5 |
+
print(res)
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
run_bash()
|
| 10 |
+
|
| 11 |
+
|
testfolder/torch.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
|
| 3 |
+
def run_bash():
|
| 4 |
+
res = os.system("ls -la")
|
| 5 |
+
print(res)
|
| 6 |
+
|
| 7 |
+
|
| 8 |
+
if __name__ == '__main__':
|
| 9 |
+
run_bash()
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
if __name__ == '__main__':
|
| 13 |
+
import pickle
|
| 14 |
+
|
| 15 |
+
class Vuln():
|
| 16 |
+
def __reduce__(self):
|
| 17 |
+
# return (os.system, ("echo 'I should have been stopped by the hook'",))
|
| 18 |
+
return (run_bash, ())
|
| 19 |
+
|
| 20 |
+
with open("vuln.pkl", "wb") as f:
|
| 21 |
+
pickle.dump(Vuln(), f)
|
testfolder/vuln.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c6c61e35d74c8cbf6bd0d79e2603f417c89ded798c6ac6c18ade7835f8e0dd05
|
| 3 |
+
size 44
|
testfolder/vuln2.pkl
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:8241f3b433c6e6bc9b3367f1526282ae1a7145f644970d4cc4f62439cafabc15
|
| 3 |
+
size 36
|
testfolder/vuln_pickle.py
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import pickle
|
| 2 |
+
import pickletools
|
| 3 |
+
import another_torch
|
| 4 |
+
import torch
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
class Vuln():
|
| 8 |
+
def __reduce__(self):
|
| 9 |
+
return (another_torch.run_bash, ())
|
| 10 |
+
|
| 11 |
+
class Vuln2():
|
| 12 |
+
def __reduce__(self):
|
| 13 |
+
return (torch.run_bash, ())
|
| 14 |
+
|
| 15 |
+
|
| 16 |
+
def run():
|
| 17 |
+
with open("vuln.pkl", 'wb') as f:
|
| 18 |
+
pickle.dump(Vuln(), f)
|
| 19 |
+
|
| 20 |
+
with open("vuln2.pkl", 'wb') as f:
|
| 21 |
+
pickle.dump(Vuln2(), f)
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
if __name__ == '__main__':
|
| 25 |
+
run()
|
| 26 |
+
with open("vuln.pkl", "rb") as f:
|
| 27 |
+
pickle.load(f)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
|