How to stop hack/DOS attack on web API

后端 未结 6 1184
时光取名叫无心
时光取名叫无心 2021-01-30 03:15

My website has been experiencing a denial of service/hack attack for the last week. The attack is hitting our web API with randomly generated invalid API keys in a loop.

<
6条回答
  •  难免孤独
    2021-01-30 03:39

    Here are a couple ideas. There are a number of strategies in addition, but this should get you started. Also realize that amazon gets ddos'd on a frequent basis and their systems tend to have a few heuristics that harden them (and therefore you) from these attacks, particularly if you are using Elastic load balancing, which you should be using anyway.

    • Use a CDN -- they often have ways of detecting and defending against ddos. Akamai, mastery, or amazons own cloud front.
    • Use iptables to blacklist offensive ips. The more tooling you have around this, the faster you can blok/unblock
    • Use throttling mechanisms to prevent large numbers of requests

    • Automatically deny requests that are very large (say greater than 1-2mb; unless you have a photo uploading service or similar) before they get to your application

    • Prevent cascading failures by placing a limit on the total number of connections to other components in your system; for example, dont let your database server become overloaded by opening a thousand connections to it.

提交回复
热议问题