Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
New ssh attack?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Carnildo
Guru
Guru


Joined: 17 Jun 2004
Posts: 550

PostPosted: Thu Oct 25, 2007 2:35 am    Post subject: New ssh attack? Reply with quote

In the past few days, I've seen a shift in the pattern of failed ssh login attempts. Normally, I see one or two hosts each trying several hundred usernames. However, starting sometime last Sunday, I've instead been seeing several hundred different hosts each trying to log in as either "root" or "mysql". Is there some new exploit going around?
Back to top
View user's profile Send private message
transient
l33t
l33t


Joined: 13 Jan 2005
Posts: 759
Location: New Zealand

PostPosted: Thu Oct 25, 2007 2:48 am    Post subject: Reply with quote

http://isc.sans.org/diary.html?storyid=3529
Back to top
View user's profile Send private message
padoor
Advocate
Advocate


Joined: 30 Dec 2005
Posts: 3715
Location: india

PostPosted: Thu Oct 25, 2007 6:15 am    Post subject: Reply with quote

how do i check if my computer is being accessed by ssh attack?
i have no firewall installed.
code please
_________________
reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name)
Back to top
View user's profile Send private message
ToeiRei
Veteran
Veteran


Joined: 03 Jan 2005
Posts: 1113
Location: Austria

PostPosted: Thu Oct 25, 2007 6:17 am    Post subject: Reply with quote

Code:
cat /var/log/messages

That thing is called 'syslog'...
_________________
Blog | btrfs | Please stand by - The mailer daemon is busy burning your messages in hell...
Back to top
View user's profile Send private message
padoor
Advocate
Advocate


Joined: 30 Dec 2005
Posts: 3715
Location: india

PostPosted: Thu Oct 25, 2007 10:17 am    Post subject: Reply with quote

thanks ToeiRei
none found.
_________________
reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name)
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5213

PostPosted: Thu Oct 25, 2007 10:35 am    Post subject: Reply with quote

padoor wrote:
how do i check if my computer is being accessed by ssh attack?
i have no firewall installed.
code please


Quote:
grep "`date +'%b %e'`" /var/log/auth.log | grep "Invalid user"
grep "`date +'%b %e'`" /var/log/vsftpd.log | grep "FAIL LOGIN"


should get you all the failed logins for sshd and vsftpd (for today). you can add a "| wc -l" for numbers instead of raw output.

cheers
_________________
goodbye fgo. it was nice knowing you.
Back to top
View user's profile Send private message
padoor
Advocate
Advocate


Joined: 30 Dec 2005
Posts: 3715
Location: india

PostPosted: Thu Oct 25, 2007 10:51 am    Post subject: Reply with quote

localhost sda1 # grep "`date +'%b %e'`" /var/log/auth.log | grep "Invalid user"
grep: /var/log/auth.log: No such file or directory
localhost sda1 # grep "`date +'%b %e'`" /var/log/vsftpd.log | grep "FAIL LOGIN"
grep: /var/log/vsftpd.log: No such file or directory
localhost sda1 # dir /var/log
Xorg.0.log
Xorg.0.log.old
cups
dmesg
emerge-fetch.log
emerge.log
faillog
kdm.log
lastlog
messages
news
portage samba

localhost sda1 #

there is no such login refused or requested except my own newly connected laptop which shows in messages
_________________
reach out a little bit more to catch it (DON'T BELIEVE the advocate part under my user name)
Back to top
View user's profile Send private message
bunder
Bodhisattva
Bodhisattva


Joined: 10 Apr 2004
Posts: 5213

PostPosted: Thu Oct 25, 2007 11:13 am    Post subject: Reply with quote

what's your logger? i use sysklogd... maybe you do have to check /var/log/syslog (or messages like you said,)for these. :?
_________________
goodbye fgo. it was nice knowing you.
Back to top
View user's profile Send private message
Ramblurr
Tux's lil' helper
Tux's lil' helper


Joined: 18 Dec 2006
Posts: 103

PostPosted: Thu Oct 25, 2007 12:30 pm    Post subject: Reply with quote

This is a useful program.. I've used it for some time now, and it works well.

"BlockSSHD is a Perl script based on BruteForceBlocker v1.2.3 that dynamically adds IPTables rules for Linux and pf firewall rules for BSD that block SSH brute force attacks. It can also detect ProFTPd login failures."
http://blocksshd.sourceforge.net/
Back to top
View user's profile Send private message
ToeiRei
Veteran
Veteran


Joined: 03 Jan 2005
Posts: 1113
Location: Austria

PostPosted: Thu Oct 25, 2007 12:49 pm    Post subject: Reply with quote

another way would be disabling password logins and using keys.

Rei
_________________
Blog | btrfs | Please stand by - The mailer daemon is busy burning your messages in hell...
Back to top
View user's profile Send private message
Corvinian
n00b
n00b


Joined: 07 Sep 2007
Posts: 42
Location: Europe

PostPosted: Thu Oct 25, 2007 3:48 pm    Post subject: Move your port! Reply with quote

Consider moving your SSH-port, this way I have reduced 99,99% of all brute-forcing attempts!
Others who did this can confirm, too.

And you get it for free! :-)

Please read this:
http://www.ossec.net/en/attacking-loganalysis.html

additionally use public-keys,
disallow direct root-access, allow only 'su' to root.
root is by far the most often tried brute-force account!

I can highly recommend 'fail2ban', it has no weaknesses as its comparing program 'denyhosts', which has exploitable weaknesses discovered every month (or so), and still new ones get known frequently.

http://www.fail2ban.org/wiki/index.php/Features

fail2ban can protect ALL services, not just SSH. It has DOS-protection, so somebody spoofing your
IP-address cannot block/deny you administrative SSH-access. You can centrally gather/aggregate fail2ban-data from all your hosts/servers...

Maybe OSSEC can do this too, but I need to evaluate it myself first, seems to be similar to Samhain and OSIRIS: http://www.ossec.net

"OSSEC is a scalable, multi-platform, open source Host-based Intrusion Detection System (HIDS). It has a powerful correlation and analysis engine, integrating log analysis, file integrity checking, centralized policy enforcement, rootkit detection, real-time alerting and active response."

HTH, Corvinian
Back to top
View user's profile Send private message
Carnildo
Guru
Guru


Joined: 17 Jun 2004
Posts: 550

PostPosted: Thu Oct 25, 2007 6:58 pm    Post subject: Reply with quote

Ramblurr wrote:
This is a useful program.. I've used it for some time now, and it works well.

"BlockSSHD is a Perl script based on BruteForceBlocker v1.2.3 that dynamically adds IPTables rules for Linux and pf firewall rules for BSD that block SSH brute force attacks. It can also detect ProFTPd login failures."
http://blocksshd.sourceforge.net/


BlockSSHD, Fail2ban, and Denyhosts are all useless against the current attack. When each host only tries one username/password combination, it's not useful to identify it as a brute-force attack, because you can't tell who will try the next combination.
Back to top
View user's profile Send private message
Ramblurr
Tux's lil' helper
Tux's lil' helper


Joined: 18 Dec 2006
Posts: 103

PostPosted: Thu Oct 25, 2007 7:43 pm    Post subject: Reply with quote

It isn't always convenient but changing the port your SSHD listens on helps a lot. Of course a port scan will reveal which port it is running on. Using keys instead of passwords is (as others have said) a good solution.

Another solution would be to implement a port knocker. See net-misc/knock from http://www.zeroflux.org/knock/
Back to top
View user's profile Send private message
Corvinian
n00b
n00b


Joined: 07 Sep 2007
Posts: 42
Location: Europe

PostPosted: Sat Oct 27, 2007 8:01 am    Post subject: Single Packet Authorization (SPA) Reply with quote

Portknocking sequences can be easily captured and replayed.

A solution to this could be 'Single Packet Authorization (SPA)' => looks quite promising!
http://www.cipherdyne.org/fwknop/

a quote:
Single Packet Authorization retains the benefits of Port Knocking (i.e. service protection behind a default-drop packet filter), but has the following advantages over Port Knocking:

SPA can utilize asymmetric ciphers for encryption. Asymmetric ciphers typically have larger key sizes than symmetric ciphers, and the data transmission rate of port knocking (which uses packet headers instead of packet payloads) is not sufficient to effectively use an asymmetric cipher. SPA is compatible with 2048-bit Elgamal GnuPG keys.

SPA packets are non-replayable. There are strategies (such as S/Key-style iteration of a hash function) used by port knocking implementations to reduce the danger of a replayed knock sequence, but these strategies are relatively brittle and not generally very scalable to lots of users.

SPA cannot be broken by trivial sequence busting attacks. For any attacker who can monitor a port knocking sequence, the sequence can be busted by simply spoofing a duplicate packet (as though it comes from the source of the real sequence) to the previous port in a sequence.

SPA only sends a single packet over the network, and hence does not look like a port scan to any intermediate IDS that may be watching.

SPA is much faster because it only sends a single packet. Port knocking implementations must build in time delays between successive packets because there is no guarantee of in-order delivery.

But I haven't come around testing it.

Corvinian
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum