DDOS 攻击:用 Thread.Sleep() 防御?

发布于 2024-11-16 03:48:37 字数 163 浏览 1 评论 0原文

如果我在渲染 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

成熟的代价 2024-11-23 03:48:37

不,它不能防止 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.)

も让我眼熟你 2024-11-23 03:48:37

它绝对不能阻止 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.

征﹌骨岁月お 2024-11-23 03:48:37

线程睡眠仅有助于防范加密攻击。您可以使用它们来防范:

  • 攻击者使用不同质询字符串的执行时间来确定您的实现中的逻辑。如果您确保所有响应花费相同的时间,那么他们就无法使用该信息来确定您的算法如何工作
  • 在重复失败的密码尝试时增加执行时间以避免暴力攻击

除了这些用途之外,线程睡眠还没有在安全方面有很多应用。它们会占用资源(连接或会话状态),因此对于防范 DoS 攻击毫无价值。

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.

凑诗 2024-11-23 03:48:37

不。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.

柠檬 2024-11-23 03:48:37

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文