Re: Some new SSH exploit script?

From: Pete Fuggle (pfuggle@unimelb.edu.au)
Date: Wed Jun 07 2006 - 19:41:02 EDT


Thor (Hammer of God) wrote:
>
>> Changing the port number, is akin, to hiding the door, because your
>> afraid of the lock installed in it. It only raises the bar to the
>> special olympics level.
>>
>> I believe in security in-depth, but this depth is so superficial, I
>> really don't think it's worth it.
>>
>
> No, it's akin to hiding the door in _addition_ to having strong locks on it.
> This subject comes up here from time to time, and it basically always comes
> down to someone saying "it's so trivial that it doesn't matter" and others
> saying "if it helps at all, even if only slightly, then it's a good thing."
>
> I number myself among the latter group- if it raises your fruit higher than
> the guy next to you, then go for it. Changing default listening ports
> immediately obviates you from standard/worm/kiddie traffic. That, in itself
> is a good enough reason for me.

I agree with this, primarily for the reason above, but don't practise
it. Yes it's like hiding the door and yes also, someone who's keen
enough will find the door, trivially.

As someone mentioned earlier, non standard ports do not scale when you
have a significant number of users requiring shell access. So I'll admit
from the outset that nor does my approach.

I use this method for servers that are adminned by only a handful of
people and it works a treat.

http://manpages.debian.net/cgi-bin/display_man.cgi?id=4ea992e84847c4e8fd7ab92c116192d3&format=html

Example knockd.conf:
[SSH]
sequence = x,y,z
seq_timeout = 5
start_command = /sbin/iptables -I INPUT 1 -s %IP% -p tcp --dport 22 -j
ACCEPT
stop_command = /sbin/iptables -D INPUT -s %IP% -p tcp --dport 22 -j ACCEPT
tcpflags = syn
cmd_timeout = 30

Client script:
#!/bin/bash
/usr/bin/knock <hostname> x y z
ssh <hostname>

So in this example, port 22 is opened only if SYN packets directed to
ports x then y then z are seen within a 5 second timeframe. It would
probably be a bad idea to use something like "sequence = 10,11,12" in
this example...

Obviously you can tell knockd to execute whatever command you like upon
seeing a defined sequence of knocks so the possibilities are endless.

Another funky use is to run knockd on a NAT gateway and have different
knock sequences map port 22 through to different internal hosts.

Just an idea... ;)

Pete

>
> We had this discussion over on the ISA list about RDP several months back.
> After that thread, I hosted terminal services and SQL on 2 boxes: one on
> 3389/1433, the other on 53343/43343 respectively for Feb, March and part of
> April. There were something like 45,000 failed RDP logon attemps on 3389,
> and not a single logon attempt (other than from me) on 53343. The SQL
> numbers were almost 200,000 on 1433, and something like 10 on 43343. I was
> actually pretty surprised to see the 10. (I've got the actual numbers on
> the box itself, I might bring it up and get the actual figures if I get
> time).
>
> You can speculate about port-scanning worms, "intelligent" viruses, etc all
> you want, but they're just not being written (yet). Moving my RDP listener
> to 53343 prevented over 45,000 logon attempts. To me, that is not a
> superficial security-in-depth mechanism. There are a million different
> things that *could* have been done, but they just weren't.
>
> I'll continue to host RDP on an alternate port because it provides some
> value, albeit small, to my security in depth strategy.
>
> I also continue to find value in "source port" firewall rules where only
> connections to services initiated from a particular source port are allowed.
> Others have said that practice is also just "security through obscurity" yet
> I think it is a good idea, and it works for me. I use this method to help
> protect access to my production servers for remote RDP access - RDP listens
> on an alternate port, and my ISA server only allows the connection when made
> from a specific source port (I actually use a small range of source ports) -
> there has never even been a connection attempt made (other than from me.)
>
> Given actual data I have collected, I'll continue to use this method as
> well.
>
>
>
> t
>
>
>
> ------------------------------------------------------------------------------
> This List Sponsored by: Cenzic
>
> Concerned about Web Application Security?
> Why not go with the #1 solution - Cenzic, the only one to win the Analyst's
> Choice Award from eWeek. As attacks through web applications continue to rise,
> you need to proactively protect your applications from hackers. Cenzic has the
> most comprehensive solutions to meet your application security penetration
> testing and vulnerability management needs. You have an option to go with a
> managed service (Cenzic ClickToSecure) or an enterprise software
> (Cenzic Hailstorm). Download FREE whitepaper on how a managed service can
> help you: http://www.cenzic.com/news_events/wpappsec.php
> And, now for a limited time we can do a FREE audit for you to confirm your
> results from other product. Contact us at request@cenzic.com for details.
> ------------------------------------------------------------------------------
>

-- 
Peter Fuggle
IT Security Administrator
Information Services
The University of Melbourne
e: pfuggle@unimelb.edu.au
p: +61 3 8344 2785
m: +61 408 674 909




This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:56:03 EDT