🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: alt.privacy.anon-server
16 messages
16 total messages Started by inwtx Fri, 04 Dec 2020 14:25
SYN-Attack-Suppressor-Routine
#312151
Author: inwtx
Date: Fri, 04 Dec 2020 14:25
6 lines
833 bytes
  I have placed out my SYN-Attack-Suppressor-Routine
again.  It has been running on my servers for over a
year now without problems.

https://github.com/inwtx/SYN-Attack-Suppressor-Routine
Re: SYN-Attack-Suppressor-Routine
#312174
Author: Anonymous
Date: Mon, 07 Dec 2020 00:20
10 lines
1152 bytes
In article <rqdgsu$ftl$1@news.mixmin.net>
"inwtx" <noreply@inwtx.net> wrote:
>
>   I have placed out my SYN-Attack-Suppressor-Routine
> again.  It has been running on my servers for over a
> year now without problems.
>
> https://github.com/inwtx/SYN-Attack-Suppressor-Routine

Thanks!
Re: SYN-Attack-Suppressor-Routine
#312182
Author: Anonymous
Date: Mon, 07 Dec 2020 03:43
16 lines
1152 bytes
In article 
<32b7fcdea6a1024725aaa9abdb457a25@remailer.paranoici.org>
Anonymous <nobody@remailer.paranoici.org> wrote:
>
> In article <rqdgsu$ftl$1@news.mixmin.net>
> "inwtx" <noreply@inwtx.net> wrote:
> >
> >   I have placed out my SYN-Attack-Suppressor-Routine
> > again.  It has been running on my servers for over a
> > year now without problems.
> >
> > https://github.com/inwtx/SYN-Attack-Suppressor-Routine
>
> Thanks!

Need one of those for Windows.
Re: SYN-Attack-Suppressor-Routine
#312197
Author: inwtx
Date: Mon, 07 Dec 2020 23:18
11 lines
1071 bytes
> 
> I have placed out my SYN-Attack-Suppressor-Routine
> again.  It has been running on my servers for over a
> year now without problems.
> 
> https://github.com/inwtx/SYN-Attack-Suppressor-Routine

  I have added a script that creates a Dashboard for
monitoring the SYN-Attack-Suppressor-Routine activate.

https://github.com/inwtx/SYN-Attack-Suppressor-Routine-Dashboard
Re: SYN-Attack-Suppressor-Routine
#312196
Author: Grant Taylor
Date: Tue, 08 Dec 2020 01:29
16 lines
1518 bytes
On 12/4/20 7:25 AM, inwtx wrote:
> I have placed out my SYN-Attack-Suppressor-Routine again.  It has 
> been running on my servers for over a year now without problems.

I'm curious.

How many SYN floods have you experienced?  How bad where they?  How many 
half open connections did you have?  Did Linux's native TCP Syncookie 
protection (net.ipv4.tcp_syncookies) not suffice?  Why did you feel the 
need to create your own solution?



-- 
Grant. . . .
unix || die
Re: SYN-Attack-Suppressor-Routine
#312203
Author: inwtx
Date: Tue, 08 Dec 2020 14:19
34 lines
2059 bytes
> 
> On 12/4/20 7:25 AM, inwtx wrote:
> 
>> I have placed out my SYN-Attack-Suppressor-Routine again.  It has been running on my servers for over a year now without problems.
> 
> I'm curious.
> 
> How many SYN floods have you experienced?  How bad where they?

  Before I wrote this program, I would have several attacks a day.  Some running many hours.

>  How many half open connections did you have?

  As many as 10 to 70+.

>  Did Linux's native TCP Syncookie protection (net.ipv4.tcp_syncookies) not suffice?

  I am not familar with Syncookie protection.  If it is a part of
the kernel, it didn't make for any relief.  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

> Why did you feel the need to create your own solution?

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

  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.
Re: SYN-Attack-Suppressor-Routine
#312207
Author: 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
Re: SYN-Attack-Suppressor-Routine
#312211
Author: inwtx
Date: Wed, 09 Dec 2020 01:26
39 lines
2397 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.
> 
  Actually 10 to 70 is the amount I will sometimes see before
my routine blocks it.  Before I started using it, I would see
SYN connections in the thousands.  SYN attacks don't actually
have anything to do with number of connections.  SYN attacks
just keep making connections until a server breaks down.  That
is unless you have some kind of routine to automatically shut
an attack down.  I used to just monitor to see if an attack
was happening and then manually block the IP.  The most I saw
before I manually blocked it was 3600 connections.  That was
my first attack.  It was some punk in Belize.  It was a legitimate
IP and I reported him to his ISP.  He seemed to be enraged that I
blocked him and began to hit me the next morning from an open
server in one of the baltic states.  That was the end of him.

  I have never had a denial of service attack, but to live in
fear of provoking one by shutting down SYN attacks won't work
with me.  DOSs don't last forever and can't really affect the
remailer system due to multiple chains.

  This system has worked perfectly for me.  It usually shuts
down an attack after 2 to 3 SYNs with no acknowledge.  It can't
cause a problem with my remailers because all remailer IPs are
ACCEPTed prior to the SYN-DROP-ROUTINE.

become enraged
Re: SYN-Attack-Suppressor-Routine
#312216
Author: inwtx
Date: Wed, 09 Dec 2020 01:31
5 lines
798 bytes
> 
> become enraged

  Disregard the above at the end of the last message.
I must have hit paste accidentally. 
Re: SYN-Attack-Suppressor-Routine
#312217
Author: inwtx
Date: Wed, 09 Dec 2020 01:45
9 lines
1033 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?
> 
  Forgot to answer this one.  No negative system performance.
The routine shuts the attacks down too quickly.
Re: SYN-Attack-Suppressor-Routine
#312212
Author: Grant Taylor
Date: Wed, 09 Dec 2020 05:35
56 lines
3518 bytes
On 12/8/20 6:26 PM, inwtx wrote:
> Actually 10 to 70 is the amount I will sometimes see before my routine 
> blocks it.> Before I started using it, I would see SYN connections 
> in the thousands.

Ah.  That makes more sense.

> SYN attacks don't actually have anything to do with number of 
> connections.  SYN attacks just keep making connections until a 
> server breaks down.

SYN flood attacks do consume resources.  Specifically (pre)connection 
state entries.  The connection state entries are a finite resource. 
Hence how it's possible to consume them and perform a denial of service.

Linux's Syncookies, when enabled and active, DON'T consume 
(pre)connection state entries.  Hence how they protect the system.

> That is unless you have some kind of routine to automatically shut an 
> attack down.  I used to just monitor to see if an attack was happening 
> and then manually block the IP.  The most I saw before I manually 
> blocked it was 3600 connections.  That was my first attack.  It was 
> some punk in Belize.  It was a legitimate IP and I reported him to 
> his ISP.  He seemed to be enraged that I blocked him and began to hit 
> me the next morning from an open server in one of the baltic states. 
> That was the end of him.

It sounds like it was more of a DoS than a DDoS.

A full on SYN flood attack may send one SYN from hundreds of thousands 
of different IPs in a bot net.

> I have never had a denial of service attack, but to live in fear 
> of provoking one by shutting down SYN attacks won't work with me. 
> DOSs don't last forever and can't really affect the remailer system 
> due to multiple chains.
> 
> This system has worked perfectly for me.  It usually shuts down 
> an attack after 2 to 3 SYNs with no acknowledge.  It can't cause a 
> problem with my remailers because all remailer IPs are ACCEPTed prior 
> to the SYN-DROP-ROUTINE.

Now my mind is wondering about using IPTables "recent" match extension. 
Increment upon Seeing a SYN and then decrement when you see an 
associated ACK.  Thus providing a very near real time protection. 
Though you would need to be mindful of how many entries live in a recent 
table.  (I think it can be a really big number.)  Remember to account 
for subsequent ACKs and not artificially lower the count.

Thank you for the additional real world information inwtx.



-- 
Grant. . . .
unix || die
Re: SYN-Attack-Suppressor-Routine
#312213
Author: inwtx
Date: Wed, 09 Dec 2020 12:33
13 lines
1387 bytes
> 
> Linux's Syncookies, when enabled and active, DON'T consume (pre)connection state entries.  Hence how they protect the system.

  I remember now reading about Syncookies when I had my first attack.
I found an iptables entry that took care of attacks then, but only it worked
for single unchanging IP addresses.  I read about Syncookies, but decided
to not go that path because of some objections that were discussed about
using them.  It may have been about the loss of the 'esoteric TCP options'
you mentioned.  I couldn't understand Syncookies at those personal early
Linux days also.

  This is interesting, 'IPTables "recent" match extension'.  I'll look
into it.
Re: SYN-Attack-Suppressor-Routine
#312214
Author: Nomen Nescio
Date: Wed, 09 Dec 2020 14:40
29 lines
3076 bytes
> 
> On 12/8/20 6:26 PM, inwtx wrote:
> 
>> Actually 10 to 70 is the amount I will sometimes see before my routine blocks it.> Before I started using it, I would see SYN connections in the thousands.
> 
> Ah.  That makes more sense.
> 
> 
>> SYN attacks don't actually have anything to do with number of connections.  SYN attacks just keep making connections until a server breaks down.
> 
> SYN flood attacks do consume resources.  Specifically (pre)connection state entries.  The connection state entries are a finite resource. Hence how it's possible to consume them and perform a denial of service.
> 
> Linux's Syncookies, when enabled and active, DON'T consume (pre)connection state entries.  Hence how they protect the system.
> 
> 
>> That is unless you have some kind of routine to automatically shut an attack down.  I used to just monitor to see if an attack was happening and then manually block the IP.  The most I saw before I manually blocked it was 3600 connections.  That was my first attack.  It was some punk in Belize.  It was a legitimate IP and I reported him to his ISP.  He seemed to be enraged that I blocked him and began to hit me the next morning from an open server in one of the baltic states. That was the end of him.
> 
> It sounds like it was more of a DoS than a DDoS.
> 
> A full on SYN flood attack may send one SYN from hundreds of thousands of different IPs in a bot net.
> 
> 
>> I have never had a denial of service attack, but to live in fear of provoking one by shutting down SYN attacks won't work with me. DOSs don't last forever and can't really affect the remailer system due to multiple chains.
>>
>> This system has worked perfectly for me.  It usually shuts down an attack after 2 to 3 SYNs with no acknowledge.  It can't cause a problem with my remailers because all remailer IPs are ACCEPTed prior to the SYN-DROP-ROUTINE.
> 
> Now my mind is wondering about using IPTables "recent" match extension. Increment upon Seeing a SYN and then decrement when you see an associated ACK.  Thus providing a very near real time protection. Though you would need to be mindful of how many entries live in a recent table.  (I think it can be a really big number.)  Remember to account for subsequent ACKs and not artificially lower the count.
> 
recent will not work here. recent requires like ip addresses. the problem here is that the attack addresses are continuously changing.
Re: SYN-Attack-Suppressor-Routine
#312215
Author: Grant Taylor
Date: Wed, 09 Dec 2020 16:56
16 lines
1627 bytes
On 12/9/20 5:33 AM, inwtx wrote:
> This is interesting, 'IPTables "recent" match extension'.  I'll look 
> into it.

I personally really like the IPTables "recent" match extension.  It's 
possible to do a LOT of different things.  Any question that you could 
ask "did this recently happen?" where how recent is user defined.  E.g. 
did "did this IP send me more than X SYN packets in the last Y time?" 
Or "has this IP tried to connect  to my SSH server X or more times in 
the last Y minutes?"



-- 
Grant. . . .
unix || die
Re: SYN-Attack-Suppressor-Routine
#312218
Author: Grant Taylor
Date: Wed, 09 Dec 2020 16:58
19 lines
1703 bytes
On 12/9/20 7:40 AM, Nomen Nescio wrote:
> recent will not work here. recent requires like ip addresses. the 
> problem here is that the attack addresses are continuously changing.

First, inwtx's description makes it sound like one or a small handful of 
IPs is all that he needed to deal with.

Second, recent can match on a netmask (user defined how big) or simply 
independent of IPs.  E.g. have there been more than 1000 SYN packets 
(from anywhere) in the last minute.

Recent is a generic match extension that can do a LOT of things.




-- 
Grant. . . .
unix || die
Re: SYN-Attack-Suppressor-Routine
#312219
Author: inwtx
Date: Wed, 09 Dec 2020 18:32
21 lines
1709 bytes
> 
> On 12/9/20 7:40 AM, Nomen Nescio wrote:
> 
>> recent will not work here. recent requires like ip addresses. the problem here is that the attack addresses are continuously changing.
> 
> First, inwtx's description makes it sound like one or a small handful of IPs is all that he needed to deal with.

  That is correct.  In face, if just 1 SYN doesn't send an
acknowledgement (hanging the network with SYN/SYN ACK), the
left most IP position of that IP address is blocked (for 1
hour on my system) in iptables.  This is not the best idea
for websites dispensing webpages and other information, but
for a remailer system, it works well.  All remailers get
passed through with iptable ACCEPT entries above the
MY_SYN_DROP chain.

> 
> Second, recent can match on a netmask (user defined how big) or simply independent of IPs.  E.g. have there been more than 1000 SYN packets (from anywhere) in the last minute.
> 
> Recent is a generic match extension that can do a LOT of things.
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads