All of lore.kernel.org
 help / color / mirror / Atom feed
* SSH Brute force attacks
@ 2005-05-06 15:57 Brent Clark
  2005-05-06 16:40 ` Mogens Valentin
                   ` (4 more replies)
  0 siblings, 5 replies; 82+ messages in thread
From: Brent Clark @ 2005-05-06 15:57 UTC (permalink / raw)
  To: iptables

Hi All

One one of my hosted boxes, my logwatch scripts continuously pipe out my 
ssh and auth log of unsuccessful dictionary attacks

I came across this link : http://blog.andrew.net.au/2005/02/17/

And seen that it would help me slow (in hope) that malious person done.

Would anyone care to comment / share tips etc on what I have below

iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent --set 
--name SSH
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j SSH_WHITELIST
iptables -A SSH_WHITELIST -s $MYIPADDRESS -m recent --remove --name SSH 
-j ACCEPT
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent 
--update --seconds 60 --hitcount 4 --rttl --name SSH -j LOG --log-prefix 
"SSH BRUTE"
iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent 
--update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP

Kind Regards
Brent Clark


^ permalink raw reply	[flat|nested] 82+ messages in thread
* RE: SSH Brute force attacks
@ 2005-05-06 22:03 Gary W. Smith
  0 siblings, 0 replies; 82+ messages in thread
From: Gary W. Smith @ 2005-05-06 22:03 UTC (permalink / raw)
  To: Brent Clark, iptables

A friend of mine wrote a perl script some time ago that would watch the
log and it a number of occurrences happened over a period of time he'd
block the source IP to the SSH port for a period of time.  He'd also
send himself an email if the threshold hit a certain number from a
particular IP address.

Not sure if this directly helps but I figure it wouldn't hurt.

Gary

> -----Original Message-----
> From: netfilter-bounces@lists.netfilter.org [mailto:netfilter-
> bounces@lists.netfilter.org] On Behalf Of Brent Clark
> Sent: Friday, May 06, 2005 8:58 AM
> To: iptables
> Subject: SSH Brute force attacks
> 
> Hi All
> 
> One one of my hosted boxes, my logwatch scripts continuously pipe out
my
> ssh and auth log of unsuccessful dictionary attacks
> 
> I came across this link : http://blog.andrew.net.au/2005/02/17/
> 
> And seen that it would help me slow (in hope) that malious person
done.
> 
> Would anyone care to comment / share tips etc on what I have below
> 
> iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent
--set
> --name SSH
> iptables -A INPUT -p tcp --dport 22 -m state --state NEW -j
SSH_WHITELIST
> iptables -A SSH_WHITELIST -s $MYIPADDRESS -m recent --remove --name
SSH
> -j ACCEPT
> iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent
> --update --seconds 60 --hitcount 4 --rttl --name SSH -j LOG
--log-prefix
> "SSH BRUTE"
> iptables -A INPUT -p tcp --dport 22 -m state --state NEW -m recent
> --update --seconds 60 --hitcount 4 --rttl --name SSH -j DROP
> 
> Kind Regards
> Brent Clark



^ permalink raw reply	[flat|nested] 82+ messages in thread
* SSH Brute force attacks
@ 2005-05-11 13:20 Alireza Yazdani
  0 siblings, 0 replies; 82+ messages in thread
From: Alireza Yazdani @ 2005-05-11 13:20 UTC (permalink / raw)
  To: netfilter

please introdoction program name for SSH_Brute_Force and Telnet_Brute_Force

Brent Clark <bclark@eccotours.dyndns.org> wrote:Taylor, Grant wrote:
> # Let's jump to the SSH_Brute_Force chain if this is a new connection 
> that is not from my IP address.
> iptables -A INPUT -p tcp --dport 22 -m state --state NEW -s ! 
> $MYIPADDRESS -j SSH_Brute_Force
> # If there have not been 4 NEW connection attempts from this source IP 
> address in the last 60 secons let's return to the INPUT chain.
> iptables -A SSH_Brute_Force -m recent --name SSH ! --rcheck --seconds 60 
> -m recent --hitcount 4 --set --name SSH -j RETURN
> # Well, the NEW connection has been seen so let's update the SSH recent 
> list.
> iptables -A SSH_Brute_Force -m recent --name SSH --update
> # I like to log on a line by it's self so I don't have to remember to do 
> it on my last line prior to the end of my script.
> iptables -A SSH_Brute_Force -j LOG --log-prefix "SSH Brute Force 
> Attempt: "
> # Let's send the person that is trying to SSH in to us to the TARPIT 
> target and make them think twice before they try again.
> # TARPIT will force the site that is SSHing in to us to timeout the 
> connection. Sure stick you hand in my port, I'll grab hold of it and 
> not let go,
> # you will ahve to chew your arm off and grow a new one and try again.
> iptables -A SSH_Brute_Force -j TARPIT
> # I can be a mean vindictive SoB (Sweet Old Buzzard. NOT!)

Hi all

Thanks to Grant for the info above, but for some funny reason I cant get 
the following to work

iptables -A SSH_Brute_Force -m recent --name SSH ! --rcheck --seconds 60 
-m recent --hitcount 4 --set --name SSH -j RETURN

this what I get back:
=====================
[root@abc root]# iptables -A SSH_Brute_Force -m recent --name SSH ! 
--rcheck --seconds 60 -m recent --hitcount 4 --set --name SSH -j RETURN
iptables v1.2.9: Unknown arg `4'
Try `iptables -h' or 'iptables --help' for more information.
[root@ns root]#


Regards
Brent Clark



		
---------------------------------
Do you Yahoo!?
 Yahoo! Mail - You care about security. So do we.

^ permalink raw reply	[flat|nested] 82+ messages in thread
* Re: SSH Brute force attacks
@ 2005-05-11 19:49 zeus
  0 siblings, 0 replies; 82+ messages in thread
From: zeus @ 2005-05-11 19:49 UTC (permalink / raw)
  To: iptables


> iptables -A SSH_Brute_Force -m recent --name SSH ! --rcheck --seconds 60 
> -m recent --hitcount 4 --set --name SSH -j RETURN
> 
> this what I get back:
> =====================
> [root@abc root]# iptables -A SSH_Brute_Force -m recent --name SSH ! 
> --rcheck --seconds 60 -m recent --hitcount 4 --set --name SSH -j RETURN
> iptables v1.2.9: Unknown arg `4'
> Try `iptables -h' or 'iptables --help' for more information.
> [root@ns root]#

Try it with a different target.  For some reason the recent module doesn't like some targets (or no target) when matching on hitcount or seconds.

-Bob


^ permalink raw reply	[flat|nested] 82+ messages in thread
* Re: SSH Brute force attacks
@ 2005-05-19 14:48 info
  2005-05-19 15:01 ` Andrew Schulman
  0 siblings, 1 reply; 82+ messages in thread
From: info @ 2005-05-19 14:48 UTC (permalink / raw)
  To: netfilter

How about this:

1. You will keep one random high port to accept new connection, say 32456.
You box wont listen on that port though.
2. If there have a request on that port, using recent match, you will
accpet new connection in different high port for 1 mintute. say port is
34521
3. You will send new connection request on 34521, again using recent match
you will open port 22 to accept new connection for 1-3 minutes.
4. You will log into your box !!

Mohammmad




Original Message:
-----------------
From: Taylor, Grant gtaylor@riverviewtech.net
Date: Thu, 19 May 2005 09:39:25 -0500
To: netfilter@lists.netfilter.org
Subject: Re: SSH Brute force attacks


> I understand what you are saying, but what was hoping for. Was a 
> solution whereby the src ip is not part of my whitelist.
> 
> For example, I have a dialup account (dynamic ip) at home. If I need to 
> SSH into my linux box from home. I cant because the ip I have been 
> allocted will not be in the whitelist.

Can I ask why you would not be able to get in from your dynamic IP at home?
The rule set will allow (how ever many NEW attempts you designate) to
connect for a specified number of times in a specified amount of time.  You
don't have to have your dynamic IP in the list as any IP will still be able
to initiate NEW connections a few times before the rule starts TARPITing /
DROPing the connection.  There is also the fact that you could configure
your SSH server to listen on a (2nd) port at a higher port number that you
would know about that most people would not.  This port would not be
processed by this script and thus you would be able to connect from
anywhere.



Grant. . . .


--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .




^ permalink raw reply	[flat|nested] 82+ messages in thread
* Re: SSH Brute force attacks
@ 2005-05-19 15:31 info
  0 siblings, 0 replies; 82+ messages in thread
From: info @ 2005-05-19 15:31 UTC (permalink / raw)
  To: netfilter

I don't agree with you.
See this:
http://portknocking.org/view/details


Port knocking can be made even more secure by using 'recent' match and
TARPIT target.

If you send any packet to a port of my server that is not listening to
(other than secret port), you will have to stay quite for 5 minutes to send
another try.
Now, if there have 3 sequential port to get in my server using port
knocking technique, how easy it will be if you fail to provide the sequence
correctly.
You will have just one chace to provide the sequence in every five minutes.
This can be make even harder by having 5 or more sequence of port or by
using TARPIT target.
At the end, if you really can get 22 port open, I will suggest you to spent
one night in Las Vegas and share the winning money at morning with us! :p

Mohammad



Original Message:
-----------------
From: Andrew Schulman andrex@alumni.utexas.net
Date: Thu, 19 May 2005 11:01:24 -0400
To: netfilter@lists.netfilter.org
Subject: Re: SSH Brute force attacks



> How about this:
> 
> 1. You will keep one random high port to accept new connection, say 32456.
> You box wont listen on that port though.
> 2. If there have a request on that port, using recent match, you will
> accpet new connection in different high port for 1 mintute. say port is
> 34521
> 3. You will send new connection request on 34521, again using recent match
> you will open port 22 to accept new connection for 1-3 minutes.
> 4. You will log into your box !!

Port knocking is the same as a plaintext password.
http://software.newsforge.com/software/04/08/02/1954253.shtml



--------------------------------------------------------------------
mail2web - Check your email from the web at
http://mail2web.com/ .




^ permalink raw reply	[flat|nested] 82+ messages in thread

end of thread, other threads:[~2005-07-26  6:18 UTC | newest]

Thread overview: 82+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-06 15:57 SSH Brute force attacks Brent Clark
2005-05-06 16:40 ` Mogens Valentin
2005-05-06 19:29 ` R. DuFresne
2005-05-07  5:14 ` Taylor, Grant
2005-05-10 14:01   ` Eric Wood
2005-05-11 12:35   ` Brent Clark
2005-05-11 18:21     ` Taylor, Grant
2005-05-11 19:04       ` Pete Toscano
2005-05-11 19:15         ` Taylor, Grant
2005-05-11 19:30           ` Pete Toscano
2005-05-11 20:34             ` Jason Opperisano
2005-05-13 21:31               ` okay, I admit confusion here; R. DuFresne
2005-05-13 21:55                 ` Jason Opperisano
2005-05-16 17:40                   ` R. DuFresne
2005-05-16 20:55                     ` Taylor, Grant
2005-05-16 21:05                 ` Taylor, Grant
2005-05-14  7:02               ` SSH Brute force attacks Georgi Alexandrov
2005-05-14 15:47                 ` Jason Opperisano
2005-05-15 20:12                 ` Patrick Nelson
2005-05-17  0:49                   ` Charlie Brady
2005-05-14  9:08       ` Łukasz Hejnak
2005-05-14 19:08         ` Taylor, Grant
2005-05-16  8:16           ` Łukasz Hejnak
2005-05-17  1:05             ` Charlie Brady
2005-05-17  5:00               ` Łukasz Hejnak
2005-05-17  5:19                 ` Łukasz Hejnak
     [not found]                   ` <42898402.10507@eccotours.dyndns.org>
2005-05-17 12:44                     ` Łukasz Hejnak
2005-05-17 13:20                       ` Brent Clark
2005-05-17 13:36                         ` Sadus .
2005-05-17 16:06                           ` Łukasz Hejnak
2005-05-17 15:21                         ` Taylor, Grant
2005-05-18 12:39                       ` Brent Clark
2005-05-19  4:55                         ` Taylor, Grant
2005-05-19  9:05                           ` Brent Clark
2005-05-19 14:39                             ` Taylor, Grant
2005-05-20 13:01                               ` Brent Clark
2005-05-20 14:53                                 ` Taylor, Grant
2005-05-23 16:31                                   ` Brent Clark
2005-06-02 16:13                                     ` Sadus .
2005-06-02 16:43                                       ` Taylor, Grant
2005-06-02 19:18                                         ` Sadus .
2005-06-13 14:39                                           ` Taylor, Grant
2005-06-13 16:17                                             ` Patrick Nelson
2005-06-13 16:27                                             ` /dev/rob0
2005-06-13 19:00                                             ` R. DuFresne
2005-05-18 16:54                       ` Jim Miller
2005-05-18 17:51                         ` Łukasz Hejnak
2005-05-19  2:09                         ` Taylor, Grant
2005-05-21  8:00                       ` Пётр Волков Александрович
2005-05-21 22:37                         ` Taylor, Grant
2005-05-22  7:11                           ` Пётр Волков Александрович
2005-05-22 10:09                           ` Marius Mertens
2005-05-22 10:57                             ` Łukasz Hejnak
2005-05-23 16:14                               ` Taylor, Grant
2005-05-17  6:55               ` Taylor, Grant
     [not found]                 ` <1116333615.24331.4.camel@debianbox>
2005-05-17 15:25                   ` Taylor, Grant
2005-05-23 16:53               ` Taylor, Grant
2005-05-24 16:19                 ` Marius Mertens
2005-05-25  5:35                 ` Brent Clark
2005-05-25  8:48                   ` Marius Mertens
2005-05-25 18:10                   ` Taylor, Grant
2005-05-26 11:17                     ` Brent Clark
2005-05-31  4:12                       ` Taylor, Grant
2005-05-31 10:06                         ` Brent Clark
2005-05-31 14:17                           ` Taylor, Grant
2005-05-28 23:24                 ` Sebastian Siewior
2005-05-29  1:01                   ` Taylor, Grant
2005-05-07  5:32 ` Taylor, Grant
2005-05-08 15:20   ` Alistair Tonner
2005-05-08 18:51     ` Dwayne Hottinger
2005-05-08 22:57       ` Alexander Samad
2005-05-09  5:41         ` Taylor, Grant
2005-05-09  5:46     ` Taylor, Grant
2005-06-02 18:26 ` SSH Brute force attacks - Script version 1.0 Taylor, Grant
2005-07-25 19:41   ` Steven M Campbell
2005-07-26  6:18     ` Jan Engelhardt
  -- strict thread matches above, loose matches on Subject: below --
2005-05-06 22:03 SSH Brute force attacks Gary W. Smith
2005-05-11 13:20 Alireza Yazdani
2005-05-11 19:49 zeus
2005-05-19 14:48 info
2005-05-19 15:01 ` Andrew Schulman
2005-05-19 15:31 info

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.