Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

DDOS attack: defending with Thread.Sleep()?

Tags:

asp.net

ddos

If I introduce a Thread.Sleep(x) delay while rendering my HTTP response, where x would change depending on the rate of requests from a given IP: from being zero while request rate is low, and gradually increasing if requests are following one after another.

Is this a viable solution to protect against a DDOS?

What are the weak points?

like image 977
Andy Avatar asked Jun 19 '11 06:06

Andy


3 Answers

No, it doesn't protect against DDOS attacks. It protects the CPU from being overloaded, but it still occupies the thread while it's sleeping, so an attacker can easily occupy all of the assigned threads in the web server, rendering it unresponsive. It actually makes it easier to perform a DDOS attack.

A Sleep can be used to protect against brute fource attacks by reducing the number of tries that can be done per second. (The drawback is of course that it makes it more sensetive to DDOS attacks.)

like image 145
Guffa Avatar answered Oct 27 '22 17:10

Guffa


It definitely doesn't prevent a DDOS because networking equipment in front of your application may still be overwhelmed.

Additionally the distributed nature of a "distributed denial of service" means that you'll be getting excessive traffic from lots of different IPs, not one.

But regardless, what you're doing in your app doesn't get around whatever is in front your app from being overwhelmed.

like image 45
Matthew Lund Avatar answered Oct 27 '22 17:10

Matthew Lund


A thread sleep is useful only to help guard against cryptography attacks. You can use them to guard against:

  • Attackers using execution time of different challenge strings to determine the logic in your implementation. If you ensure that all responses take the same time, then they can't use that information to determine how your algorithm works
  • Increasing execution time upon repeated failed password attempts to avoid a brute force attack

Besides these uses, a thread sleep doesn't have much application in security. They tie up resources (connections or session state), so are worthless for guarding against a DoS attack.

like image 24
Merlyn Morgan-Graham Avatar answered Oct 27 '22 16:10

Merlyn Morgan-Graham