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 02-02-2005, 08:07 AM   #1
GNU
LQ Newbie
 
Registered: Sep 2003
Location: CloseToYou
Posts: 14

Rep: Reputation: 0
Exclamation DDOS attack WebProblem


Well dunno how to start but i will try to explain what is going on.
On my website i have lots of users and lots of haters. Some of the haters were trying to shutdown my website but was unsuccessful. Until now! . Some one figure out if they do Ddoss-dos attacks from irc with spoofed ip's and with a lot of bandwidth, they would bring my connection down to 0 . Which happened

Well i have tried to put some iptables rules and hoped that will help but no luck still.

I'm using debian with the latest 2.4.x kernel...

Here are some of the log's that i am getting from netstat...
tcp 0 0 my.url.com sh cncln.online.ln.cn:1945 SYN_RECV
tcp 0 0 my.url.com sh cncln.online.ln.cn:1986 SYN_RECV
tcp 0 0 my.url.com sh 198.105.47.159:1205 SYN_RECV
tcp 0 0 my.url.com sh cncln.online.ln.cn:1650 SYN_RECV
tcp 0 0 my.url.com sh 198.105.47.104:1919 SYN_RECV
tcp 0 0 my.url.com sh 198.105.47.104:1919 SYN_RECV


Thank You a big time.

Last edited by GNU; 02-02-2005 at 05:34 PM.
 
Old 02-02-2005, 08:34 AM   #2
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
Setup a firewall! Iptables with following enable in it
Enable flood control
Drop all Spoofing and bad addresses
Do Sanity check and drop
Make sure NEW incoming tcp connections are SYN packets
Drop all incoming fragments
Drop all incoming malformed XMAS packets
Drop all incoming malformed NULL packets
Bad incoming source ip address 0.0.0.0/8
Bad incoming source ip address 127.0.0.0/8
Bad incoming source ip address 10.0.0.0/8 and all other private ips
etc
 
Old 02-02-2005, 08:46 AM   #3
TruckStuff
Member
 
Registered: Apr 2002
Posts: 498

Rep: Reputation: 30
May also want to check out Apache's mod_dosevasive. It has some tools to defend against DOS attacks. But the more important thing is to setup the firewall as mentioned above. Probably the most important rules would be:
Code:
# Limit SYN packet requests
$IPTABLES -N syn-flood
$IPTABLES -A INPUT -i $INTERFACE -p tcp --syn -j syn-flood
$IPTABLES -A syn-flood -m limit --limit 1/s --limit-burst 4 -j RETURN
$IPTABLES -A syn-flood -j DROP
This will limit the amount of SYN packets coming into your server.

Last edited by TruckStuff; 02-02-2005 at 08:48 AM.
 
Old 02-02-2005, 08:48 AM   #4
GNU
LQ Newbie
 
Registered: Sep 2003
Location: CloseToYou
Posts: 14

Original Poster
Rep: Reputation: 0
thanks for the quick reply,

i do have iptables set up and use all kinds of settings that i red of the internet

iptables -A INPUT -s any/0 -p tcp --syn -j DROP
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
echo 1 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts /for smurf etc..
sysctl -w net.ipv4.tcp_max_syn_backlog="2048" to max the open pipes..

but im unsure how to setup the other things u mentioned.. Sanity check, xmas, null...

But what I've seen is that even if i drop the syn_ack they still get recieved, so there is no chance of saving that bw but it still succedes in killing my connection and makes it almost impossible to ssh to the box



TruckStuff:
* The apache is off, this is towards the ssh port or any port that they find open...

* should i really RETURN the syn requests? isn't it better to DROP that to?

Last edited by GNU; 02-02-2005 at 08:56 AM.
 
Old 02-02-2005, 08:57 AM   #5
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
Setup firewall using www.giptables.org

It provides good protection against all kind of TCP SYN-flooding Denial of Service attacks.

It provides good protections against IP spoofing.

I'm using same on more than 4 very very busy servers and they works
 
Old 02-02-2005, 10:46 AM   #6
GNU
LQ Newbie
 
Registered: Sep 2003
Location: CloseToYou
Posts: 14

Original Poster
Rep: Reputation: 0
i have tried but i got some´errors when i run it..

etc/rc.d/init.d/giptables: line 39: /etc/rc.d/init.d/functions: No such file or directory
/etc/rc.d/init.d/giptables: line 42: /etc/sysconfig/network: No such file or directory
/etc/rc.d/init.d/giptables: line 45: [: =: unary operator expected
Starting up GIPTables Firewall: /etc/rc.d/init.d/giptables: line 92: success: command not found
/etc/rc.d/init.d/giptables: line 93: failure: command not found

The firewall still works tho, but i never like error messages when it comes to a fw that´s supposed to save my ass


Last edited by GNU; 02-02-2005 at 11:30 AM.
 
Old 02-02-2005, 10:37 PM   #7
GNU
LQ Newbie
 
Registered: Sep 2003
Location: CloseToYou
Posts: 14

Original Poster
Rep: Reputation: 0
any suggestions ?
 
Old 02-03-2005, 01:54 AM   #8
hardcorelinux
Member
 
Registered: Jan 2005
Location: India
Distribution: RHEL,CentOS,SUSE,Solaris10
Posts: 183

Rep: Reputation: 31
mod_dosevasive is better , preventing web based attacks.
 
Old 02-03-2005, 04:33 AM   #9
GNU
LQ Newbie
 
Registered: Sep 2003
Location: CloseToYou
Posts: 14

Original Poster
Rep: Reputation: 0
Quote:
Originally posted by GNU
* The apache is off, this is towards the ssh port or any port that they find open...
yea i bet it is if that was the problem
 
Old 02-03-2005, 07:14 AM   #10
nixcraft
Member
 
Registered: Nov 2004
Location: BIOS
Distribution: RHEL3.0, FreeBSD 5.x, Debian 3.x, Soaris x86 v10
Posts: 379

Rep: Reputation: 30
Quote:
Originally posted by GNU
i have tried but i got some´errors when i run it..

etc/rc.d/init.d/giptables: line 39: /etc/rc.d/init.d/functions: No such file or directory
/etc/rc.d/init.d/giptables: line 42: /etc/sysconfig/network: No such file or directory
/etc/rc.d/init.d/giptables: line 45: [: =: unary operator expected
Starting up GIPTables Firewall: /etc/rc.d/init.d/giptables: line 92: success: command not found
/etc/rc.d/init.d/giptables: line 93: failure: command not found

The firewall still works tho, but i never like error messages when it comes to a fw that´s supposed to save my ass

This works without problem on RHL/RHEL may be some code need to change on Debian
 
Old 02-03-2005, 07:33 AM   #11
zsoltrenyi
Member
 
Registered: May 2004
Distribution: redhat, trustix, debian
Posts: 103

Rep: Reputation: 15
do you have syn_cookies enabled?
i don't know where it is in debian but in red hat you hav to edit /etc/sysctl.conf and add the following line:
net.ipv4.tcp_syncookies=1
or try: #sysctl -w net.ipv4.tcp_syncookies=1
 
Old 02-03-2005, 07:43 AM   #12
zsoltrenyi
Member
 
Registered: May 2004
Distribution: redhat, trustix, debian
Posts: 103

Rep: Reputation: 15
if you limit from iptables the rate of the incoming requests (syn bit set) you block the legitimate users too
 
Old 02-03-2005, 11:35 AM   #13
GNU
LQ Newbie
 
Registered: Sep 2003
Location: CloseToYou
Posts: 14

Original Poster
Rep: Reputation: 0
we'll see how this works out. I'm very thankful for this greate help.

And yes the syn cookies are enabled as I pasted it in my 2:nd post..

Last edited by GNU; 02-04-2005 at 05:19 AM.
 
Old 02-07-2005, 04:26 PM   #14
GNU
LQ Newbie
 
Registered: Sep 2003
Location: CloseToYou
Posts: 14

Original Poster
Rep: Reputation: 0
Talking

well i am still on it to check out

btw i am still open to take some suggestions from profesionals.
 
Old 02-09-2005, 07:20 AM   #15
zsoltrenyi
Member
 
Registered: May 2004
Distribution: redhat, trustix, debian
Posts: 103

Rep: Reputation: 15
sorry, i haven't read it carefully
i really don't know other protection from synflooding but syn_cookies
 
  


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
Linksys, Bittorrent, and DDOS Neruocomp Linux - General 2 05-18-2005 03:07 PM
Are these DDoS Defense Router Settings correct ? Rayen16 Linux - Security 3 04-10-2005 10:15 AM
ddos or hacked? Please help!! lucastic Linux - Security 8 12-16-2004 07:56 PM
Ddos Mag|c Linux - Security 2 08-16-2003 09:41 PM
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 03:37 PM.

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