🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #312207

Re: SYN-Attack-Suppressor-Routine

#312207
From: Grant Taylor
Date: Tue, 08 Dec 2020 17:41
78 lines
4503 bytes
On 12/8/20 7:19 AM, inwtx wrote:
> Before I wrote this program, I would have several attacks a day. 
> Some running many hours.

Did any of them cause any adverse effect on your system's performance?

> As many as 10 to 70+.

I think we have vastly different ideas of what a SYN flood attack is.

I think of an attack as being 100 times that many.

I administer some servers that have 10 to 70 legitimate connections 
starting at the same time.  With thousands of established connections.

> I am not familar with Syncookie protection.  If it is a part of 
> the kernel, it didn't make for any relief.

Syncookie protection is disabled by default for various minutia.  You 
must enable it via a proc / sysctl setting.  Much like forwarding.

Though 10 - 70 connections isn't enough to even trigger the low bar.

> This may be because of the continuous rotation of the attack 
> IP numbers.  I first used an iptables instruction to stop them. 
> That won't work anymore with the IP rotations

Syncookies don't care what the IP address is.  They encode parameters of 
the SYN in the fields that are sent back as the SYN+ACK and then ignore 
the SYN.  When the 3rd packet (the ACK) of the TCP 3-way handshake comes 
back in, the original encoded values are extracted from the ACK.  If 
they don't match, the connection is not established.  This means that 
there is nothing to be remembered / no state when using Syncookies.  It 
pushes the state off to the client.  (Yes, it's cryptographically verified.)

Syncookies will scale to thousands / 10s of thousands / 100s of 
thousands of SYN connections with no problem.

10 - 70 half open connections doesn't even show up as a blip on the radar.

Aside:  The reason that Syncookies are disabled by default, and have a 
low water mark before engaging, is because they can prevent the use of 
some esoteric TCP options.  And purists want those options.  Even though 
things work just fine without them.  Especially while protecting from a 
SYN attack of multiples of thousands of SYNs per second.

> Why do mountain climbers climb a mountain?  Because it's there. 
> I am a software engineer, so I engineer software.

My main concern is that you are settings yourself up to DoS yourself and 
shoot yourself in the foot.  Modifying iptables is a blocking operation. 
  The entire iptables set is a monolithic blob.  That means that every 
time you add or remove an entry, you are moving the entire blob into / 
out of the kernel.  This is normally not a problem with small iptables 
rulesets and / or infrequent change.  But when you have more rules and / 
or more frequent changes, you can end up blocking things and slowing 
down server operation.

This potentially risky operation vs enabling what's in the kernel 
already.  Especially considering that the built in option doesn't 
require maintaining any state.  As opposed to iptables, which is nothing 
but state.

> Because nothing else I tried would stop the attacks.  This did. 
> I rarely get attacks now.  Had 3 within the last weeks, 1 on one day 
> and 2 on another.  I am not sure if the attackers can determine if 
> their attack is not working, but they do seem to give up on an attack 
> rather quickly.  Running the script seems to stop all attacks.

To each their own.

Thank you for the response.



-- 
Grant. . . .
unix || die
Technical Details
Message-ID: <rqoe1o$ae4$1@tncsrv09.home.tnetconsulting.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <rqml4m$2dm$1@tncsrv09.home.tnetconsulting.net> <rqo20o$5gf$1@news.mixmin.net>

Show Full Headers
Complete Article Headers
Message-ID: <rqoe1o$ae4$1@tncsrv09.home.tnetconsulting.net>
Subject: Re: SYN-Attack-Suppressor-Routine
Date: Tue, 8 Dec 2020 10:41:12 -0700
From: Grant Taylor <gtaylor@tnetconsulting.net>
References: <rqml4m$2dm$1@tncsrv09.home.tnetconsulting.net> <rqo20o$5gf$1@news.mixmin.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: alt.privacy.anon-server
Organization: TNet Consulting
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Date: Tue, 8 Dec 2020 17:44:24 -0000 (UTC)
Injection-Info: tncsrv09.home.tnetconsulting.net; posting-host="alpha.home.tnetconsulting.net:198.18.18.251"; logging-data="10692"; mail-complaints-to="newsmaster@tnetconsulting.net"
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0
In-Reply-To: <rqo20o$5gf$1@news.mixmin.net>
Content-Language: en-US
Lines: 77