LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 09-06-2013, 10:06 AM   #1
007stealth
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Rep: Reputation: Disabled
possible SYN flooding on port 1935. Sending cookies.


I am running a bunch of Centos servers with some media applications and I keep getting what I think is a DDOS attacks. I have the enabled tcp_syncookies and the problem still exists

My iptables is setup to block everything that isn't necessary as far as I know but we need to allow incoming information on port 1935 and that is where it is happening.

Is there anything we can do to fix this issue or at least stop my machine from crashing and going down because of this

Any help is appreciated.
 
Old 09-06-2013, 11:36 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 982
Blog Entries: 2

Rep: Reputation: 244Reputation: 244Reputation: 244
See where the traffic comes from. Do you need to accept traffic from the whole Internet?

My spam went way down when I banned some ISPs in Russia and South America.
 
Old 09-06-2013, 11:51 AM   #3
007stealth
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Is there an easy way or log file to check to find out what IP its coming from and then what is the process to ban that ip or range? Sorry for the probably really simple question this is pretty new to me

To add to this, traffic that comes on this port can be wordwide, its just users accessing a program... so with that in mind I could block the IP from this attack once I find it but I don't want to limit any legitimate users.

Last edited by 007stealth; 09-06-2013 at 11:54 AM.
 
Old 09-07-2013, 02:38 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by 007stealth View Post
I am running a bunch of Centos servers with some media applications
What "media applications" exactly?


Quote:
Originally Posted by 007stealth View Post
My iptables is setup to block everything that isn't necessary as far as I know but we need to allow incoming information on port 1935 and that is where it is happening.
Does the application only require that port? And post output from this please:
Code:
iptables-save
That may help us help you write appropriate rules.
 
Old 09-07-2013, 06:29 AM   #5
007stealth
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
It is a wowza media server actually, which the default port is 1935 for streaming... I am wondering if there is a way to limit traffic so these mass amounts will be dropped but not normal traffic. Below is my iptables-save command for review. The other option is to potentially change port 1935 if you think that would help.

# Generated by iptables-save v1.4.7 on Sat Sep 7 13:25:21 2013
*nat
:PREROUTING ACCEPT [6389:823552]
:POSTROUTING ACCEPT [1587:651103]
:OUTPUT ACCEPT [1587:651103]
COMMIT
# Completed on Sat Sep 7 13:25:21 2013
# Generated by iptables-save v1.4.7 on Sat Sep 7 13:25:21 2013
*mangle
:PREROUTING ACCEPT [88609432:34866104895]
:INPUT ACCEPT [88607125:34865599695]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [92757422:180810014794]
:POSTROUTING ACCEPT [92757422:180810014794]
COMMIT
# Completed on Sat Sep 7 13:25:21 2013
# Generated by iptables-save v1.4.7 on Sat Sep 7 13:25:21 2013
*filter
:INPUT DROP [1289:120704]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [92757422:180810014794]
-A INPUT -s (source IP) -p udp -m udp --dport 1934 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1935 -j ACCEPT
-A INPUT -s (Source IP) -p tcp -m tcp --dport 8085 -j ACCEPT
-A INPUT -s (source IP) -p tcp -m tcp --dport 8084 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
-A INPUT -p tcp -m tcp --dport 1935 --tcp-flags FIN,SYN,RST,ACK SYN -m connlimit --connlimit-above 1 --connlimit-mask 32 -j REJECT --reject-with tcp-reset
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN FIN,SYN -j DROP
-A INPUT -p tcp -m tcp --tcp-flags SYN,RST SYN,RST -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,RST FIN,RST -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,ACK FIN -j DROP
-A INPUT -p tcp -m tcp ! --tcp-flags FIN,SYN,RST,ACK SYN -m state --state NEW -j DROP
-A INPUT -f -j DROP
-A INPUT -p tcp -m tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG FIN,SYN,RST,PSH,ACK,URG -j DROP
COMMIT
# Completed on Sat Sep 7 13:25:21 2013
 
Old 09-07-2013, 08:59 AM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Try this:
Code:
# Generated by iptables-save v1.4.7 on Sat Sep  7 13:25:21 2013
*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -i lo -j ACCEPT 
-A INPUT -m state --state INVALID -j REJECT 
-A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT 
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
# Log if above 4 connections per /24 subnet (early warning)
-A INPUT -p tcp -m tcp --syn --dport 1935 -m connlimit --connlimit-above 4 --connlimit-mask 24 -j LOG --log-prefix "IN_connlimit_reached "
# Reject if above 8 connections per /24 subnet
-A INPUT -p tcp -m tcp --syn --dport 1935 -m connlimit --connlimit-above 8 --connlimit-mask 24 -j REJECT --reject-with tcp-reset 
-A INPUT -s some_IP -p tcp -m tcp --dport 8085 -j ACCEPT 
-A INPUT -s some_IP -p tcp -m tcp --dport 8084 -j ACCEPT 
-A INPUT -s some_IP -p udp -m udp --dport 1934 -j ACCEPT 
-A INPUT -j REJECT
COMMIT
# Completed on Sat Sep  7 13:25:22 2013

Last edited by unSpawn; 09-07-2013 at 05:50 PM. Reason: //rm duplicate dport
 
Old 09-07-2013, 09:14 AM   #7
007stealth
LQ Newbie
 
Registered: Sep 2013
Posts: 6

Original Poster
Rep: Reputation: Disabled
Thank you thats awesome hopefully that will stop all issues we are having I really appreciate it. One question though it won't let me add the rule with two ports being specified, should I just take out the second --dport 1935 after the --syn?
 
Old 09-07-2013, 05:29 PM   #8
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by 007stealth View Post
hopefully that will stop all issues we are having
It might not but at least now you've got an early warning if connections reach the threshold. Might need adjustment or exclusions if you have a busy server or if you encounter mass requests from one IP address. May be difficult to gauge what actually would be legitimate proxy users.


Quote:
Originally Posted by 007stealth View Post
should I just take out the second --dport 1935 after the --syn?
Yes, my mistake. I'll edit it out of my previous post.
 
  


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
[SOLVED] How to determine port 1935 is open. conflicker Linux - Newbie 4 04-14-2012 03:49 AM
SYN Flooding mosthigh Linux - Security 1 10-26-2009 05:46 AM
kernel: possible SYN flooding on port 2790. Sending cookies. zekmaster Linux - Security 10 08-26-2008 03:02 AM
How do I protect myself against TCP SYN flooding? arkaan Linux - Security 8 04-16-2007 07:54 PM
Possible SYN flooding? gbowden Linux - Security 7 02-08-2007 08:16 AM

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

All times are GMT -5. The time now is 12:21 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