LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 04-03-2013, 11:51 AM   #1
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Rep: Reputation: 78
How to fight a DDOS attack?


Although I've never been a victim of one myself, I often wonder how one deals with a ddos attack. This article in particular suggests it might be worth knowing more about it.

Would blocking IP ranges help? Where does the bottleneck occur? Is it DNS or is it Apache or is it somewhere else?
 
Old 04-03-2013, 12:31 PM   #2
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
A denial of service attack is basically asking a system for something so many times at once that it runs out of that thing and nobody can use the system. This can be anything from ping replies to DHCP requests to information from a database.
For a DOS attack from one source, yes, you can often just block IP addresses and for simple DDOS attacks IP ranges. However, in a true DDOS the attacking IPs having nothing in common, there is no way to prevent the attack and only having more resources than the attackers can request can beat the attack -- that happened here, for example:
http://www.theregister.co.uk/2013/03...ateral_damage/
 
Old 04-03-2013, 03:33 PM   #3
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Part of the problem with an attack of this nature is that attempting to filter and block the connections starts to consume a vast amount of resources. Typically intervention upstream, like at the ISP level is required in these types of situations.

Here are a couple of interesting articles regarding a recent and fairly high profile ddos situation involving Spamhaus, link one, link two.
 
Old 04-03-2013, 03:45 PM   #4
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Should also mention that, since DDOS traffic is made to look identical to normal traffic for whichever service is being attacked, there is no way to tell what is a DDOS attack and what is a genuine request -- so you have to block everything thus denying service anyhow.
 
Old 04-05-2013, 10:36 AM   #5
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by 273 View Post
A denial of service attack is basically asking a system for something so many times at once that it runs out of that thing and nobody can use the system. This can be anything from ping replies to DHCP requests to information from a database.
This suggests that a good attack strategy is to generate the most resource-intensive requests possible. Conversely, a good defense would be to identify and drop as quickly as possible any spurious requests.

Quote:
Originally Posted by 273 View Post
For a DOS attack from one source, yes, you can often just block IP addresses and for simple DDOS attacks IP ranges. However, in a true DDOS the attacking IPs having nothing in common, there is no way to prevent the attack and only having more resources than the attackers can request can beat the attack -- that happened here, for example:
http://www.theregister.co.uk/2013/03...ateral_damage/
This is a grim thought. I had heard of the spamhaus attacks. I'll be reading that article.
 
Old 04-05-2013, 10:40 AM   #6
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by Noway2 View Post
Part of the problem with an attack of this nature is that attempting to filter and block the connections starts to consume a vast amount of resources. Typically intervention upstream, like at the ISP level is required in these types of situations.
I can definitely appreciate the need to get one's ISP involved. Still, I'm wondering if there might be clustered architectures that are better able to be reconfigured to deal with such an attack. I'm imagining that a single dedicated server is more vulnerable than a virtually allocated cluster, but this is not based on any vast amount of knowledge. Is there some kind of resilient architecture one can generally adopt that is more defensible?

Quote:
Originally Posted by Noway2 View Post
Here are a couple of interesting articles regarding a recent and fairly high profile ddos situation involving Spamhaus, link one, link two.
Thanks for those links. Will be reading them.
 
Old 04-05-2013, 10:42 AM   #7
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by 273 View Post
Should also mention that, since DDOS traffic is made to look identical to normal traffic for whichever service is being attacked, there is no way to tell what is a DDOS attack and what is a genuine request -- so you have to block everything thus denying service anyhow.
OK that's depressing. I'm imagining that DDOS is kind of an art form and that some are better than others at generating more random-looking requests that resist filtering. I'm further imagining that someone has already written a nearly perfect, state-of-the-art DDOS tool and it's probably been open sourced somewhere.
 
Old 04-05-2013, 10:50 AM   #8
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
There are plenty of DOS and DDOS tools out there already.
There isn't really anything clever about it though. You just infect a load of zombie machines, or buy some off a website somewhere, then tell them all to (for example) do a DNS lookup on the target or request a web page. How will the target know whether it's a legitimate request or an attack?
 
Old 04-05-2013, 11:21 AM   #9
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by 273 View Post
How will the target know whether it's a legitimate request or an attack?
This is precisely the sort of thing I'd like to know more about. I can imagine a sloppy attack might request the same web page over and over and over again and never once download any javascript or images, for example. Or a single IP requesting DNS lookup over and over again -- that sounds really suspect as the remote machine would be totally ignoring any of the TTL values.
 
Old 04-05-2013, 01:40 PM   #10
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Quote:
Originally Posted by sneakyimp View Post
I can definitely appreciate the need to get one's ISP involved. Still, I'm wondering if there might be clustered architectures that are better able to be reconfigured to deal with such an attack.
I think the answer is a maybe and it would depend upon what is the weakest link. The DDOS attack hits you in two ways: processing resources and network bandwidth. If your limiting factor is processing capability, a cluster with load sharing, or even a front end proxy would buy you a great deal. If you limited by the network capacity, the only thing you could do is filter up stream.
 
Old 04-05-2013, 02:11 PM   #11
manu-tm
Member
 
Registered: May 2008
Location: France
Distribution: Ubuntu, Debian
Posts: 343

Rep: Reputation: 43
I think the more distributed the attack, the more difficult to counter it is.

I'm wondering if there could be a way, at server level, to limit, during a time period, successive identical requests from one IP address without hampering legitimate inbound traffic.
 
Old 04-05-2013, 02:15 PM   #12
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by manu-tm View Post
I think the more distributed the attack, the more difficult to counter it is.

I'm wondering if there could be a way, at server level, to limit, during a time period, successive identical requests from one IP address without hampering legitimate inbound traffic.
There is, far as I know, on most servers. That's why a lot of machines need to be used. I can't pretend to understand this fully but it's an explanation of how hosts are recruited to DDOS:
http://www.theregister.co.uk/2013/03..._the_internet/
 
Old 04-05-2013, 02:40 PM   #13
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by Noway2 View Post
I think the answer is a maybe and it would depend upon what is the weakest link. The DDOS attack hits you in two ways: processing resources and network bandwidth. If your limiting factor is processing capability, a cluster with load sharing, or even a front end proxy would buy you a great deal. If you limited by the network capacity, the only thing you could do is filter up stream.
Having been enormously frustrated by running BIND in the past, I now typically rely on DNS services like Amazon Route 53. Hopefully Amazon would know how to deal with such an attack?

Might it be possible to exhaust the available ports on a web server? If I'm not mistaken, you may connect to a web server on port 80, but the server will then delegate the work of file transfer to some other port -- and port numbers, being described with a 16-bit int, are only about 65,000 in number. Seems to me that any botnet with a size that is some multiple of 2^16 would be able to shut down even an extraordinarily powerful system simply by occupying all 2^16 ports. Please correct me if I understand this incorrectly.
 
Old 04-05-2013, 02:45 PM   #14
sneakyimp
Senior Member
 
Registered: Dec 2004
Posts: 1,056

Original Poster
Rep: Reputation: 78
Quote:
Originally Posted by manu-tm View Post
I think the more distributed the attack, the more difficult to counter it is.
Without a doubt.

Quote:
Originally Posted by manu-tm View Post
I'm wondering if there could be a way, at server level, to limit, during a time period, successive identical requests from one IP address without hampering legitimate inbound traffic.
I think iptables would be useful in this regard. Like this example. I'm no master of iptables commands, but I've been extremely pleased with the protections offered by fail2ban.

Last edited by sneakyimp; 04-05-2013 at 02:46 PM. Reason: fix quote tag
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
DDos attack? Achical Linux - Security 4 11-03-2012 10:54 AM
Need help to avoid DDos attack classical Linux - Security 4 10-07-2009 03:34 AM
DDOS attack help me dheeraj4uuu Linux - Security 9 05-31-2009 03:07 PM
DDOS Attack studiofos Linux - Security 3 09-12-2006 03:42 AM
ddos attack ashis Linux - Security 1 06-14-2001 02:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 02:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration