TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Ask HN: How do you handle DDoS attacks?

223 点作者 dineshp2超过 8 年前
For owners of small websites running on DigitalOcean, GCP or AWS, how do you handle DDoS and DoS attacks?<p>For context, while exploring the load testing tool Siege running on a VPS, I was able to bring down multiple sites running on shared hosting, and some running on small VPS by setting a high enough concurrent number of users. This is not a DDoS, but it goes to show how easy it is to cause damage. Note: I only brought down sites that I own, or those of friends with their permission.<p>What tools are useful in fighting DDoS attacks and script kiddies? Mention free and paid options.<p>What are the options to limit damage in case of an attack? How do you limit bandwidth usage charges?<p>There was a previous discussion on this topic 6 years ago https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=1986728

29 条评论

buro9超过 8 年前
I&#x27;ve faced DoS attacks for years as I run internet forums.<p>The simple advice for layer 7 (application) attacks:<p>1. Design your web app to be incredibly cacheable<p>2. Use your CDN to cache everything<p>3. When under attack seek to identify the site (if you host more than one) and page that is being attacked. Force cache it via your CDN of choice.<p>4. If you cannot cache the page then move it.<p>5. If you cannot cache or move it, then have your CDN&#x2F;security layer of choice issue a captcha challenge or similar.<p>The simple advice for layer 3 (network) attacks:<p>1. Rely on the security layer of choice, if it&#x27;s not working change vendor.<p>On the L3 stuff, when it comes to DNS I&#x27;ve had some bad experiences (Linode, oh they suffered) some pretty good experiences (DNS Made Easy) and some great experiences (CloudFlare).<p>On L7 stuff, there&#x27;s a few things no-one tells you about... like if you have your application back onto AWS S3 and serve static files, that the attack can be on your purse as the bandwidth costs can really add up.<p>It&#x27;s definitely worth thinking of how to push all costs outside of your little realm. A Varnish cache or Nginx reverse proxy with file system cache can make all the difference by saving your bandwidth costs and app servers.<p>I personally put CloudFlare in front of my service, but even then I use Varnish as a reverse proxy cache within my little setup to ensure that the application underneath it is really well cached. I only have about 90GB of static files in S3, and about 60GB of that is in my Varnish cache, which means when some of the more interesting attacks are based on resource exhaustion (and the resource is my pocket), they fail because they&#x27;re probably just filling caches and not actually hurting.<p>The places you should be ready to add captchas as they really are uncacheable:<p>* Login pages<p>* Shopping Cart Checkout pages<p>* Search result pages<p>Ah, there&#x27;s so much one can do, but generally... designing to be highly cacheable and then using a provider who routinely handles big attacks is the way to go.
评论 #12379084 未加载
评论 #12378440 未加载
评论 #12377654 未加载
wesleytodd超过 8 年前
My startup&#x27;s site gets DDOS&#x27;d about once a week. We have seen a huge range of attacks from UDP floods, to wordpress pingback attacks, to directed attacks on our services.<p>We have many layers of protection:<p>* We run iptables and an api we wrote on our ingest servers. We run failtoban on a separate set of servers. When fail2ban sees something, we have it hit the api and add the iptables rules. This offloads the cpu of failtoban from our ingest servers.<p>* We block groups of known hosting company IP blocks, like digital ocean and linode. These were common sources of attacks.<p>* Our services all have rate limits which we throttle based on IP<p>* We have monitoring and auto-scaling which responds pretty quickly when needed. And has service level granularity.<p>* Recently moved behind cloudflare because google cloud did not protect us from attacks like the UDP floods which didn&#x27;t even reach our servers.<p>EDIT: formatting
评论 #12376973 未加载
评论 #12378545 未加载
评论 #12377386 未加载
kev009超过 8 年前
I work at a large CDN that also sells DDoS mitigation.<p>Firstly, we are built to endure any DDoS the internet has yet seen on our peering, backbone, and edge servers for CDN services. This is quite important when you are tasked with running a large percentage of the interweb but probably not practical for most organizations, mostly due to talent rather than cost (you need people that actually understand networking and systems at the implementation level, not the modern epithet of full stack developer).<p>But, it is critical to have enough inbound peering&#x2F;transit to eat the DDoS if you want to mitigate it -- CDNs with a real first party network are well suited for this due to peering ratios.<p>Secondly, when you participate in internet routing decisions through BGP, you begin to have options for curtailing attacks. The most basic reaction would be manually null routing IPs for DoS, but that obviously doesn&#x27;t scale to DDoS. So we have scrubbers that passively look for collective attack patterns hanging on the side of our core, and act upon that. Attack profiles and defense are confirmed by a human in our 24&#x2F;7 operations center, because a false positive would be worse than a false negative.<p>Using BGP, we can also become responsible for other companies&#x27; IP space and tunnel a cleaned feed back to them, so the mitigation can complement or be used in lieu of first party CDN service.<p>In summary, the options are pretty limited: 1) Offload the task to some kind of service provider 2) Use a network provider with scrubbing 3) you&#x27;ve hired a team to build this because you are a major internet infrastructure.
rmdoss超过 8 年前
We need to divide DDoS here in two categories:<p>-DDoS you can handle (small ones). That anything up to 1 or 2Gbps or 1m packets per second.<p>-DDoS you can not handle. Anything higher than that.<p>For the smaller DDoS attacks, you can handle it by adding more servers and using a load balancer (eg. ELB) in front of your site. Both Linode and DigitalOcean will null route your IP address if the attack goes above 100-200Mbps, which is very annoying. Amazon and Google will let you handle on your own (and charge you for it), but you will need quite a few instances to keep up with it.<p>For anything bigger than that, you have to use a DDoS mitigation service. Even bigger companies do not have 30-40Gbps+ capacity extra hanging around just in case.<p>I have used and engaged with multiple DDoS mitigation companies and the ones that are affordable and good enough for HTTP (or HTTPS) protection are CloudFlare, Sucuri.net and Incapsula.<p>-CloudFlare: Is the most popular one and works well for everything but l7 attacks (in my experience). You need to get their paid plan, since the free one does not include ddos protection - they will ask you to upgrade if that happens.<p>-Sucuri.net: Not as well known as CloudFlare, but they have a very solid mitigation. Have been using them more lately as they are cheaper overall than CloudFlare and have amazing support.<p>-Incapsula: I used to love them, but their support has been really bad lately. They are on a roll trying to get everyone to upgrade their plans, so that&#x27;s been annoying. If you can do stuff on your own, they work well.<p>That&#x27;s been longer than what I anticipated, but hope it helps you decide.<p>thanks,
评论 #12377693 未加载
DivineTraube超过 8 年前
We (Baqend) use an approach that is somewhat different from what has been proposed here so far:<p>- Every one of our servers rate limits critical resources, i.e. the ones that cannot be cached. The servers autoscale when neccessary.<p>- As rate limiting is expensive (you have to remember every IP&#x2F;resource pair across all servers) we keep that state in a locally approximated representation using a ring buffer of Bloom filters.<p>- Every cacheable resource is cached in our CDN (Fastly) with TTLs estimated via an exponential decay model over past reads and writes.<p>- When a user exceeds his rate limit the IP is temporarily banned at the CDN-level. This is achieved through custom Varnish VCLs deployed in Fastly. Essentially the logic relies on the bakend returning a 429 Too Many Requests for a particular URL that is then cached using the requester&#x27;s ID as a hash key. Using the restart mechanism of Varnish&#x27;s state machine, this can be done without any performance penalty for normal requests. The duration of the ban simply is the TTL.<p>TL;DR: Every abusive request is detected at the backend servers using approximations via Bloom filters and then a temporary ban is cached in the CDN for that IP.
评论 #12378394 未加载
评论 #12378458 未加载
tombrossman超过 8 年前
I use and recommend hosting with OVH if you are worried about DDOS and serving a Western market. No affiliation, just a happy customer.<p>OVH include DDOS protection by default[0] and they have a very robust backbone network[1] in Europe and North America that they own and operate themselves (this is how &amp; why anti-DDOS is standard with them).<p>For quick side-projects I still fire up a DigitalOcean instance or two because their UX is so slick and easy. If I needed huge scale and price didn&#x27;t matter I would probably go with AWS (their &#x27;anti-DDOS&#x27; is their vast bandwidth + your ability to pay for it during an attack). For everything else, I put it on OVH.<p>[0]<a href="https:&#x2F;&#x2F;www.ovh.com&#x2F;us&#x2F;anti-ddos&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.ovh.com&#x2F;us&#x2F;anti-ddos&#x2F;</a><p>[1]<a href="http:&#x2F;&#x2F;weathermap.ovh.net&#x2F;" rel="nofollow">http:&#x2F;&#x2F;weathermap.ovh.net&#x2F;</a>
评论 #12376891 未加载
评论 #12376889 未加载
评论 #12377347 未加载
评论 #12376838 未加载
jaypaulynice超过 8 年前
I work at a CDN&#x2F;Security engineering company, but this is just my view.<p>First off you need to determine where the attack is coming from. You could redirect based on IP&#x2F;request headers in a .htaccess file or apache rules.<p>Your next bet is to distribute&#x2F;auto-scale your application if possible.<p>You need to setup a web application firewall that sits in front of your web servers and analyzes the requests&#x2F;responses that hit the web servers. A lot of the ddos campaigns are easy to identify based on the request headers&#x2F;IP&#x2F;Geo and requests&#x2F;second.<p>It&#x27;s not hard to write a small web server&#x2F;proxy to do this, but it would be best left to someone who knows what they&#x27;re doing because you don&#x27;t want to block real user requests. You can use ModSecurity&#x27;s open source WAF for apache&#x2F;nginx, but again you have to know what you&#x27;re doing.<p>When I faced this issue, I wrote a small web server&#x2F;proxy here that you can start on port 80:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;julesbond007&#x2F;java-nio-web-server" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;julesbond007&#x2F;java-nio-web-server</a><p>Here I wrote some rules to drop the request if it&#x27;s malicious:<p><a href="https:&#x2F;&#x2F;github.com&#x2F;julesbond007&#x2F;java-nio-web-server&#x2F;blob&#x2F;master&#x2F;src&#x2F;main&#x2F;java&#x2F;com&#x2F;nio&#x2F;http&#x2F;filter&#x2F;RequestFilter.java" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;julesbond007&#x2F;java-nio-web-server&#x2F;blob&#x2F;mas...</a>
DenisM超过 8 年前
AWS informs us that an ELB with HTTP&#x2F;HTTPS termination takes care of all problems except application level attacks. Traffic ingress is free, so it shouldn&#x27;t be expensive?<p>For static content there is always CDN. Costly, but it works in a pinch, while you&#x27;re planning you other moves.<p>The one thing left to worry about is dynamic content. Depending on the application you could restrict all requests to authorized users only while under attack.<p>This isn&#x27;t a complete solution by any means, but reduced the attack surface considerably.<p><a href="https:&#x2F;&#x2F;d0.awsstatic.com&#x2F;whitepapers&#x2F;DDoS_White_Paper_June2015.pdf" rel="nofollow">https:&#x2F;&#x2F;d0.awsstatic.com&#x2F;whitepapers&#x2F;DDoS_White_Paper_June20...</a>
rmdoss超过 8 年前
To summarize the discussion here so far:<p>1- For small attacks you can optimize your stack, cache your content and use a provider that allows you to quickly scale and add more servers to handle the traffic. Do not use Linode or Digital Ocean as they will null route you.<p>OVH, AWS and Google are the ones to go with.<p>2- Use a DDoS mitigation &#x2F; CDN provider that will filter the attacks and only send clean traffic back to you.<p>The ones recommended so far:<p><a href="https:&#x2F;&#x2F;cloudflare.com" rel="nofollow">https:&#x2F;&#x2F;cloudflare.com</a><p><a href="https:&#x2F;&#x2F;sucuri.net" rel="nofollow">https:&#x2F;&#x2F;sucuri.net</a><p><a href="https:&#x2F;&#x2F;incapsula.com" rel="nofollow">https:&#x2F;&#x2F;incapsula.com</a>
carlosfvp超过 8 年前
There are many services for HTTP protection, but when you have a custom protocol for a RT service like a game, you are kind of screwed. It&#x27;s even worst if your game is UDP based.<p>I used to get attacked huge a load of corrupt UDP packets for a few seconds and that used to hang the main server, wich in 1 or 2 minutes disconnected all my players.<p>Solution: separate your UDP services from your TCP services in separate applications and servers, also use different type of protection services for each.<p>The attack still hanged the UDP services, so I started thinking about making a plugin for snort to analyse the traffic and only allow legit protocol packets. I haven&#x27;t done any of this last idea because the attackers stopped since they noticed that no one was being disconnected.<p>BTW, for TCP and HTTP I just used any tiny service that protects me from SYN Flood, like Voxility resellers.
评论 #12377320 未加载
tumdum_超过 8 年前
<a href="https:&#x2F;&#x2F;www.cloudflare.com" rel="nofollow">https:&#x2F;&#x2F;www.cloudflare.com</a>
评论 #12377192 未加载
评论 #12376612 未加载
r1ch超过 8 年前
Most DDoS attacks are volumetric. There isn&#x27;t a way to defend against this other than simply having a huge pipe, or paying someone with a huge pipe to be in front of your site.<p>Non-volumetric attacks like SYN or HTTP floods can be mitigated with appropriate rate limiting or firewalling.<p>Some providers like OVH have decent network-level mitigation in place, but you&#x27;re not gonna find that on a $5 VPS where they&#x27;re more than happy to null route you to protect their network.
评论 #12377760 未加载
asimjalis超过 8 年前
AWS DDoS defense techniques summary<p><a href="https:&#x2F;&#x2F;d0.awsstatic.com&#x2F;whitepapers&#x2F;DDoS_White_Paper_June2015.pdf" rel="nofollow">https:&#x2F;&#x2F;d0.awsstatic.com&#x2F;whitepapers&#x2F;DDoS_White_Paper_June20...</a><p>AWS DDoS defense using rate based blacklisting<p><a href="https:&#x2F;&#x2F;blogs.aws.amazon.com&#x2F;security&#x2F;post&#x2F;Tx1ZTM4DT0HRH0K&#x2F;How-to-Configure-Rate-Based-Blacklisting-with-AWS-WAF-and-AWS-Lambda" rel="nofollow">https:&#x2F;&#x2F;blogs.aws.amazon.com&#x2F;security&#x2F;post&#x2F;Tx1ZTM4DT0HRH0K&#x2F;H...</a>
northwardstar超过 8 年前
+1 to CloudFlare and Incapsula. Content delivery networks inherently distribute traffic and most have security enhancements specific to Distributed Denial-of-Service mitigation.<p>DDoS protection providers offer a remote solution to protect any server &#x2F; network, anywhere: <a href="https:&#x2F;&#x2F;sharktech.net&#x2F;remote-network-ddos-protection.php" rel="nofollow">https:&#x2F;&#x2F;sharktech.net&#x2F;remote-network-ddos-protection.php</a>
toast0超过 8 年前
A) have enough servers so when one gets null routed, it&#x27;s not a huge deal<p>B) make sure your servers don&#x27;t fall over while getting full line rate of garbage incoming (this is not hard for reflection or synfloods, but is difficult if they&#x27;re hitting real webpages, and very difficult if it includes a tls handshake)<p>C) bored ddos kiddies tend to ddos www only, so put your important things on other sub domains<p>D) hope you don&#x27;t attract a dedicated attacker
ebbv超过 8 年前
Disclaimer: I work for a hosting company, but these views are my own personal opinions which I held even before working where I currently do.<p>This is one of the reasons I would consider managed hosting as opposed to AWS, Digital Ocean, etc. With any good managed hosting provider, they are going to take steps to help deal with the DDoS. Depending on your level of service and the level of the attack, of course. But they will have an interest in helping you deal with and mitigate the attacks.<p>The reality is that true DDoS solutions are expensive, and if you have a &quot;small website&quot; then you&#x27;re probably not going to be able to afford them. But if you&#x27;re at a good sized hosting provider, they&#x27;re going to need to have these solutions themselves and can hopefully put them to use to protect your site.
damm超过 8 年前
1. Have a big enough pipe; if you are getting a DDoS attack of 2Gigabits&#x2F;second and your uplink is 1Gigabit there is nothing you can do except look for someone else to filter your traffic. (They have to basically take on the 2gig ddos; filter it and then pass back the valid traffic to you).<p>Verisign and others offer this service; typically using DNS. However often they support BGP<p>2. Add limiting factors; if you have an abusive customer rate limit them in nginx. If you are expecting a heavy day rate limit the whole site.<p>3. Stress testing and likely designing your website to withstand DDoS attacks.<p>You can cache or not cache; that&#x27;s not really the question. Handling a DDoS means what can you do to mitigate the extreme amount of traffic and still allow everything else to work.
评论 #12379161 未加载
评论 #12379163 未加载
executesorder66超过 8 年前
I&#x27;ve found this very useful:<p><a href="http:&#x2F;&#x2F;www.linuxjournal.com&#x2F;content&#x2F;back-dead-simple-bash-complex-ddos" rel="nofollow">http:&#x2F;&#x2F;www.linuxjournal.com&#x2F;content&#x2F;back-dead-simple-bash-co...</a>
kalleboo超过 8 年前
Don&#x27;t piss anyone off
评论 #12376798 未加载
评论 #12376852 未加载
评论 #12379105 未加载
bowyakka超过 8 年前
You pay blacklotus a big pile of money and giggle at attackers.<p><a href="http:&#x2F;&#x2F;www.level3.com&#x2F;~&#x2F;media&#x2F;files&#x2F;brochures&#x2F;en_secur_br_ddos_mitigation_proxy.pdf" rel="nofollow">http:&#x2F;&#x2F;www.level3.com&#x2F;~&#x2F;media&#x2F;files&#x2F;brochures&#x2F;en_secur_br_dd...</a>
anondon超过 8 年前
Cloudbric offers free DDoS protection.<p><a href="https:&#x2F;&#x2F;cloudbric.com" rel="nofollow">https:&#x2F;&#x2F;cloudbric.com</a>
评论 #12376869 未加载
Kephael超过 8 年前
I colocate and rent services from providers who offer DDoS filtering and put all my websites behind CloudFlare. OVH&#x27;s protection is actually an excellent value, when I used to help run a game server provider they were mitigating 20 gbit&#x2F;sec and larger volumetric floods almost daily.
voltagex_超过 8 年前
Most of the responses here deal with bandwidth floods. Is that really the most common DDoS?<p>Thinking like an attacker, wouldn&#x27;t the most effective DoS be to find a CPU or memory intensive part of an application and use a small amount of bandwidth to create a large impact?
评论 #12379247 未加载
评论 #12379203 未加载
sroussey超过 8 年前
Depends on your needs, if you are in control of your network, etc. Two options here:<p><a href="http:&#x2F;&#x2F;cloudflare.com" rel="nofollow">http:&#x2F;&#x2F;cloudflare.com</a><p><a href="http:&#x2F;&#x2F;defense.net" rel="nofollow">http:&#x2F;&#x2F;defense.net</a>
评论 #12377332 未加载
shALKE超过 8 年前
Hey, I worked for game developing company and the attack was hitting some backend services. We tested voxility.com, it worked out fine after all was integrated.
vegancap超过 8 年前
Cloudflare. It&#x27;s been a real life saver for us.
评论 #12376844 未加载
solusipse超过 8 年前
To be honest, that was the only reason why I migrated from DigitalOcean to OVH.
dogma1138超过 8 年前
Post was too long <a href="http:&#x2F;&#x2F;pastebin.com&#x2F;48J9Ufdd" rel="nofollow">http:&#x2F;&#x2F;pastebin.com&#x2F;48J9Ufdd</a> :&lt;<p>Random &quot;wisdom&quot;, not in any particular order more like do&#x27;s and dont&#x27;s that I picked up with dealing with and executing DoS&#x2F;DDoS attacks.<p>Testing, testing, testing, regardless of how you choose and what you implement your mitigation test it and test it well because there are a lot of things you need to know.<p>Know and understand exact effect that the DDOS&#x2F;DoS mitigation has, the leakage rate, what attacks can still bring you down, and the cost of mitigation.<p>Make sure you do the testing at different hours of the day if not you better know your application and every business process very well because I&#x27;ve seen cases where 50GB&#x2F;s DDoS would do absolutly nothing except on tuesday and sunday at 4AM when some business batch process would start and the leakage from the DoS attack + the backend process would be enough to kill the system. Common processed that can screw you over are backups, site to site or co-location syncs&#x2F;transfers, various database wide batches, pretty common times for this anything in early morning, end of weak, end of month, end of quarter etc.<p>If you are using load or stress testing tools on your website make sure to turn off compression it&#x27;s nice that you can handle 50,000 users that all use GZIP but the attackers can choose not too.<p>Understand what services your website&#x2F;service relies on for operation common things are services like DNS, SMTP etc. if I can kill your DNS server people can&#x27;t access your website, if i can kill services that are needed for the business aspect of your service to function like SMTP I&#x27;m effectively shutting you down also.<p>If you are hosting your service on Pay As You Go hosting plans make sure to implement a billing cap and a lot of loud warnings, your site going down might not be fun, but it&#x27;s less fun to wake up to a 150K bill in the morning, if you are a small business DoD&#x2F;DDoS can result in very big financial damages that can put you out of business.<p>Understand exactly how many resources each &quot;operation&quot; on your website or API costs in terms of memory, disk access&#x2F;IOP&#x27;s, networking, DB calls etc, this is critical to know where to implement throttling and by how much.<p>If you implement throttling always do it on the &quot;dumber&quot; layer and the layer that issues the request for example if you want to limit the amount of DB queries you execute per minute to 1000 do it on the application server not on the DB server. This is both because you always want to use &quot;graceful&quot; throttling which means the requesters chooses not to make a request rather than the responder having not to respond, and it also allows you to implement selective throttling for example you might want to give higher priority to retrieving data of existing users than to allow new users to sign up or vice versa.<p>Do not leak IP address this is both in regards to load balancing and using scrapping services like Cloudflare. When you used services like cloudflare make sure that the services you protect are not accessible directly, make sure some one can&#x27;t figure out the IP address of your website&#x2F;API endpoint by simply looking at the DNS records. Common pitfalls are www.mysite.com -&gt; cloudflare IP while mysite.com&#x2F;www1.mysite.com&#x2F;somerandomstuff.mysite.com reveal the actual IP address. Another common source is having your IP address revealed via hard coded URLs on your site or within the SDK&#x2F;documentation for your API. If you have moved to cloudflare &quot;recently&quot; make sure that the IP address of your services is not recorded somewhere there are many sites that show historic values for DNS records if you can it is recommended to rotate your IP addresses once you sign up for a service like cloudflare and in any case make sure you block all requests that do not come through cloudflare.<p>When you do load balancing do it properly do not rely on DNS to for LB&#x2F;round robin if you have 3 front end servers do not return 3 IP addresses when some one asks whois www.mysite.com put a load balancer infront of them and return only 1 IP address. Relying on DNS for round robin isn&#x27;t smart it never works that well and you are allowing the attacker to focus on each target individually and bring your servers one by one.<p>Do not rely on IP blacklisting and for whatever reason do not ever ever ever use &quot;automated blacklisting&quot; regardless of what your DDoS mitigation provider is trying to tell you. If you only service a single geographical region e.g. NA, Europe, or &quot;Spain&quot; you can do some basic geographical restrictions e.g. limit access from say India or China this might not be possible if you are say a bank or an insurance provider and one of your customers has to access it from abroad. Ironically this impacts the sites and services that are the easiest to optimize for regional blocking for example if you only operate in france you might say ha! I&#x27;ll block all non-french IP address but this means that what an attacker needs to do is simply use IP spoofing and go over the entire range of French ISP&#x27;s and you blacklist all of France this only takes a few minutes to achieve! If you are blacklisting commercial service provider IP&#x27;s make sure you understand what impact can it have on your site, blacklisting DigitalOcean or AWS might be easy but then don&#x27;t be surprised when your mass mail services or digital contract services stop working. If you do use some blacklisting &#x2F; geoblocking use a single list that you maintain do not just select &quot;China&quot; in your scrapping service, firewall, router, and WAF all of them can have different Chinas which causes inconsistent responses, use a custom list and know what is in it.<p>Do not whitelist IP! I&#x27;ve seen way too many organizations that whitelist IPs so those IPs would not go for example through their CDN&#x2F;Scrapping service or would be whitelisted on whatever &quot;Super Anti DDoS Appliance&quot; the CISO decided to buy into this month. IP spoofing is easy! drive by attacks are easy! And since a common IPs to whitelist are things like your corporate internet connection nothing is easier for an attack to do than to figure those out. They simply need to google for the network blocks assigned to your organization if you are big enough and or were incorporated prior to 2005 or send a couple of 1000&#x27;s of phishing emails and get do some sniffing from the inside.<p>Understand collateral damage and drive by attacks. Know who (if) you share your IP addresses with and figure out how likely they are to be attacked, yes everyone would piss some one with keyboard access these days but there are plenty of types of businesses that are more common as targets, if you are hosting in a datacenter that also provides hosting for a lot of DDoS targets you might suffer also. For drive by attacks you need to have good understanding of the syndication of your service and if you are a B2B service provider your customers. If you provide some embedded widget to other sites if they are being DDoSed you might get hit also if it is a layer 7 attack. If you are providing service for businesses for example an address validation API you might get hammered if one of your clients is being DDoSed and the attacker is hitting their sign up pages.<p>Optimize your website; remove or transfer large files things like documents and videos can be moved to various hosting providers (e.g. YouTube) or CDN&#x27;s, if you are hosting large files on CDN&#x27;s make sure they are only accessible via the CDN, infact for the most part it&#x27;s best if you make sure that what is hosted on the CDN is only accessible via the CDN this prevents attackers from accessing the resources on your own servers via selecting your IP instead of the CDN. A common pitfall would be that some large file is linked on your website as cdn1.mysite.com&#x2F;largefile but it&#x27;s also accessible directly from your servers via www.mysite.com&#x2F;largefile.<p>Implement anti-scripting techniques on your website, captcha, DOM rendering (makes it very expensive for the attacker to execute layer 7 attacks if they need to render the DOM to do so) and make sure that every &quot;expensive&quot; operation is protected with some sort of anti-scripting mechanism. Test this! captchas that are poorly implemented are no good, and I don&#x27;t mean captchas that are somehow predictable or easy to read with CV&#x27;s if you have a services that looks like this LB&gt;Web Frontend&gt;Application Server&gt;DB make sure that the captcha field is the 1st thing that is being validated and make sure it&#x27;s validated in the web frontend or even in the LB&#x2F;Reverse Proxy. If you hit the application server validate all the fields do the thing and just before sending it to the DB you validate the captcha this won&#x27;t help to protect you against DoS&#x2F;DDoS as well if at all.<p>When you implement any mitigation design it well and understand leakage and &quot;graceful failure&quot;, it&#x27;s better for the dumb parts of your service to die and restart than it is for the more complicated parts. For example if after all of your mitigation you still have 10% leakage from your anti-ddos&#x2F;scraping service to your web frontend and from it there is a 5% leakage to to your DB do not scale the web frontend to compensate for the leakage from your scrapping service to the point of putting your DB at risk. A web server going down is mostly a trivial thing as it would bring itself back up usually on its own without any major issues, if your DB gets hammered well it&#x27;s a completely different game you do not want to run out of memory or disk and to have to deal with cache or transaction log corruption or consistency issues on the DB. Just get used to the fact that no matter what you are going to do and implement if some one wants to bring you down they will, do what you can and is economical to you do mitigate against certain attacks and for the reset design your service with predicted points of failure that would recover on their own in the most graceful manner and shortest period.
评论 #12378150 未加载
thatrascaltiger超过 8 年前
* Don&#x27;t buy service from a single CDN. It&#x27;s a recipe for disaster because even Akamai have outages, and having a traffic management setup that lets you move partial&#x2F;entire traffic to a different CDN will let you not only mitigate their outages, but also move traffic to a cheaper&#x2F;better provider.<p>* If you can&#x27;t CDN all your traffic, a CNAME with low TTL that can quickly switch to a CDN&#x2F;WAF endpoint can be helpful.<p>* AWS, Azure and GCP all have mitigations for L3 attacks built into their infrastructure. Because you don&#x27;t know how they operate, or when, don&#x27;t rely on them. Accept they may break your service and be prepared to have downtime or the means to shift your product quickly if an attack is big enough or presses enough secret buttons.<p>* Identify and remove all potential means of amplification both at networking&#x2F;infra and application. This means not exposing your own nameservers or NTP servers publicly, for L7 this is more complicated as it&#x27;ll depend on how your APIs and products interact with themselves and each other.<p>* Load test your products often to know what breaking point is and when performance regressions arise with a given amount of resources allocated. Fixing these early may mean you can ride out a DDoS without needing to do anything if it&#x27;s small enough and your application efficient enough.