DDOS 攻击:用 Thread.Sleep() 防御?
如果我在渲染 HTTP 响应时引入 Thread.Sleep(x)
延迟,其中 x
将根据来自给定 IP 的请求速率而变化:从零到请求率较低,如果请求不断,请求率会逐渐增加。
这是防御 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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
不,它不能防止 DDOS 攻击。它可以保护 CPU 免于过载,但在休眠时仍然占用线程,因此攻击者可以轻松占用 Web 服务器中所有分配的线程,使其无响应。它实际上使执行 DDOS 攻击变得更加容易。
睡眠可用于通过减少每秒可以完成的尝试次数来防止暴力攻击。 (当然缺点是它对 DDOS 攻击更敏感。)
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.)
它绝对不能阻止 DDOS,因为应用程序前面的网络设备可能仍然不堪重负。
此外,“分布式拒绝服务”的分布式性质意味着您将从许多不同的 IP(而不是一个)获得过多的流量。
但无论如何,您在应用程序中所做的操作并不能避免应用程序前面的任何内容被淹没。
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.
线程睡眠仅有助于防范加密攻击。您可以使用它们来防范:
除了这些用途之外,线程睡眠还没有在安全方面有很多应用。它们会占用资源(连接或会话状态),因此对于防范 DoS 攻击毫无价值。
A thread sleep is useful only to help guard against cryptography attacks. You can use them to guard against:
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.
不。DDoS 是一种使用大量受感染机器来攻击目标的攻击。这可以防止 DoS 等较小的攻击,但不能防止分布式攻击。通常,您的网络服务器会在产生任何影响之前崩溃。
如果您遇到很多问题,我会推荐 DDoS 保护服务或主机。
No. A DDoS is an attack that used a lot of compromised machines to attack a target. That will protect against smaller attacks like DoSes, but not distributed attacks. Usually, your web server will crash before that could make any sort of effect.
I would recommend a DDoS protection service or host if you're having a lot of problems with them.
DDoS 无法通过代码进行保护,它不仅仅是保护您的服务器,通常 DDoS 会损害您的负载均衡器和防火墙(如果您有的话),如果没有,DDoS 也会损害您的服务器。
DDoS 可以通过多种级别来完成:UPD/TCP/HTTP 等...
保护自己免受 DDoS 攻击的最佳方法是使用反向代理,因此如果您访问您的站点,它不会显示真实的 IP,很高兴我们现在有免费使用 Cloud Flare。 https://www.cloudflare.com/
我写了一篇小文章,介绍 Cloud Flare 如何保护您我已经使用它们一年了,它们是迄今为止最好的,也是最便宜的。
http: //www.yourwwwdesign.com/2012/07/23/best-practice-to-protect-your-site-from-ddos-for-free/
希望这有帮助!如果您需要更多帮助,请随时与我联系。
DDoS can't be protected by code, it is more then protecting your server, usually DDoS hurt your load balancer and firewall if you have some, if not the DDoS will hurt your server.
DDoS can be done via many levels: UPD/TCP/HTTP etc...
The best way to protect yourself from DDoS is to use reverse proxy so if you go to your site it wont show the real IP, and happily we have now for free with Cloud Flare. https://www.cloudflare.com/
I wrote a small article about how Cloud Flare protects you as i'm using them since a year now and they are the BEST so far and the cheapest.
http://www.yourwwwdesign.com/2012/07/23/best-practice-to-protect-your-site-from-ddos-for-free/
Hope this helps! if you need more help please don't hesitate to contact me.