A practical guide for DOS & DDOS attack & ways to prevent your site
Full explanation of DOS & DDOS attacks on websites & how to prevent for these attacks
Introduction
A (DOS) Denial of Service or (DDoS) Distributed Denial of Service attack is a non-intrusive internet attack made to take down the targeted website or slow it down by flooding the network, server, or application with fake traffic.
You may feel overwhelmed. let me help you understand what a DDoS attack is and how to prevent it, we have written the following article.
Understanding a DDOS attack
Unlike Denial of Service (DoS) attacks which come from a single source, DDoS attacks involve connected devices from multiple locations. For a DDoS attack to be successful, the attacker needs to send more requests than the victim server can handle. Another way successful attacks occur is when the attacker sends bogus (Fake-request) requests.
How does it work?
The attacker can send a bogus request to one of your website endpoints or else some endpoint that needs more resources in your web server. The DDoS attack will test the limits of a web server, network, and application resources by sending spikes of fake traffic. When a DDoS attack is launched, your site will get flooded with a large number of requests suddenly which may lead to an increase a load to the webserver & makes it unavailable to legitimate (valuable user). A successful DDoS attack can prevent users from accessing a website or slow it down enough to increase the bounce rate, resulting in financial losses and performance issues.
Outcome DDOS of attack
The main goal of an attacker that is leveraging a Denial of Service (DoS) attack method is to disrupt a website's availability
The website can become slow to respond to legitimate requests.
The website can be disabled entirely.
The user has problems accessing the website.
The website is unresponsive & may not be reached.
Difference between DOS & DDOS
Denial of Service (DoS) attacks and Distributed Denial of Service (DDoS) attacks are very similar. The only difference between them is their scale. Single DoS attacks come from one source, while DDoS (distributed) attacks come from multiple locations, often spoofed.
Guide to performing DOS attack
Disclaimer :
This article does not promote any illegal activities & These guides should be used only for testing and educational purposes.
Introduction
In this section, we are going to install a simple dos-attack tool that is written to test web servers for this kind of attack. we should not perform on any other sites to test it without the site owner's permission.
pre-requisites:
Node (latest version)
Minimum any dual-core CPU
After installing the node. we need to install a simple node package called s-dos.
Steps to installing & perform an attack
Open Terminal (with administrator permission)
Then run
npm i -g s-dos
(it installs the tool globally on your pc)Then
s-ddos --host="
http://localhost:8000
" --amount=100 --interval=1500
This above command will start sending 100 requests every 1.5s to the http://localhost:8000
.you can replace the URL with the website you want to test.
It floods a request to the web server and makes it unavailable for a user. if your test it with more amount of requests then users may see this screen on the browser.
Prevention
We have talked extensively about DDoS attacks. There are several ways to protect from choosing wisely one of the solutions which suit your web application.
WAF (Web application firewall)
Rate limiting
Country IP blocking
Monitoring web traffic
Setting up cache
Increase bandwidth
These implementations can be done by professionals according to the need & their own infrastructure & some web application frameworks like Laravel comes with rate-limiting inbuild for some more web attacks.
Conclusion
Hopefully, this will be useful to some of you :).
I'd love to hear what you're comments & more examples let me know in the comments below! Follow for more content like this & share it with your friends