Slashdot Mirror


Rundown on SSH Brute Force Attacks

An anonymous reader writes "Whitedust has a very interesting article on the recent SSH brute force attacks. The article goes into depth on how to monitor these attackes and to report them to the authorities. It also discusses various tools that are available. According to the article, mostly compromised Linux systems from outside of North America are responsible for the attacks. Even the author's DSL connection was getting break-in attempts."

360 comments

  1. Re:Linux is still a secure OS tho, by Stevyn · · Score: 1

    Since it's a brute force attack and not using some bug that's been known but not patched for months, I'd say so. However, this is about SSH, not Linux so it's irrelevant.

  2. As always... by jsight · · Score: 5, Informative

    If possible, restrict access by source IP address, limit the user accounts w/ SSH access, and don't allow remote root logins.

    Another step to improve security if there are very few users is just to ONLY allow public key authentication. I've never seen such a box compromised remotely.

    1. Re:As always... by justMichael · · Score: 5, Insightful
      limit the user accounts w/ SSH access, and don't allow remote root logins.
      I tend to think of this in a slightly different direction.

      Use AllowUers and only have acocunts that I want logging in. If some package/whatever creates an account and I don't know, it can't be exploited.

      Any login not in that list just gets a Password: promt over and over...

      If my sshd_config gets changed I'm probably going to know.

      The article states "200 to 300 times per day"...

      This is only one box out of 63 for one day:
      Authentication Failures:
      unknown (xxxx.ip.secureserver.net): 2214 Time(s)
    2. Re:As always... by Anonymous Coward · · Score: 1, Insightful

      I got those aswell a while back when I changed my ssh port, the scripts stopped working.

      security thru obscurity -> let the ssh deamon listen to a different port, most* automated scripts will fail.

      *not for so far I've seen.

      It's not the best security, but it will work fine if you're not a big player. And it will make it a bit harder for the scriptkiddies.

      [use this advice it at your own risk]

    3. Re:As always... by ben_white · · Score: 3, Interesting

      I had my home machine compromised this way. I have only 3 users on my home box, and choose all passwords myself to keep them strong. One night I was working on getting a backup system up and created an account backup with the excellent password "backup." I fully intended to change the password and disable remote logins for this account once I got it working. It was getting late, and I just didn't do it prior to hanging it up for the night. The next morning I had found the password had been changed to that account, and reviewing the bash log was able to trace what the intruder had done (ie root kit attempts, using my machine to run further automated attacks on other ip blocks). These weren't very sophisticated blokes, as their changing the password that was my tipoff that I had been cracked.

      I take security seriously, but a momentary lapse of judgement, and my machine was compromised. If the idiots hadn't changed the password I might not have noticed for several days. Just an illustration of how vulnerable the internet is, even if you think you are careful and know what you are doing.

      Ben

      --
      cheers, ben

      Never miss a good chance to shut up -- Will Rogers
    4. Re:As always... by MyDixieWrecked · · Score: 3, Informative

      I run a webserver out of my room for a dozen or so of my friends.

      I've just started disabling shell access to the users of my system by default. If they want to log in with ssh, they have to explicitly enable it from the web-based front-end.

      I tried forcing public-key authentication, but I kept running into trouble when I was away from home and needed to log in from someone else's computer.

      I've got some explicit rules in iptables, also, where I've been blocking entire IP blocks (ie- I've got several countries blocked completely). Whenever I notice a string of failed login attempts, I do an ARIN lookup of that IP block. So far, nearly every attack has come from korea, so I 've been blocking off those addresses as they come.

      I should probably only allow ssh access to american addresses... I know one should always make time for security, but I just haven't had the time to look into how to do that.

      also, I've got root login enabled only because I've got a backup script running that mirrors /home and a couple other directories over to my backup server. But root has a very, very strong password. took me weeks to memorize it.

      --



      ...spike
      Ewwwwww, coconut...
    5. Re:As always... by SlightOverdose · · Score: 4, Interesting

      One of my clients had apache running as root, and an attacker was able to create a new account on the system via a hole in a php script.

      The attacker then tried about 50 times to login to the new account via ssh, but wasn't in AllowUsers. Eventually the idiot gave up- most likely a script kiddie who didn't realise the potential of his initial attack.

      Moral of the story? AllowUsers is a really good idea :-P

    6. Re:As always... by Anonymous Coward · · Score: 0

      Disallowing remote root logins isn't going to help keep people from brute-forcing SSH. It just means they can't brute-force root. Since root usually has the best password, I'm not sure that's really important.

      Speaking of which, why is it said not to login as root over SSH? The only plausible reason I've ever heard is that the encryption is stronger after the login is complete, so your root password is safer if you 'su' to root after logging into another account. But nobody worries about any of their other account passwords using the initial encryption, or takes any steps to protect them, so that is a bogus argument to me.

      Besides the general model of using root as seldom as possible...I just don't understand why you wouldn't login directly as root.

    7. Re:As always... by Anonymous Coward · · Score: 0

      AllowUsers is awesome.

      For a while now, I have been trying to figure out how to limit ssh access to only specific users on a system, and this is exactly what I needed. I guess I could have RTFM, but that would have been to easy.

      Anyway, thanks for your post... very helpful

    8. Re:As always... by SlightOverdose · · Score: 3, Insightful

      If you do this, avoid port 2222. Everyone that changes the sshd port uses it, and pretty quick the script kiddies will catch on and scan that port as well.

    9. Re:As always... by clymere · · Score: 3, Informative

      try putting your public keys on a usb thumb drive. Toss putty on there as well, and you've got what you need no matter where you're at ;)

      --
      once you go slack, you never go back
    10. Re:As always... by makomk · · Score: 2, Informative

      Disallowing remote root logins isn't going to help keep people from brute-forcing SSH. It just means they can't brute-force root. Since root usually has the best password, I'm not sure that's really important.

      Perhaps, but root is the obvious target - it's both the most powerful account, and the only one that exists on all systems. With user accounts, there's the problem of guessing a valid account name.

    11. Re:As always... by Homology · · Score: 4, Informative
      If possible, restrict access by source IP address, limit the user accounts w/ SSH access, and don't allow remote root logins.

      Another step to improve security if there are very few users is just to ONLY allow public key authentication. I've never seen such a box compromised remotely.

      No kidding? By disallowing password authentication you've stopped the script kiddies dead in their tracks. As for disallowing root access, here are some words from an OpenBSD developer:

      ... All unmitigated horseshit. Sorry. Look I use sudo, and I like it. but it is no substitute for allowing root login to a box, and is no substitute for "su", Sorry. They are different. I don't want to add a billion sudoable local accounts to run boxen in a distributed authentication environment. I want "root" local, and be done with it. I want root exposed if someone knows the root password, not if someone knows the root password or fourteen other idiot's passwords that are used every day. That's not more secure. If you want a useful diff to help stop this ridiculous discussion from propping up every little while. Here's what I propose: ....

      Saying "don't login as root" is horseshit. It stems from the days when people sniffed the first packets of sessions so logging in as yourself and su-ing decreased the chance an attacker would see the root pw, and decreast the chance you got spoofed as to your telnet host target, You'd get your password spoofed but not root's pw. Gimme a fucking break. this is 2005 - We have ssh, used properly it's secure. used improperly none of this 1989 bullshit will make a damn bit of difference. -Bob

    12. Re:As always... by MyDixieWrecked · · Score: 1

      that's actually a good idea... I honestly never thought of that.

      have thumb drives improved at all in the last 5 years?

      I got one when they first came out (a 32mb one). It would frequently erase itself. I'd put it in and it would be called "Untitled" and have no files on it.

      I didn't have anything important on it. Just some Hotline bookmarks and a hotline client for mac and windows.

      --



      ...spike
      Ewwwwww, coconut...
    13. Re:As always... by fa2k · · Score: 1

      lol, I added AllowUsers fa2k,tflp (didn't RTFM) Now my box is extremely safe, but I just hope I don't have to do maintenance on it :S

    14. Re:As always... by Wonko · · Score: 2, Informative

      try putting your public keys on a usb thumb drive. Toss putty on there as well, and you've got what you need no matter where you're at ;)

      First of all, your public key goes onto the server you are logging into. You need your private key on the client.

      Second, it isn't very secure to use your private key from an untrusted machine. What you want to use from untrusted machines are one time passwords.

    15. Re:As always... by Anonymous Coward · · Score: 0

      But think about it cryptographically for a minute: if you are relying on the difficulty of guessing a username/password combo, why not just add a couple of bits to the keyspace of your password? Both solutions are cryptographically equivalent to each other.

      An obscure username, while obscure, only has the effect of increasin keyspace. And it's not as good, because it is less likely to remain secure. Your username is likley to be revealed occasionally and it may be easily guessed anyway... a few extra bits on your password is neither.

    16. Re:As always... by Ann+Elk · · Score: 4, Informative
      Moral of the story? AllowUsers is a really good idea :-P

      And running Apache as root is a Really Bad Idea (tm).

    17. Re:As always... by Tony+Hoyle · · Score: 1

      I get dictionary attacks against ssh regularly. Guessing a valid account isn't that hard on larger systems.

    18. Re:As always... by feronti · · Score: 5, Informative

      Speaking of which, why is it said not to login as root over SSH? The only plausible reason I've ever heard is that the encryption is stronger after the login is complete, so your root password is safer if you 'su' to root after logging into another account.

      I think it may be due to an old vulnerability. In versions of OpenSSH earlier than 2.5, you can discover the length of the password using traffic analysis. Basically you look for the following sequence of packets:

      C: 1 packet (s)
      S: 1 packet (echo s)
      C: 1 packet (u)
      S: 1 packet (echo u)
      C: 1 packet (newline)
      S: 1 packet (echo newline)
      S: 10 packets ("Password: ")
      C: x packets (the password)
      C: 1 packet (newline)
      S: 1 packet (echo newline)
      Basically, since the x packets aren't echoed, we know that they are the password. We don't know the contents of the packets, but we now know the length of the password, which can help tremendously in brute force and dictionary attacks (we can eliminate a huge portion of the search space by only searching passwords of length x).

      This technique worked for both SSH-1 and SSH-2 protocols. For more detail, (and a better, more accurate description of how the vulnerability worked) you can read the original security advisory.

      Another problem with logging in directly as root is that you no longer can audit who is logging in as root in an environment where multiple users have root access.

    19. Re:As always... by kasperd · · Score: 1

      If some package/whatever creates an account and I don't know, it can't be exploited.

      How could it possibly be exploited? As long as the password field is * or !! and there is no authorized_keys file, then you can't login using ssh.

      --

      Do you care about the security of your wireless mouse?
    20. Re:As always... by runderwo · · Score: 1
      Not allowing remote root logins is a dubious security improvement. On the one hand, yes, it does require you to obtain two passwords instead of one to gain root access. On the other hand, how secure is the typical admin's user account password versus the root password? If you gain access to any account used to su to root, you've effectively gotten root.

      So to me, it only makes sense to recommend disallowing remote root logins *in conjunction with* attaching a password of equivalent obscurity to the root password on any account used to become root.

    21. Re:As always... by jonored · · Score: 1

      Well, it's not so doom if you are carrying your own software around, as well - to compromise, they'd need to actively scan a program that wasn't on the machine before for a decrypted private key. Also, it strikes me that it wouldn't be horrendous to construct yourself a script that would create a new keypair for you, encrypt it with a password that you only use for those (because the computer would need to have it stored), and put the private on the thumb drive and the public into authorized_keys, replacing the old one. Have it run every time that hotplug detects that particular thumb drive, and you're good. A new keypair to use from untrusted computers within by just having your thumb drive plugged in for a bit. If I didn't have a laptop to keep my keys, programs, etc. on, I'd probably go ahead and implement that now...

    22. Re:As always... by Anonymous Coward · · Score: 0

      I get these attempts on my 56k modem. I've since changed to passwordless crypto auth on all of my machines, except my OpenBSD router, where the outside world can't even connect to SSH.

      I kind of miss the ability to remote login from anywhere in the world, but I'm willing to give that up for extra security.

    23. Re:As always... by pauljlucas · · Score: 1
      Another step to improve security if there are very few users is just to ONLY allow public key authentication.
      But then your machine is no more secure than the machine somebody is ssh-ing from. If that machine is compromised, then so is yours.
      --
      If you reply, do so only to what I explicitly wrote. If I didn't write it, don't assume or infer it.
    24. Re:As always... by Basje · · Score: 1

      Is there a way to implement one time passwords with ssh?

      I wouldn't mind carrying around a slip of paper with 50 or so generated passwords, to login to my server. I'd cross off one at a time, each time only allowing the next one to be able to login some maintenance account.

      --
      the pun is mightier than the sword
    25. Re:As always... by arivanov · · Score: 2, Insightful

      If you took security seriously you would have disabled passwords for ssh in first place. Anyone who allows a conventional password based login on an internet facing system via ssh deserves everything he gets. After all this means that he/she did not bother to learn how to use it. It is the same as buying a Ferrari and driving it only fist gear.

      If you want to access your home PC use RSA/DSA keys instead. This cuts out all brute force attacks once and for all.

      Alternatively use PAM/RADIUS and SecureID. You can buy managed SecureID service for under 100$ per token per year. Costs money, but works fairly well.

      --
      Baker's Law: Misery no longer loves company. Nowadays it insists on it
      http://www.sigsegv.cx/
    26. Re:As always... by Arker · · Score: 1

      So far, nearly every attack has come from korea

      Interesting. I've seen so far Italy, Hungary, France, Canada, and the US. Not a single attempt from Korea.

      --
      =-=-=-=-=-=-=-=-=-=-=-=-=-=-
      Friends don't let friends enable ecmascript.
    27. Re:As always... by dmaxwell · · Score: 1

      If you generate the key with ssh, you have to run it through a conversion tool that you also get from the putty site. PuTTY uses it's own format for ssh keys. I carry my key both in puTTY for and ssh form on my keychain.

    28. Re:As always... by Anonymous Coward · · Score: 0

      That's probably why the default configuration file has it run as www

    29. Re:As always... by caino59 · · Score: 1

      Why allow root login?

      you can always su/sudo...

    30. Re:As always... by gmanic · · Score: 1

      Not allow root logins?

      Don't think so. If a "normal" account is compromised, the attacker could read the root-passwort when su'ing. and this is worse than remote-root-login without password!

      If you ONLY have the root account to remotely login and disable the password-auth (key-only) you're pretty much on the safe side.

      But it doesn't help, when an attacker uses this damn xmlrpc vulnerability on php to capture apache and even get root with apache running as www-data.... this happened on a drupal installation within 6 days of the vulnerability being public.

      we still didn't figure out how he gained root....

      Luckily, he was just five minutes to late - he cleaned the syslog only minutes after logcheck sent an email to a remote host about a user creation. that was the only hint we got and reacted promptly. five more minutes later, he was gone. lucky us! if he'd removed the user-generation from syslog just five minutes earlier, we'd have get away with it, even aide was run by him already... damage done: defaced, backups in place and working. four hours work for removing the rootkit and upgrading/checking the machine.

    31. Re:As always... by jsight · · Score: 1

      Right... that's why your server only allows keys from machines that you trust. Ie, don't trust machines from random lusers.

    32. Re:As always... by Wonko · · Score: 1

      Is there a way to implement one time passwords with ssh?

      There is an OTP package called OPIE. I toyed with it a year or so ago, it seemed to work OK. I have not used it in production, so be sure to research it first.

      There is a password generator for Palm OS called pilOTP. I played around with both OPIE and pilOTP and they seemed to work quite well.

      I wouldn't mind carrying around a slip of paper with 50 or so generated passwords, to login to my server. I'd cross off one at a time, each time only allowing the next one to be able to login some maintenance account.

      Neat idea, but I don't think it will work with OPIE. OPIE is a challenge/response system I believe. If you do find a system that will let you do it with paper, be sure to obfuscate it somehow. If you lose the paper you want to have time to revoke those passwords.

      I do not know how secure it would be but you could probably rig up your idea with a list of passwords and some trickery in your bash_logout. I do not know if I would trust it, but it might be a fun project :)

    33. Re:As always... by JFitzsimmons · · Score: 1

      How is that different from ANY (standard) method?

      --
      Beware he who would deny you access to information, for in his heart he dreams himself your master. -Anonymous
    34. Re:As always... by Tassach · · Score: 2, Informative
      Saying "don't login as root" is horseshit. It stems from the days when people sniffed the first packets of sessions so logging in as yourself and su-ing decreased the chance an attacker would see the root pw
      That may have been the reason you did it in the past, but it's not the reason you do it now. The reason for not logging in directly as root (or under any other shared accout, for that matter) is ACCOUNTABILITY. If you log in as root directly, all that gets logged is the host you came from. If you force them to log in as themselves, and then su to root, you have a record of who did it. This is important when you have a machine where a dozen admins all know the password to a shared account.
      --
      Why is it that the proponents of "one nation under God" are so eager to get rid of "liberty and justice for all"?
    35. Re:As always... by Wonko · · Score: 1

      Well, it's not so doom if you are carrying your own software around, as well - to compromise, they'd need to actively scan a program that wasn't on the machine before for a decrypted private key.

      I suppose it depends on your level of paranoia and how important the machine is to you. The terminal you use doesn't need anything nearly that complex. It just needs to have a keylogger to catch your passphrase, and it needs to save any files you access on your flash drive.

      Also, it strikes me that it wouldn't be horrendous to construct yourself a script that would create a new keypair for you, encrypt it with a password that you only use for those (because the computer would need to have it stored), and put the private on the thumb drive and the public into authorized_keys, replacing the old one. Have it run every time that hotplug detects that particular thumb drive, and you're good. A new keypair to use from untrusted computers within by just having your thumb drive plugged in for a bit. If I didn't have a laptop to keep my keys, programs, etc. on, I'd probably go ahead and implement that now...

      You'd possibly use OPIE instead, like I suggested to Basje. I am not using it myself, so there may be security implications I am currently unaware of with it. There is an OPIE password generator for Palm OS, Windows, and Unix, so you can store those on your flash drive. It is safe to use them since the password is only good once.

      Or you could try the low-tech route and write a bunch of passwords down and keep changing your password in your bash_logout :). I'd rather give Opie a shot first though, since it seemed to be stable and secure already.

    36. Re:As always... by mpeg4codec · · Score: 1

      While that may have been the case for older versions of SSH [I honestly don't know myself], modern versions of OpenSSH seem to have the client send the password in a whole packet. In others words, the client handles the input of the password and sends it over as one packet, instead of sending each character individually. I'm not sure if the parent was alluding to this fact or not, so I'm just clarifying.

    37. Re:As always... by pauljlucas · · Score: 1

      Nice in theory. I currently have a friend who has a long on my machine. I believe him to be a competent sysadmin. But if his machine is compromised for any reason, then mine is too. Thanks, but I'll stick to password authentication.

      --
      If you reply, do so only to what I explicitly wrote. If I didn't write it, don't assume or infer it.
    38. Re:As always... by toddestan · · Score: 1

      I've never had any problems with thumbdrives - new or old. I've seen thumbdrives now in packs, something like 3 32MB drives for $20. If you are worried your drive might fail just make multiple copies.

    39. Re:As always... by SlightOverdose · · Score: 1

      that too :p

    40. Re:As always... by PitaBred · · Score: 1

      root is also an account known to exist on every system, so it gets down to a dictionary attack, without having to guess a user name as well.

    41. Re:As always... by dodobh · · Score: 1

      You need to carry your _private_ key around.

      --
      I can throw myself at the ground, and miss.
    42. Re:As always... by MyDixieWrecked · · Score: 1

      I don't have sudo installed (for security reasons).

      also, I've got a script that runs rsync from a separate box and does a weekly backup of my primary server. su doesn't help in that area.

      --



      ...spike
      Ewwwwww, coconut...
    43. Re:As always... by Christopheles · · Score: 1

      Unless you deny root logins over ssh...

    44. Re:As always... by Anonymous Coward · · Score: 0

      The SSH.com format is different from OpenSSH's also. You can convert from OpenSSH to SSH.com with OpenSSH ssh-keygen -e -y.

      Is the putty format different from both OpenSSH and SSH.com?

    45. Re:As always... by mattyrobinson69 · · Score: 1

      you can set sudo to only allow certain users to run certain commands, with or without passwords. you could make a rule in sudoers.conf to allow your 'backup' user to run 'backup.sh' as root without a password and run everything else as 'backup' (no permissions account)

    46. Re:As always... by jericho4.0 · · Score: 1

      We should all do that anyway. Does anyone run a machine where people you don't know need to ssh in?

      --
      "A language that doesn't affect the way you think about programming, is not worth knowing" - Alan Perlis
    47. Re:As always... by jsight · · Score: 1

      Friends don't let friends log in via public key. :) By "thought to be secure", I mean another machine that I really trust (generally meaning administered by me).

    48. Re:As always... by mattyrobinson69 · · Score: 1

      just put a password on the key, that way he has to have the private key and the password for that private key:

      sh-3.00$ ssh-keygen -t rsa
      Generating public/private rsa key pair.
      Enter file in which to save the key (/home/username/.ssh/id_rsa):
      Could not create directory '/home/username/.ssh'.
      Enter passphrase (empty for no passphrase):
      [type password here]

    49. Re:As always... by uncreativ · · Score: 1

      The article states things started May 05.

      I routinely monitor my logs and observed this activity starting over a year ago. Sysadmins--if this is news to you, check your logs now!

      It got so bad that thousands of attempts per day--up to 1000 fomr just one server-- would try to guess ssh username/password combinations on my comptuer.

      I tracked one such incident down to the owner of a server who found out he was owned.

      I've greatly limited from where peopls can log into almost all my servers, but where I need to grant access to generic users, I will employ connection limiting using iptables to stop the obvious brute force password guesses. Obviously, ssh root login is a no-no from now on on my boxes.

      Also, check out http://chrootssh.sourceforge.net/index.php for a chrooted login solution. Not a panacea for securing your servers, but one more barrier to throw up.

    50. Re:As always... by MyDixieWrecked · · Score: 1

      I gotta read up on advance sudo usage. I was never really a big fan of it, and, from what I've read, the truly paranoid don't even bother installing it. I'd read a couple security advisories about sudo back when I first dabbled with linux in 98 or 99, I believe, and always shied away from using it, and had even gone so far as to uninstall it on my initial RedHat and Yellowdog installations.

      I specifically don't install it on my gentoo systems.

      Although, if I really was truly paranoid, I wouldn't permit root logins.

      I'll look into it. I didn't realize I could customize sudo per-account/per-executable. thanks for the headsup.

      question: have there been any security issues with sudo (I don't mean from improperly configured setups) in recent years?

      --



      ...spike
      Ewwwwww, coconut...
    51. Re:As always... by Vantage13 · · Score: 1
      No kidding? By disallowing password authentication you've stopped the script kiddies dead in their tracks. As for disallowing root access

      However, by allowing remote root logins you enable exactly what the article is talking about: brute force attacks. Someone can't brute force your root password remotely if remote root logins are disabled. Now maybe you have a secure password, maybe you don't. I'd rather not take the chance.

      As the previous poster mentioned turning off all password logins would be ideal since user accounts wouldn't get brute forced either, but that's not always practical.

    52. Re:As always... by mattyrobinson69 · · Score: 1

      there was at least one (january this year), i have no idea of the details though as i did a quick google search - maybe somebody more knowledgeable than me can help you with this.

      some people recommend sudo over su in a multiuser environment, as you can say "(only dave and jim can log in as root) (boris can run 'hisscript.sh" as root, but thats it)", whereas with su, everybody is equal.

      another area it excels is if you want to let some users run some commands, without them having to even know the root password, which i recon is a good thing (look into the NOPASSWD option of sudoers.conf).

    53. Re:As always... by feronti · · Score: 1

      It always did this during login authentication, though in versions earlier than 2.5, you could still get an idea of what the length of the password was by the size of the packets. Authentication messages are now padded with ignore messages to a constant length (I don't know what that length is though).

      The vulnerability was based on a traffic analysis _after_ login. However, I believe it was fixed by just making the server always echo a packet, whether the shell did or not. But don't quote me on it, since I didn't look it up.

      At any rate, no OpenSSH version after 2.5 is known to be susceptible to this particular vulnerability, so how it works is more of a historical question for protocol designers.

    54. Re:As always... by pauljlucas · · Score: 1

      So why is this better than a passworf by itself?

      --
      If you reply, do so only to what I explicitly wrote. If I didn't write it, don't assume or infer it.
    55. Re:As always... by pauljlucas · · Score: 1

      That's the way it is with me. I allow myself on my laptop to log in via RSA.

      --
      If you reply, do so only to what I explicitly wrote. If I didn't write it, don't assume or infer it.
    56. Re:As always... by MyDixieWrecked · · Score: 1

      thanks, I'll look into it.

      btw, with su, only users in the group "wheel" can su to root (or su at all, I think), so I'm the only user in that group.

      --



      ...spike
      Ewwwwww, coconut...
    57. Re:As always... by daliman · · Score: 2, Insightful

      If you don't allow remote root logins (not remote root access, using su) then the attacker needs to know two passwords - one user and the root. How is this not more secure?

    58. Re:As always... by mattyrobinson69 · · Score: 1

      because the user has to have the private key and the password. your protected if your friends computer gets compromised (private key no good on its own) and your safe from random people trying to brute force your password.

      obviously this wont protect your friends computer getting compromised, then the attacker brute forcing the password for the private key.

    59. Re:As always... by mattyrobinson69 · · Score: 1

      oh rite, i knew 'wheel' had something to do with being root, just didn't know what.

    60. Re:As always... by cheekyboy · · Score: 1

      Wow what a flaw, and the coders didnt ever think to even just send in a fixed length of data for the password regardless of the contents? ie send 128bytes no matter what the passwd length.

      Part of any crypt technique is to also HIDE the data, not just scramble it. If I crypt 8000 bytes, I dont want 8000 crypted bytes, I want perhaps say 9272, just pad it out with random data or something. FOr small stuff, hell it cant hurt to turn 40 bytes to 128 bytes.

      --
      Liberty freedom are no1, not dicks in suits.
    61. Re:As always... by cecil_turtle · · Score: 1

      They're fine, sounds like you had a defective one. I have a 128MB and a 1 gig one now, and I don't use the end cap on either of them can carry them around on my keychain and they're fine. The 128MB one even went through the wash and still works (didn't lose any data).

    62. Re:As always... by golgotha007 · · Score: 1

      security thru obscurity -> let the ssh deamon listen to a different port, most* automated scripts will fail.

      even better is to use port knocking. Basically, port 22 is not available until you "knock" on some specified high port.
      The nice part is that a simple port scan (even if it brushes past the secret port) won't activate the knock.

      many details here

    63. Re:As always... by Anonymous Coward · · Score: 0

      I still think it's good advice, I might leave a computer un-attended with my private key unlocked in the agent, allowing anyone who walks over to gain root... no ta, I'll stick to su/sudo :)

    64. Re:As always... by theonetruekeebler · · Score: 3, Interesting
      Easily done, but:

      Do you have an SMS-enabled cell phone? For an operating systems class project this spring I wrote a simple PAM module what would look up the user's cell phone number then send an eight-digit random number to the user's cell phone, which the user has to type in at the login prompt. I used this module to secure the outward-facing sshd (on port 7xxx), blocking port 22 at the firewall so I could continue to ssh around my home network without spending $0.15 every time I rebooted my laptop.

      As long as your phone has a signal, you have effective token-based authentication.

      --
      This is not my sandwich.
    65. Re:As always... by glsunder · · Score: 1

      You could always roll a 10 sided dice 4 times for your ssh port. It's more secure, because if you believe that someone has compromised your dice, you've got bigger problems than an insecure linux install.

      BTW, I never even thought of using 2222.

    66. Re:As always... by Anonymous Coward · · Score: 0

      I suppose that just goes to show that just because someone works on OpenBSD doesn't mean they know anything at all about computer security. Then again, from their spelling and grammar, they look like one of those 14 year old script kiddies anyways, so they probably _want_ everyone to leave their root accounts accessible. Any time someone says "this is 2005" (or whatever year it is), and uses that as an excuse to not employ a known and demonstrated as effective method for stopping any idiot off the street from breaking into your computer, be wary of what they're saying, they probably don't know what they're talking about.

    67. Re:As always... by notAyank · · Score: 1

      I've noticed that all the attacks on my boxes come from Korea also.

    68. Re:As always... by schon · · Score: 1

      Since root usually has the best password, I'm not sure that's really important.

      You're wrong - it's important because it's ROOT. If they bruteforce root, they have complete control of your system.

      why is it said not to login as root over SSH?

      Because it provides an audit trail. If you disallow root logins, you can see who is logging in before they become root (assuming you're doing secure logging.)

      The only plausible reason I've ever heard is that the encryption is stronger after the login is complete

      If you think this is plausible, then you really need to learn a little bit more about security.

    69. Re:As always... by schon · · Score: 1

      If you gain access to any account used to su to root, you've effectively gotten root.

      Pure, unmitigated bullshit.

      As most machines don't restrict access to su, you're effectively saying that having *ANY* access to a machine will effectively give you root access. If that's true, why have separate accounts at all?

      Here's a test for you: what's *MY* root password?
      If I gave you an account on my system, you claim that you will *EFFECTIVELY* have root - in order to do that, you must know my root password. You have my permission to post it here - go ahead, I dare you.

    70. Re:As always... by Spetiam · · Score: 1

      Have you published the source for this module?

    71. Re:As always... by jack_csk · · Score: 1

      Well, if your friendly Boris can modify hisscript.sh (that you said is run with sudo), then you get a problem.

    72. Re:As always... by PitaBred · · Score: 1

      Exactly. That's why I'm saying that deny root ssh logins is a good thing. It's not that it's insecure by the protocol, only that it's insecure by means of having a well-known, existing account that can have a dictionary attack against it.

    73. Re:As always... by Tuck · · Score: 2, Informative
      Is there a way to implement one time passwords with ssh?

      Yes, there's several. Some SSH software has S/Key support (eg OpenSSH "./configure --with-skey"). The most current S/Key implementation seems to be the one in Wietse Venema's logdaemon package.

      You can also do OTP through PAM or BSDauth if your platform supports those, eg pam_skey, pam_opie (OPIE: One-time Passwords In Everything)

      Several systems have either S/Key or OPIE support natively (OPIE seems to be becoming the more popular of the two).

      --
      $ find /pub -beer "James Squire Amber Ale" -drink
    74. Re:As always... by runderwo · · Score: 1
      Why don't you chill the fuck out, and learn to read while you're at it? I said *account used to su*, not "any account which is able to su".

      In the former case, it is likely that the account will continue to be used in the future to su, which means logging in as that user and installing a keylogger on the account gets you root. A password on that account that is sufficiently weaker than the root password leads to the obvious conclusion.

    75. Re:As always... by Anonymous Coward · · Score: 0

      Wow.
      You really

      a) Can't read properly
      b) Have no fucking clue
      c) Are so far up your own arse it's not funny. Come out into the real world for a second, loserboy.

    76. Re:As always... by mattyrobinson69 · · Score: 1

      obviously:

      chown root:root `which hisscript.sh`
      chmod 700 `which hisscript.sh`

    77. Re:As always... by jonadab · · Score: 1

      > And running Apache as root is a Really Bad Idea (tm).

      Anything that handles untrusted data (e.g., connections from the internet, or email) should NOT be running as root and ABSOLUTELY should not have write permissions outside its own home directory. Preferably it should be chrooted.

      Apache has for years supported running as a user with limited privileges; most distros give it its own user account and its own group, so it definitely should not be running as root. (Yes, you launch it as root, but it changes users when it forks, before it starts looking at the data coming in on the socket.) Configuring it to run as root is an action the user must have taken deliberately -- and yes, that was a Bad Idea.

      Last I checked (which admittedly was several years ago now), sendmail still *required* to be run as root, so that it could write files in various places where it has no business writing files, such as within other users' home directories. Bad programmer, no cookie.

      --
      Cut that out, or I will ship you to Norilsk in a box.
    78. Re:As always... by Spetiam · · Score: 1

      I think he just wanted to parrot the phrase "unmitigated [livestock]shit," perhaps in an attempt to whore himself or herself for karma.

    79. Re:As always... by Anonymous Coward · · Score: 0

      RSA/DSA only works if you carry your key with you (ever ran into an internet cafe that allows you to use a USB device.). All other methodes I know require expensive ($100 is expensive) devices, etc to carry with you to generate one time tokens and require a modified sshd, or require allowing access to PAM (potentially risky).

    80. Re:As always... by lemonjelo · · Score: 1

      I've seen a few suggestions in the thread about using the AllowUsers option in sshd_config. I'll throw in my opinion that using AllowGroups is easier to maintain. For example, have 2 groups, one for human users and one for automated scripts. Then the ssh config doesn't need to be updated whenever a user is added or deleted.

      --

      pimtamf
    81. Re:As always... by caino59 · · Score: 1

      you dont have sudo installed for security reasons, yet allow remote root logins?

      thats fucking ironic...

    82. Re:As always... by gpoul · · Score: 1

      But you could still have people login as root with their own private keys and still know who logged in when. - Apart from that you never have much accountability if you can su anyway.

      But there is not a better way on unix because the only way that would provide more accountability would be to use sudo with restrictive commands and log every access down to the command executed.

      But maybe I'm missing something.

    83. Re:As always... by Anonymous Coward · · Score: 0

      Also, try the AllowGroups, it is easier to manage if you have plenty of users.

    84. Re:As always... by theonetruekeebler · · Score: 1

      It's to crappy and unfinished to publish, I think. Basically, I'm embarrassed to let somebody else see it. Plus I wouldn't have the least clue how to go about doing that.

      --
      This is not my sandwich.
    85. Re:As always... by Spetiam · · Score: 1

      No no no no no! That's the best part about publishing the source (under a GPL/BSD/MIT license) (imho)! Any random person can submit improvements, start maintaining their own version or whatever. If you're too embarrassed (don't be), you could publish in under a pseudonym or something. All you have to do to publish it is put it up on a website and say, "here it is, and here's the license (preferably GPL, BSD or MIT) you have to abide by." Just put a comment at the top of each source file saying "this is distributed under such-and-such license" and give a URL to the license, put in the whole license in the case of MIT or BSD (they're short) or put the license in its own text file.

      Heck, you could even put up a tip jar link asking for donations so you can devote time to improving it, if people so desire. Sourceforge could even provide the webspace.

    86. Re:As always... by runderwo · · Score: 1

      Thank you for the link. That fellow got the point across far better than I managed to.

    87. Re:As always... by runderwo · · Score: 1

      Because the user password is usually much less obscure than the root password, and the only remaining step to obtain the root password is to install a keylogger and wait for them to su. So then you've gotten both passwords for the price of obtaining the user password, unless the user is paranoid enough to notice your keylogger.

    88. Re:As always... by Anonymous Coward · · Score: 0

      "You're wrong - it's important because it's ROOT. If they bruteforce root, they have complete control of your system."

      And if they login as someone else and su to root, they have the same control. If you don't trust your root password against a brute force and/or aren't identifying and stopping brute force attacks, then your system isn't safe anyway. Root ought to be a big steel door that people can pound with a ball-peen hammer all they want...

      "Because it provides an audit trail. If you disallow root logins, you can see who is logging in before they become root (assuming you're doing secure logging.)"

      That is not a blanket reason. My systems are not multi-user and almost every action taken on them must be done as root. Logins to root are done by only two people, and we have no need to know which one.

      "If you think this is plausible, then you really need to learn a little bit more about security."

      And you should look up the definition of "plausible". I didn't say I believed it. I am sure if it ever had merit it was in an older version of SSH. Since I have no clue what older SSH protocols looked like (and no need to) it would be silly to assume that they weren't vulnerable in a particular way.

    89. Re:As always... by Anonymous Coward · · Score: 0

      It is, but that's a pretty round-about way of doing what amounts to making a longer root password! Here is the bottom line: root had bloody well better be able to laugh in the face of a brute force attack. If it can't, that is what needs to be fixed, not anything else. If you are really paranoid, there are many established steps to take to foil brute force attacks of any kind - lockouts, delays, etc. Again, no denial of root logins is necessary.

    90. Re:As always... by Anonymous Coward · · Score: 0

      Add some bits to the keyspace of your password, and you'll have the same protection. Guessing a username is just like a second password, which is in turn just like a longer password.

    91. Re:As always... by gknoy · · Score: 1

      I completely agree. I read his description of this, and thought, "Oh my GOD, I want to do that!!" :) Please do not feel embarassed about your code. This seems like an awesome idea, and I for one would LOVE to try and duplicate it. I just have no idea where to start. :) I'm also interested in your design decisions. Can you tell us more about this? Can you publish pseudocode, or whatnot, even?

    92. Re:As always... by kalinh · · Score: 1

      I know I'm coming into this thread late, but you've completely piqued my interest with this concept. Please take the earlier considerations to heart and consider the options. This is such a great idea.

      --

      Metamuscle.com - News in the Iro

    93. Re:As always... by theonetruekeebler · · Score: 1

      You are absolutely right---I should suck it up and publish the damned thing. I am on vacation right now but I will put up a small project site here by Thursday 28 July. It will consist of a paper (in Word format (sorry!)) and some source files.

      --
      This is not my sandwich.
    94. Re:As always... by Anonymous Coward · · Score: 0
      I created a project page, sorta. See post 13145860 for details.

      I'm posting this here b/c I couldn't find an e-mail address for you.

      -=-keebler

  3. What next? by hoka · · Score: 4, Insightful

    What are we going to see next on Slashdot? A review for the movie "Scr1pt k1dd15"? I was interested when I saw the link and after clicking on it, I was sadly disappointed. This has nothing to do with SSH, and could just as easily be used on Apache logins, FTP, Telnet, IRC, etc. Brute forcing is an old concept and is the whole reason you are supposed to use strong passwords (well that and offline password attacks).

    1. Re:What next? by Solosoft · · Score: 1

      I don't know ... I found it kind of intresting. Lets new users learn about some security. Also it lets older users like me to do a checkup and make sure im all upto date. (it's been along time since I messed around with my security)

      Without this article I wouldn't of known about p0f and how cool it is. If you don't like the article then don't read it and quit bitchin. Just because it is not good for you doesn't mean it's not good for other people.

    2. Re:What next? by cute-boy · · Score: 1

      Well the ensuing dicussion is pretty useful, even if the article itself is fairly lame. Lots of ideas presented here on effective ways to block such activity.

      -r

  4. drop packets to port 22 by NynexNinja · · Score: 0

    Do what I do, drop packets to port 22!

  5. YOU FAIL IT by Anonymous Coward · · Score: 0

    Idiot

  6. I give it five minutes... by LandownEyes · · Score: 0

    till the first Spaceballs "password" reference.

    1. Re:I give it five minutes... by Neoprofin · · Score: 1

      "I hate yogurt, even with strawberries!" Close enough?

  7. Highly annoying by oGMo · · Score: 3, Interesting

    I have seen tons of these for 12+ months. Highly annoying. Last week I had one with over 10k connection attempts. What I need is an IDS that will just drop the remote IPs into iptables. Anyone have something like that? Of course if anyone is actually interested in reports on all the IPs, most of which usually are in .cn, I've got back logs for quite awhile. ;-P

    --

    Don't think of it as a flame---it's more like an argument that does 3d6 fire damage

    1. Re:Highly annoying by sl4shd0rk · · Score: 1

      Honeypot the login box with Portsentry. Run ssh on a non-standard port.

      --
      Join the Slashcott! Feb 10 thru Feb 17!
    2. Re:Highly annoying by cdrguru · · Score: 4, Interesting

      We use a script called sshd_sentry. It is set up so that after five failed attempts the IP address is blocked for 24 hours.

      This has essentially ended the problem for us. It allows SSH to be wide open so out-of-the-office employees can log in from a hotel or Treo in case something bad happens and it absolutely blocks dictionary attacks.

      No longer a problem.

    3. Re:Highly annoying by IDreamInCode · · Score: 2, Informative

      bfd is a good program to run with APF.

      http://www.rfxnetworks.com/bfd.php

      it looks through your /var/log/secure file and automatically adds attackers to your /etc/apf/deny_hosts.rules file.

      It works really well for me. Catches a lot of attackers.

    4. Re:Highly annoying by red_dragon · · Score: 2

      You might want to consider DShield -- it works very nicely once scripts are set up to download fresh lists and upload filtered logs for redistribution. Plus, it's free.

      --
      In Soviet Russia, Jesus asks: "What Would You Do?"
    5. Re:Highly annoying by the+eric+conspiracy · · Score: 2

      Well, I wrote a simple perl script that scans log files and then drops the IPs into IP tables.

      Run it every three minutes or so and they won't get but a few shots in.

      I tried posting it here but slashdot's lameness filter won't let it through.

    6. Re:Highly annoying by SlightOverdose · · Score: 1

      I had a script like this that was a little overzealous and blocked all network access to my /8 range... which just happened to be most of Australia.

    7. Re:Highly annoying by kooshvt · · Score: 1

      I just recently started running Denyhosts. It is a nice little script. Every 10 minutes is scans my log files for denied ssh attempts. If there are more than 5 failed attempts from a single ip address then that ip is added to /etc/hosts.deny. It at least limits thier attack to 10 minutes instead of hours as I had seen in my logs before.

    8. Re:Highly annoying by Juergen+Kreileder · · Score: 1

      I'm using netfilter's ipt_recent module to block IPs that flood the ssh port temporarily. Here's the configuration I use for shorewall.

    9. Re:Highly annoying by macaulay805 · · Score: 1

      The answer that I use is, SWatch! I have swatch set up on my OpenBSD router, when it detects "illegal login" or similiar, I have swatch execute a custom script. The custom script will add the source IP address to a container that PF will block on the fly. So in essence, one bad mistake means your IP address is blocked. Not for use everywhere, but its a start.

    10. Re:Highly annoying by str8 · · Score: 2, Interesting

      Perl is an appropiate tool for this in my mind. I did what you did but had syslog send the entries to a FIFO which the script reads from.
      I give them 2 tries in 10 seconds or 3 in 60 before they get put into the bit bucket. I then send an email to myself with the IP, times, and usernames.
      Kinda fun to watch my gmail account get 4-5 of these a day.

      Psst. Hey buddy. Can you spare a .sig?

    11. Re:Highly annoying by Anonymous Coward · · Score: 0

      You need to carefully decide if that's what you want. Automated reactions like this can easily be used as part of a DoS attack against your site.

    12. Re:Highly annoying by Anonymous Coward · · Score: 1, Interesting

      I have a script that log scans for suspicious activity. If I pick up on more than 5 fails/errors from any 1 location, they're auto-banned in hosts.deny

      Nothing more than a simple little cat/grep/awk tally script, but it does the job for the home server.

      I've been running it thru cron at rather short intervals for 6 months now, and dropped 340 ips into hosts.deny.

    13. Re:Highly annoying by Anonymous Coward · · Score: 0

      i just do a:
      route add theirip gw localhost
      e

    14. Re:Highly annoying by slavemowgli · · Score: 1

      This has been mentioned elsewhere in a comment - it might be worth looking into, as it seems to do pretty exactly what you want.

      Outside of that, if you're not doing so yet, why not contribute those logs to DShield? More data is always good for them. :)

      --
      quidquid latine dictum sit altum videtur.
    15. Re:Highly annoying by gyratedotorg · · Score: 1

      you can do this with the simple event correlator.

      --
      Gyrate Dot Org - "Where high-tech meets low-life"
    16. Re:Highly annoying by justMichael · · Score: 2, Interesting
      We use a script called sshd_sentry. It is set up so that after five failed attempts the IP address is blocked for 24 hours.
      While this approach looks like a great solution on the surface, it can have some rather unfortunate side effects.

      You want to be careful where you deploy this type of setup.

      Take this example. You run a fairly successful ecommerce site in a very competitive space. One of your competitors discovers you use this method and decides they don't want you to compete with them on Googe, Yahoo etc. They setup a script that bangs on your box once a day spoofing all the known bot IP addresses. After a while you will start to wonder why you aren't in the indexes any longer.

      That's pretty nasty business, but if you think people wont do it, you underestimate your competitors.
    17. Re:Highly annoying by toddbu · · Score: 1

      I haven't looked at the script, but I assume that it only blocks attempts on port 22.

      --
      If you don't want crime to pay, let the government run it.
    18. Re:Highly annoying by justMichael · · Score: 1

      Yeah, you made me go look at the script. It is just updating hosts.deny not adding IPs to the firewall.

    19. Re:Highly annoying by corpsiclex · · Score: 2, Interesting

      Nice thought, but it won't do much to stop a script that uses a new proxy every x attempts from a large list. You could block public proxies, but the bigger botnet owners might still have a fair shot over a several day long attack.

      --

      eBayDig 1s a typo saerch engien
    20. Re:Highly annoying by cfortin · · Score: 1

      I recently found myself in the same position. So, I installed swatch http://swatch.sourceforge.net/, and set up its /etc/swatch/sshblock.conf file to read

      ======= sshblock.conf
      watchfor /sshd.*: Failed password for root from/
      mail=MY_EMAIL_ADDR,subject=Root_Login_Attempt
      exec /usr/bin/rootblock $11

      watchfor /sshd.*: Failed password for invalid user info from/
      mail=MY_EMAIL_ADDR,subject=Invalid_Login_At tempt_i nfo
      exec /usr/bin/rootblock $13

      watchfor /sshd.*: Failed password for invalid user ashley from/
      mail=MY_EMAIL_ADDR,subject=Invalid_Login_At tempt_a shley
      exec /usr/bin/rootblock $13

      watchfor /sshd.*: Failed password for invalid user adm from/

      mail=MY_EMAIL_ADDR,subject=Invalid_Login_Attempt _a dm
      exec /usr/bin/rootblock $13
      ====== end

      etc ... for several dictionary type attacks. The rootblock script simply reads ...

      ======= rootBlock

      #!/bin/tcsh
      set IPT=/sbin/iptables
      set ip=$*:s/::ffff://
      logger ROOTBLOCK Blocking $ip
      echo $ip >> /var/rootBlockLoosers
      $IPT -A SHUN -s $ip -j BAD_IP
      $IPT -A SHUN -d $ip -j BAD_IP

      ======= end

      Where my iptables config has a BAD_IP chain that just gets dropped. Also, on reboot/restartup, iptables parses the rootBlockLoosers file to reset the blocks.

    21. Re:Highly annoying by A+non-mouse+Cow+Herd · · Score: 2, Informative
      Take this example. You run a fairly successful ecommerce site in a very competitive space. One of your competitors discovers you use this method and decides they don't want you to compete with them on Googe, Yahoo etc. They setup a script that bangs on your box once a day spoofing all the known bot IP addresses. After a while you will start to wonder why you aren't in the indexes any longer.
      Eh no. For an ssh login to fail, you have to actually establish a TCP connection, which makes spoofing rather difficult. Not only do they have to spoof the IPs, but they have to convice the internet to route googles IPs to you. If they can do that, causing you to blackhole googlebot is the least of your worries. If you were doing this on a stateless UDP protocol, that would be another matter. If ssh is your primary access to the machine, it is almost certainly a good idea to make sure your own IPs are whitelisted, and of course you want to keep an eye on any process like this.
    22. Re:Highly annoying by toddbu · · Score: 1

      Hmm, guess I'll have to modify it then. I was looking for a solution just like this, but you're right that blocking the entire IP address is just stupid.

      --
      If you don't want crime to pay, let the government run it.
    23. Re:Highly annoying by justMichael · · Score: 1

      hehe, you can mod my previous post -1 Bonehead. Didn't think it through.

    24. Re:Highly annoying by Some+Dumbass... · · Score: 1

      I've been running it thru cron at rather short intervals for 6 months now, and dropped 340 ips into hosts.deny.

      One possible improvement -- have your script run whenever there's an ssh login:

      hosts.allow
      -----------
      sshd: ALL EXCEPT /etc/ssh/sshd_deny_list \
      : spawn (/etc/cron.d/check_for_ssh_scans) & \
      : ALLOW

      Where the script "check_for_ssh_scans" adds any offending IPs it finds to /etc/ssh/sshd_deny_list.

    25. Re:Highly annoying by L.Bob.Rife · · Score: 2


      You are right about proxies/botnets, but speaking as someone who gets a few thousand of these attacks per week, the attack script that is in current use will launch several hundred or thousand dictionary attempts all from the same IP.

      When they start using botnets to assault my box, then I'll have to respond differently, but for now this solution looks beautiful.

    26. Re:Highly annoying by deltron · · Score: 1
      I use netfilter/iptables with the 'recent' and 'tarpit' modules to block SSH brute force attempts:
      $IPTABLES -N SSH_ATTACK
      $IPTABLES -A INPUT -i $EXT_IF -p tcp --dport 22 -m state --state NEW -m recent --name SSH --set --rsource -j SSH_ATTACK
      $IPTABLES -A SSH_ATTACK -s $TRUSTED_HOST -j RETURN
      $IPTABLES -A SSH_ATTACK -m recent ! --rcheck --seconds 60 --hitcount 3 --name SSH --rsource -j RETURN
      $IPTABLES -A SSH_ATTACK -j LOG --log-level $LOGLEVEL --log-prefix "SSH Brute Force Attempt: "
      $IPTABLES -A SSH_ATTACK -p tcp -j TARPIT
      More info is available in this message on the Netfilter mailing list.

      If possible, use the 'TARPIT' module because it significantly slows down the automated scanners that are being used to perpetrate these attacks.
    27. Re:Highly annoying by omega_cubed · · Score: 1

      Me too, have seen it for more than a year. After three days totalling 2K+ connections (logrotate could barely keep up (= ), I slapped together a very simple perl script.

      Script

      It is by no means flawless, nor elegant. At start up I run
      tail -f /var/log/pwdfail/current | ssh_blklst.pl
      and drop the connection for 1 hour after 5 pwd fail attempts.

      Oh, and comments and improvements are welcome.

      I did look into IDS, but I realized that the only open port being my SSH port, I probably don't need all that sophisticated software...

      --
      Engineers also speak PDE, only in a different dialect.
    28. Re:Highly annoying by Anonymous Coward · · Score: 0

      And how's that? They'd actually have to be coming from an IP address within your own network to cause you to block something you didn't want. This isn't like a ping flood or something where the source can be spoofed. Two way communication is needed before someone can even supply a password to the server. If your source is spoofed, you'll never get that far, the attempt won't be logged (at least at the SSH level) and you won't block the wrong source.

    29. Re:Highly annoying by Uzik2 · · Score: 1

      I just set up iptables to only allow connections from specific ip addresses. I may change it to only allow from specific mac addresses since it looks like some of these jokers are spoofing or moving around: Jul 15 15:53:59 mybox kernel: Bad SSH traffic:IN=eth1 OUT= MAC=00:50:04:22:ea:00:00:01:96:57:4c:70:08:00 SRC=203.177.84.181 DST=xxx.xxx.xxx.xxx LEN=60 TOS=0x00 PREC=0x00 TTL=40 ID=33219 DF PROTO=TCP SPT=45089 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0 Jul 15 19:48:15 mybox kernel: Bad SSH traffic:IN=eth1 OUT= MAC=00:50:04:22:ea:00:00:01:96:57:4c:70:08:00 SRC=220.130.159.159 DST=xxx.xxx.xxx.xxx LEN=60 TOS=0x00 PREC=0x00 TTL=39 ID=56948 DF PROTO=TCP SPT=53300 DPT=22 WINDOW=5840 RES=0x00 SYN URGP=0 It looks like the same mac address is making attacks from very different ip addresses.

      --
      -- Programming with boost is like building a house with lego. It's a cool but I wouldn't want to live in it
    30. Re:Highly annoying by Anonymous Coward · · Score: 0

      I do something similar with OpenBSD pf, like this:

      pass in quick on $ext_if inet proto tcp \
      from any to ($ext_if) port = 22 flags S/SA keep state \
      (max-src-conn 10, max-src-conn-rate 10/8, \
      overload flush global)

    31. Re:Highly annoying by tfoss · · Score: 1

      login_sentry is an updated version of sshd_sentry:

      http://www.lumiere.net/~j/login_sentry/login_sentr y

      -Ted

      --
      -=-=- Quantum physics - the dreams stuff are made of.
    32. Re:Highly annoying by zeno921 · · Score: 2, Informative

      I use Python script called BlockHosts to block hosts that fail more than a given number of times in a row. These types of attacks get quite annoying so it's nice to know they're getting blocked after a few tries.

    33. Re:Highly annoying by Spetiam · · Score: 1

      I'm not familiar with sshd_sentry, but some iptables rules will block port 22 only. Also, if I understand the --rttl flag correctly, it would prevent a DoS attack like the one you mention from having any effect.

    34. Re:Highly annoying by mcrbids · · Score: 1

      I have seen tons of these for 12+ months. Highly annoying.

      Yes. I've seen these, too. Didn't do much, though, so I wonder why it's "highly annoying". I disable root access by password (keys only) so the password attempts (over 3,000 I logged) to root did absoltively nothing.

      What I need is an IDS that will just drop the remote IPs into iptables.

      So, write your own !@# script in PHP/Perl/Bash/Python/Ruby/Java. It's a simple regex...

      Me, when I saw this, I changed the port in /etc/sshd/sshd_config to some goofy high port. Never seen it since.

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    35. Re:Highly annoying by Anonymous Coward · · Score: 0

      I may change it to only allow from specific mac addresses since it looks like some of these jokers are spoofing or moving around

      Um, dude/dudette that is probably the MAC address of you or your upstream router since you can only get the MAC address if you are on the same "wire"/ethernet physical segment switches and VLANs blur the line somewhat but not all the way to Korea.

  8. some of mine - 1061 today by DrSkwid · · Score: 1

    just 2 ips

    218.188.8.186
    218.27.88.170

    Jul 15 01:00:01 www sshd[46625]: Illegal user amza from 218.27.88.170
    Jul 15 01:00:06 www sshd[46666]: Illegal user ana from 218.27.88.170
    Jul 15 01:00:10 www sshd[46671]: Illegal user anna from 218.27.88.170
    Jul 15 01:00:15 www sshd[46675]: Illegal user anemarie from 218.27.88.170
    Jul 15 01:00:19 www sshd[46677]: Illegal user anamaria from 218.27.88.170
    Jul 15 01:00:25 www sshd[46679]: Illegal user analusia from 218.27.88.170
    Jul 15 01:00:30 www sshd[46684]: Illegal user analuisa from 218.27.88.170
    Jul 15 01:00:34 www sshd[46696]: Illegal user anabel from 218.27.88.170
    Jul 15 01:00:39 www sshd[46701]: Illegal user analia from 218.27.88.170
    Jul 15 01:00:43 www sshd[46704]: Illegal user anan from 218.27.88.170
    Jul 15 01:00:47 www sshd[46708]: Illegal user anaya from 218.27.88.170
    Jul 15 01:00:52 www sshd[46711]: Illegal user anda from 218.27.88.170
    Jul 15 01:00:56 www sshd[46715]: Illegal user ande from 218.27.88.170
    Jul 15 01:01:00 www sshd[46718]: Illegal user adonis from 218.27.88.170
    Jul 15 01:01:04 www sshd[46730]: Illegal user anders from 218.27.88.170
    Jul 15 01:01:09 www sshd[46732]: Illegal user andersen from 218.27.88.170
    Jul 15 01:01:12 www sshd[46734]: Illegal user anderson from 218.27.88.170
    Jul 15 01:01:16 www sshd[46737]: Illegal user andi from 218.27.88.170
    Jul 15 01:01:20 www sshd[46739]: Illegal user andy from 218.27.88.170
    Jul 15 01:01:24 www sshd[46741]: Illegal user andley from 218.27.88.170
    Jul 15 01:01:28 www sshd[46743]: Illegal user andonia from 218.27.88.170
    Jul 15 01:01:32 www sshd[46746]: Illegal user andra from 218.27.88.170
    Jul 15 01:01:36 www sshd[46750]: Illegal user andre from 218.27.88.170
    Jul 15 01:01:41 www sshd[46754]: Illegal user andras from 218.27.88.170
    Jul 15 01:01:45 www sshd[46756]: Illegal user andrea from 218.27.88.170
    Jul 15 01:01:50 www sshd[46760]: Illegal user andreas from 218.27.88.170
    Jul 15 01:01:54 www sshd[46762]: Illegal user andreassi from 218.27.88.170
    Jul 15 01:02:00 www sshd[46764]: Illegal user andree from 218.27.88.170
    Jul 15 01:02:06 www sshd[46766]: Illegal user andrei from 218.27.88.170
    Jul 15 01:02:12 www sshd[46768]: Illegal user andreia from 218.27.88.170
    Jul 15 01:02:16 www sshd[46773]: Illegal user andreina from 218.27.88.170
    Jul 15 01:02:20 www sshd[46776]: Illegal user andrew from 218.27.88.170

    --
    There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
    1. Re:some of mine - 1061 today by ForumTroll · · Score: 1

      I get these entries all the time in my logs as well. Futile attempts from a script to generate random login names and passwords. The problem is that you can't really do much about it because they are often in countries that have different laws and blocking by IP/subnet just doesn't work because they have no shortage of IPs/subnets. Best suggestion is just to use strong passwords and a good encryption algorithm.

      --
      "A Lisp programmer knows the value of everything, but the cost of nothing." - Alan Perlis
    2. Re:some of mine - 1061 today by Anonymous Coward · · Score: 0

      Yeah, I got a bunch from 206.49.38.26.

      By the way, your signature sucks.

    3. Re:some of mine - 1061 today by Anonymous Coward · · Score: 0

      Hey moron, nobody wants to see an entire page full of lines from one of your fucking server logs--just about everybody has those kinds of things littered all over their logs: would you like to stare at *their* garbage logs while you visit your favorite "News for Trolls" website?

      Keep your ssh diahrrea to yourself.

    4. Re:some of mine - 1061 today by DrSkwid · · Score: 1

      Did you mean: diarrhea

      s'up, scroll bar not working?

      --
      There are places where the networks are not touching,and there are places where they are-Boeing's Lori Gunter
  9. Easy fix by Anonymous Coward · · Score: 4, Informative

    i have had this on a number of occasions.. i just set the max auth attepts to 4, this renders the attempts useless

    1. Re:Easy fix by RLiegh · · Score: 1

      Where do you set this at, and on what OS?

    2. Re:Easy fix by brsmith4 · · Score: 2, Interesting

      To bad you posted AC... this is very informative to newer users that are unaware of /etc/ssh/sshd_config.

    3. Re:Easy fix by RLiegh · · Score: 1

      If you don't know, say so; don't blame me for it.

    4. Re:Easy fix by tek.net-ium · · Score: 5, Informative

      RTFM. sshd_config(5) MaxAuthTries Specifies the maximum number of authentication attempts permitted per connection. Once the number of failures reaches half this value, additional failures are logged. The default is 6. Crackers will just open up more connections.

    5. Re:Easy fix by SloWave · · Score: 1

      > sshd.conf is where the settings are.

      No wonder this guy posts as an AC. The file name really is sshd_conf.

    6. Re:Easy fix by TCM · · Score: 1

      Actually, it's sshd_config.

      --
      Of course it runs NetBSD. BTC: 1NT7QvbetmANwaMzhpVL6
    7. Re:Easy fix by Anonymous Coward · · Score: 0

      You're fucking retarded. Stupid american kid.
      sshd.conf is where the settings are.
      If you dont know where that file is, shoot yourself while you can.


      LOL! Take you smelly foot and stick it in your dirty mouth because the file is sshd_conf.

      Its too bad guns are probably banned in your country because you should be the one shooting yourself. Idiot.

    8. Re:Easy fix by Mr+Z · · Score: 2, Informative

      I'd also suggest "MaxStartups 2" to prevent them from opening a bunch of connections in parallel.

    9. Re:Easy fix by bersl2 · · Score: 1

      I've found that a firewall-based approach is more effective (in addition to in-server controls, for layered security). Modify either version of this iptables chain to your needs. After three bad tries, they get DROPped (if you don't have TARPIT available, which I don't) for 60 seconds. The scripts I've encountered have been too stupid to account for this and give up after a few extra tries.

    10. Re:Easy fix by Tuck · · Score: 1

      Actually this will have zero effect on the current crop of attacks. They make one password auth attempt then disconnect so MaxAuthTries never comes into play.

      --
      $ find /pub -beer "James Squire Amber Ale" -drink
  10. Isn't the point of SSH... by Anonymous Coward · · Score: 0

    ...to have a frontdoor made of 1 mile thick steel instead of a cardboard, so that we DON'T have contact autorities each time some bum goes through it?

  11. DenyHosts by roubles · · Score: 5, Informative

    I use DenyHosts http://denyhosts.sourceforge.net/ from a cronjob. It detects any suspicious logins in /var/log/auth.log and adds the ip address of the user into the /etc/hosts.deny file. It also sends me an email telling me the IP address that was last added to the file.

    Lately I have been getting atleast 1 hack attempt a day on my personal computer connected to the internet over a cable connection. On weekends I get more.

    Just this morning I had two ssh dictionary attacks. DenyHosts caught them both.

    1. Re:DenyHosts by Anonymous Coward · · Score: 1, Interesting

      Does a login attempt really take so much CPU time that these attacks affect performance? If not, it might be simpler to use a strong password, never look at /var/log/auth.log, and carry on with business. If yes, it might be simpler to optimize the ssh login code to make it faster.

    2. Re:DenyHosts by markild · · Score: 1

      Thanks for the tip. I was kinda looking for this. Not actually looking though, but it was some place back in my head.

      At a glance it looks like just the program one would need if you're experiencing malicious ssh-logins.

      This is useless for people running a web-service that is supposed to accept connections for pretty much anyone though (seeing that it blocks IP's).

      --
      Scully: Should we arrest David Copperfield?
      Mulder: Yes we should, but not for this.
    3. Re:DenyHosts by XanC · · Score: 1
      You have the option of blocking IPs only for SSH or for everything. Pretty nice.

      However, I'm trying to run it on Debian Woody and I'm getting this:

      # ./denyhosts.py
      Traceback (most recent call last):
      File "./denyhosts.py", line 102, in ?
      class Counter(dict):
      NameError: name 'dict' is not defined

      So maybe it's not so great. :-)

    4. Re:DenyHosts by markild · · Score: 1

      Yeah.. You're right. I'm wrong :D The only-ssh options is real neat. Just got it installed and up'n running. Works like a charm!

      You sure you got the latest python installed?

      --
      Scully: Should we arrest David Copperfield?
      Mulder: Yes we should, but not for this.
    5. Re:DenyHosts by XanC · · Score: 1

      The Denyhosts web site says it needs Python 2.1 or later, and I've got Woody's standard 2.1.3. But it's possible he's not testing against such an ancient version.

    6. Re:DenyHosts by theCoder · · Score: 2, Interesting

      I recently stumbled upon sshdfilter. It analyzes sshd output in real time by running sshd in with the -e option and adds attempts to login with invalid usernames to an iptables chain to drop all packets from that host. I've only been running it for a week or so, but it seems to be working well.

      Seems like a similar idea to DenyHosts, just a different implementation.

      --
      "Save the whales, feed the hungry, free the mallocs" -- author unknown
    7. Re:DenyHosts by dmaxwell · · Score: 1
      Thanks! I'll have to check that out. I've been running this script every couple of minutes from a cron job. The script is tailored to how the gShield firewall scripts like to do things. It's probably better than this thing I've been using:

      #!/bin/bash

      # Extract everyone who isn't me or a user on this system.
      cat /var/log/auth.log | grep "Illegal user" | grep -v "dmaxwell" > /tmp/out1.txt

      # Just the ip addys please
      tr -cs '[0-9\.]' '\012' 0 && $1 /tmp/out2.txt

      # Lose some newly created cruft
      rm /tmp/out1.txt

      # Store a list of current rules

      /sbin/iptables -L -n > /tmp/current_rules.txt



      # Step through the unauthorized ip addys
      for ip in `cat /tmp/out2.txt`
      do

      # Make sure we aren't already blocking the ip

      if grep -q "$ip" /tmp/current_rules.txt
      then true # Too chatty. My inbox was getting filled up: echo "$ip is already blocked."
      else
      # And DROP with extreme prejudice if we aren't.

      /sbin/iptables -A BLACKLIST -s "$ip" -j DROP


      echo "$ip is now blocked."
      fi

      done

      # Clean up the rest of our cruft.
      rm /tmp/out2.txt
      rm /tmp/current_rules.txt

      exit

      Incidentally, Slashcode insists on mangling the spacing. Sorry about that.
    8. Re:DenyHosts by Rimbo · · Score: 1

      I set this up at work. At first I got several emails per day. Now I'm not getting more than one a week.

      Interesting, no?

    9. Re:DenyHosts by cirisme · · Score: 2, Informative

      I have to second DenyHosts, it is truly an awesome tool. My favorite feature is that it will find IP's with more than X failed attempts, and at least one successful login and warn you that there have been suspicious log-ins.

      Very powerful feature, imho.

    10. Re:DenyHosts by ChadN · · Score: 1

      Yeah, he's inheriting from a dictionary type, which is a new-style class introduced in Python 2.2.

      If the code author really wants to still support Python 2.1, he would have to inherit from type UserDict, assuming he isn't making use of other 2.2 features. I suggest an email to the author indicating a change in the requirements listing, or a change back to 2.1 compatibility.

      --
      "It's overkill, of course. But you can never have too much overkill." - Anonymous Slashdot Coward
    11. Re:DenyHosts by XanC · · Score: 1

      Cool, thanks for the info. I'll email him.

    12. Re:DenyHosts by Anonymous Coward · · Score: 0

      I submitted a SourceForge bug report on this issue, as well.

    13. Re:DenyHosts by LordSnooty · · Score: 1

      Yup, you guys make sure you use this, I know the person responsible and it works a treat. I've been testing it on Redhat. There's also a nice logwatch filter bundled in so you can keep track of attempts (plug plug). It really does reduce activity. Sadly this was conceived because of known real successful intrusions with this method. What sshdfilter won't do is remove all your "test" accounts.

    14. Re:DenyHosts by PostItNote · · Score: 1

      Thanks! I just installed it, and I've already managed to deny 10 ips that tried dictionary attacks in the past 48 hours. Quite nice.

  12. I get these almost continually... by Kevin+Burtch · · Score: 1


    If they bother you, you could always use portsentry or something similar to block the IP once a certain number are received.

    --
    - Preferences: Solaris 10 (servers), Ubuntu (desktops), Solaris 11 (personal servers) -
    1. Re:I get these almost continually... by AndroidCat · · Score: 2, Funny

      That's probably the IP of one their previous victims. If you wanted to have fun, rename the role account they're trying for, create a "root" with almost no access and uses Zork (dungeon) as its shell. (Probably best to try this on the junk spare Pentium box, just in case.)

      --
      One line blog. I hear that they're called Twitters now.
  13. Guy Says Recent Attacks?? by putko · · Score: 1

    I don't think these are at all "recent".

    Haven't these ssh-based attacks been going on since sometime like July of 2004?

    The deal was that there was a SSH vulnerability in non-OpenBSD implementations of sshd. The automated stuff kicked off then -- and they've gotten a bit worse in the last few months.

    --
    http://www.thebricktestament.com/the_law/when_to_s tone_your_children/dt21_18a.html
    1. Re:Guy Says Recent Attacks?? by SloWave · · Score: 1

      I've been seeing them for over 2 years now. Same type of attack but the list of login names change so they must ne trying different dictionaries. In my /etc/ssh/sshd_config file I've set the following parameters to hopefully gum them up somewhat...

      Protocol 2
      LoginGraceTime 12
      PermitRootLogin no
      MaxAuthTries 2

  14. Non-default Port by fire-eyes · · Score: 2, Informative

    Use a non-default port on any service whenever possible. This simple change goes a long way. Obviously it is not all you should do.

    --
    -- Note: If you don't agree with me, don't bother replying. I won't read it.
    1. Re:Non-default Port by ak8b · · Score: 2, Informative

      I second this one. I went from several a day to zero since I changed the incoming port. I have my router (a DI-604) do the port change/forward so that I didn't have to change anything on the Linux box or deal with it within my internal network.

    2. Re:Non-default Port by failure-man · · Score: 2, Interesting

      Not only that but changing the port really helps with spotting a real attack. Dumb scripts always try port 22. Since I run SSH on a different port all that random noise falls away. If I see failed login attempts I know I'm looking at something with some intelligence.

  15. I've seen many SSH break in attempts myself. by Name+Anonymous · · Score: 1

    I've seen many attempts to log in to my system via SSH. Oddly enough, since I never enabled SSH2, a lot of the attacks fail due to incompatible SSH versions.

    Some of the IPs I'm seeing trying to log in (break in) are:
    211.98.192.91
    66.194.210.4
    210.188.243.208
    200.198.184.135
    222.122.25.100
    211.87.224.192
    62.231.44.113
    212.202.220.163
    62.75.216.10
    81. 172.160.19
    82.127.73.97
    82.76.47.40
    206.170.12. 98
    61.133.218.110
    216.70.203.62
    66.220.1.112
    1 2.167.162.5
    80.190.243.50
    62.75.216.10
    221.249. 246.34
    152.92.7.212
    210.118.193.95
    82.76.47.40
    61.135.134.238

    1. Re:I've seen many SSH break in attempts myself. by Anonymous Coward · · Score: 0

      Oddly enough, since I never enabled SSH2

      umm, i think most people don't use SSH1 for a reason.

    2. Re:I've seen many SSH break in attempts myself. by clymere · · Score: 1

      you're aware that most people have switched to SSH2 because of big vulns discovered in SSH1 right? I believe it was a man in the middle attack which was pretty much unpreventable, IIRC.

      --
      once you go slack, you never go back
    3. Re:I've seen many SSH break in attempts myself. by toddestan · · Score: 1

      200.198.184.135

      http://200.198.184.135:80

      Looks like you're getting hacked my an online dating site! (lets slashdot the bastards!)

  16. Attacks are a sad reminder on stupidity by m.dillon · · Score: 2, Informative
    I get 40 of these a day across half a dozen machines. They only try a small combination of trivial passwords for accounts like 'root' and 'test' and 'admin', and occassionally user names using the same user name as the password, etc. Really quite sad considering that most Linux and BSD installs disable passworded-root logins via ssh by default. My guess is that they are going after Windoz boxes which for some unfathomable reason still allow people to do stupid things with passwords.

    I got annoyed enough that I wrote a little script to pull the data out of my logs in real time and add an entry to my firewall, but the attacks are harmless to any sysadmin with a clue.

    -Matt

    1. Re:Attacks are a sad reminder on stupidity by clymere · · Score: 1

      distrubingly, i discovered yesterday that FreeBSD apparently does NOT require a user to set a password for root. Not during install, not ever. Sure, you need to have added a user to wheel...but most people will for the convenience. Now you've got a machine ready to be owned by the compromise of any user account thats in wheel. OpenBSD on the other hand, not only required I set a password for root, but also refused anything that didn't have letter, numbers, and at least one special character!

      --
      once you go slack, you never go back
    2. Re:Attacks are a sad reminder on stupidity by larkost · · Score: 1

      It does not require you, but it does prompt you for it. This has been part of the sysinstall system for as long as I can remember.

  17. I think the idea is by Anonymous Coward · · Score: 2, Insightful

    The simple, old attacks are sometimes the most dangerous because you start to assume there's no problem with them. You forget about them. They become a blind spot. The point of the article is to remind you, linux can be just as insecure as windows if you do stupid things like choose bad passwords.

    1. Re:I think the idea is by Neil+Blender · · Score: 1

      The simple, old attacks are sometimes the most dangerous because you start to assume there's no problem with them. You forget about them.

      If you forget about them, then you aren't checking your logs. If you aren't checking your logs, well, maybe you shouldn't be admining a box with services such as ssh open to the world.

  18. Use another port by objorkum · · Score: 5, Informative

    Use another port than 22. I have not noticed one single bruteforce attempt after I did that.

    --
    objorkum dot com
    1. Re:Use another port by Seumas · · Score: 1

      + Use key logins instead of password logins.

      + Don't allow root or other important users to login (su/sudo to them as needed from another account once you're in).

      This just isn't a big deal and I'm certainly not going to contact the couple dozen ISPs (usually in Russia, etc) to complain about some goofball trying to bruteforce my server with usernames that don't even have access to SSH in the first place. The only downside is that they're eating up resources and because they rotate the username attempted, the time delay doesn't activate after a failed attempt.

      If anyone is aware if you can set the failed-attempts to be based PER IP ADDRESS instead of PER USER, I would love to know. I don't recall that being an option (of course, not someone will point me to line three of the man page or something where it clearly says you can and gives detailed instructions to accomplish it...heh).

    2. Re:Use another port by HermanAB · · Score: 2, Informative

      You can use this method to limit login attempts. It will allow a burst of 5 new connection attempts, then limit at a rate of 1 per second.

      # Protect against DOS attacks - rate limit various ICMP messages
      $IPTABLES -A INPUT -p icmp --icmp-type echo-request -m limit --limit 1/s -j ACCEPT
      $IPTABLES -A INPUT -p tcp --syn -m limit --limit 1/s -j ACCEPT
      $IPTABLES -A INPUT -p tcp --tcp-flags SYN,ACK,FIN,RST -m limit --limit 1/s -j ACCEPT

      --
      Oh well, what the hell...
    3. Re:Use another port by jefp · · Score: 1

      I agree. It doesn't protect against someone specifically targetting your machine, they'll just port-scan you and then proceed on the new port. But it's very effective against the widespread robot attacks we've seen for the past couple of years.

    4. Re:Use another port by wfberg · · Score: 1

      Use port 443. As a bonus, corporate firewalls will think it's an HTTPS site and you can log in to your box from work.

      --
      SCO employee? Check out the bounty
    5. Re:Use another port by Anonymous Coward · · Score: 0

      bingo, that's what I do.

    6. Re:Use another port by Spetiam · · Score: 1

      How about this?

      iptables -A INPUT -m state --state ESTABLISHED -j ACCEPT
      iptables -A INPUT -p tcp --dport ssh -m recent --update --seconds 300 --hitcount 5 -j DROP
      iptables -A INPUT -p tcp --dport ssh --tcp-flags syn,ack,rst syn -m recent --set -j ACCEPT

      The stuff in bold is what works best for my situation.

    7. Re:Use another port by Anonymous Coward · · Score: 0

      That depends. You get some people who do a blind attempt to connect, and you get others who only do a simple scan. For instance if you change the port to 60000 or so, then do a scan with 'nmap $ip' the port won't show up either (because nmap does a scan of standard interesting ports). You have to manually specify that you want to go through ALL the ports. Often times that's not worth the effort for lazy hackers who only have a passing interest in comprimizing "somebody's" system.

  19. Easy to fix by jswoboda · · Score: 1

    I had a lot of these attempts. I just set max autorization atempts to 4... renders these attacks useless.

  20. Brute force isn't new by Zweideutig · · Score: 1

    If setup a delay between the time of the password is accepted from the ssh client, and the time when you indicate a successful login with a shell prompt (or a failure message,) you would slow down a brute force attack. You should delay even delay for a successful login, because if the brute force program doesn't see a shell within a second, it could simply assume it failed and try another. Also, you should be behind a router (OpenBSD and an old PC is what I use.) If you don't need sshd available from outside your LAN, simply don't forward the port. You may consider keeping your LAN on RJ45 (not wifi) to reduce the risk of malicous login attempts. Make sure your wireless access point is locked down as much as possible if you must have it. Blacklisting an IP after say, 7 unsuccessful logins and logging the incident is a good idea (and perhaps have the sysadmin notified of the event.) Some ways to alleviate the risk.

    --
    Powered by caffeine and sugar; BSD
  21. Funny... by ninja_assault_kitten · · Score: 1

    I was just reviewing one of these today from Miami University (Ohio).

    Jul 15 04:55:51 combust sshd[12125]: Did not receive identification string from 134.53.130.197
    Jul 15 04:59:57 combust sshd[14758]: Invalid user president from 134.53.130.197
    Jul 15 04:59:57 combust sshd[1219]: input_userauth_request: invalid user president
    Jul 15 04:59:57 combust sshd[1219]: Failed password for invalid user president from 134.53.130.197 port 57698 ssh2
    Jul 15 04:59:57 combust sshd[14758]: Failed password for invalid user president from 134.53.130.197 port 57698 ssh2
    Jul 15 04:59:57 combust sshd[1219]: Received disconnect from 134.53.130.197: 11: Bye Bye
    Jul 15 04:59:58 combust sshd[29612]: Invalid user bob from 134.53.130.197
    Jul 15 04:59:58 combust sshd[7875]: input_userauth_request: invalid user bob
    Jul 15 04:59:58 combust sshd[29612]: Failed password for invalid user bob from 134.53.130.197 port 57789 ssh2
    Jul 15 04:59:58 combust sshd[7875]: Failed password for invalid user bob from 134.53.130.197 port 57789 ssh2
    Jul 15 04:59:59 combust sshd[7875]: Received disconnect from 134.53.130.197: 11: Bye Bye
    Jul 15 05:00:00 combust sshd[22372]: Invalid user sunshine from 134.53.130.197
    Jul 15 05:00:00 combust sshd[6311]: input_userauth_request: invalid user sunshine
    Jul 15 05:00:00 combust sshd[22372]: Failed password for invalid user sunshine from 134.53.130.197 port 57864 ssh2
    Jul 15 05:00:00 combust sshd[6311]: Failed password for invalid user sunshine from 134.53.130.197 port 57864 ssh2
    Jul 15 05:00:00 combust sshd[6311]: Received disconnect from 134.53.130.197: 11: Bye Bye ...
    Jul 15 05:11:57 combust sshd[1820]: input_userauth_request: invalid user gus
    Jul 15 05:11:57 combust sshd[1820]: Failed password for invalid user gus from 134.53.130.197 port 39530 ssh2
    Jul 15 05:11:57 combust sshd[23478]: Failed password for invalid user gus from 134.53.130.197 port 39530 ssh2
    Jul 15 05:11:57 combust sshd[1820]: Received disconnect from 134.53.130.197: 11: Bye Bye
    Jul 15 05:11:58 combust sshd[14363]: Invalid user adminweb from 134.53.130.197
    Jul 15 05:11:58 combust sshd[3817]: input_userauth_request: invalid user adminweb
    Jul 15 05:11:58 combust sshd[3817]: Failed password for invalid user adminweb from 134.53.130.197 port 39568 ssh2
    Jul 15 05:11:58 combust sshd[14363]: Failed password for invalid user adminweb from 134.53.130.197 port 39568 ssh2
    Jul 15 05:11:58 combust sshd[3817]: Received disconnect from 134.53.130.197: 11: Bye Bye

  22. Re:Linux is still a secure OS tho, by Name+Anonymous · · Score: 1

    True enough. However, another limiting factor in how secure a system is would be the strength of the passwords that the users use.

  23. If your paraniod disable password auth. by Anonymous Coward · · Score: 0

    password authentication for OpenSSH.

    OpenSSH supports several forms of authentication and generally password-only authentication is the weakest it can support.

    A much more secure versions is public/private keypair combined with a passphrase that is not related to your normal unix password.

    That way if they get a hold of your keys they still have to brute force your passphrase, and if they don't have your private keys then they can't get in even if they do know the password.

    Also disable root ssh access and disable any 'sudo' you have setup. That way if a hacker guesses a password he still has to find a local rights elevation exploit (which isn't terrificly difficult in Linux unless you keep things very up to date)

    The other form of secure authentication is kerberos, but that is a pain to setup.

  24. iptables "recent" rule by XanC · · Score: 1
  25. How to limit this (newbie sysadmin question)? by Poor+College+Student · · Score: 1

    -- Newbie sysadmin question --

    I've noticed these scripts on my logs before attempting to access my machine (its a moot point now given my network setup, but...), how would you limit from occurring?

    I'd like to do the following: If two failed connections with nonexistant usernames are used or three with a known user name, block the connectors IP subnet for a certain time (with the exception of a couple known good subnets).

    The blocking would be the easy part, since some script could control iptables (or pf on a bsd machine). But outside of doing creative monitoring with with auth.log, is there another way to detect failed logins?

    1. Re:How to limit this (newbie sysadmin question)? by Macdee · · Score: 1

      I've been using sshblack2.pl from http://www.pettingers.org/code/sshblack.html quite happily. It adds IPs to iptables after N failed attempts, and removes them M hours later.

  26. The idea is old, but the attempt is new by jfengel · · Score: 4, Insightful

    The idea of brute force is extremely old, but the fact that somebody is out there actually doing them is important. The use of strong passwords is no longer just a theoretical "it would be a good idea" policy, but now somebody actually is looking to get through.

    Other Slashdot readers are reporting the same effect: a recent rise in brute-force, scripted attacks, possibly by compromised boxes.

    Most accounts of all sorts remain secure simply because they're obscure, and it's tempting to be lulled by past successes. We always knew that this was possible, but the fact that somebody is actually doing it is news.

    1. Re:The idea is old, but the attempt is new by blowdart · · Score: 1

      Recent? Really? I'm seeing 3-4 attempts against my windows SSH devices daily, and have been seeing it for well over a year. Has it really risen?

    2. Re:The idea is old, but the attempt is new by jfengel · · Score: 1

      I dunno for sure. All I've got is anecdotal evidence.

  27. surprising, just May 2005 by whovian · · Score: 2, Insightful

    I've been seeing these attacks for QUITE a while now. Repeated access attempts which were guesses of people's first names as logins. I used to ban the entire source subnet, but it's futile. Now I just whitelist acceptable IPs.

    --
    To-do List: Receive telemarketing call during a tornado warning. Check.
  28. BlockHosts by smartin · · Score: 1

    I installed this on my server, seems to work well. Basically it keeps track of ssh attempts and after a preconfigure number of failures within a certain period of time, it bans the hosts. Hooks into tcpwrappers using hosts.allow.

    --
    The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
  29. Recent? by Anonymous Coward · · Score: 0

    Slashdot must be really hurting for a story. I've been noticing these since the first time I put up a linux box on my home cable line. It's not a new phenomenon, and thank you very much, I know how to report an IP address for abuse.

    What is this, Security for Dummies?

  30. Automation by mfloy · · Score: 1

    It shows what an automated land we live in when even the hackers are automating their attacks. The problem with this is that every compromised machine will in turn compromise more, making it very hard to stop.

  31. A router? by Zweideutig · · Score: 1

    Do you have your machine directly on your broadband connection, or do you have port 22 forwarded to the router? I don't have port 22 forwarded, and I have never seen this. Sorry if this is too obvious. Do you need to login remotely from work or something? Maybe you could only allow a certain IP?

    --
    Powered by caffeine and sugar; BSD
    1. Re:A router? by ninja_assault_kitten · · Score: 1

      Yeah, I have an inbound port NAT on my home DSL for SSH. I'm not too concerned about it. I just thought it was interesting as I had just enabled it a short time before the first bruteforce attempt. At the time, I wasn't aware SSH bruteforce attacks were so prevalent.

  32. No root login? by Anonymous Coward · · Score: 0
    "There is of course a few things you can do, the most important being disabling root logins over SSH. [...] If you need to be able to work as root on the same system, the best solution is log into a normal user account and then from there to use 'sudo' or even 'su - root'."

    I've never understood this advice. If the crackers get hold of an admin account, all they need to do is upload a trojan 'sudo' or 'su' program and wait. I've done so myself on one system (making sure I tick the 'anonymous' box). Blocking root logins doesn't increase security, it just annoys root.

    Counter agruments?

    1. Re:No root login? by ledow · · Score: 1

      "If the crackers get hold of an admin account," then you're stuffed anyway.

      I can see your argument and tried to think of a few counter-arguments.

      If someone can only get to root by coming in as a normal user and su-ing, then we should know which account they came from and hold that user responsible.

      Not all SSH accounts are necessarily for admin users anyway (compile farms, cgi hosting, VPN's etc.), so blocking root on those connections doesn't hinder anyone and the users will not be able to get to root anyway, so why not block root logins?

      Blocking a unnecessary login is one less login to attack? Especially if it is one that has power that is unnecessary, e.g. compile farms using SSH. Why *should* there be any facility to log in as root remotely?

      If someone should find an exploit in SSH that executes with the privileges of the logged in user?

      In the same way that you should never log in as root at the terminal anyway, just to make sure you think twice before you actually perform that rm command?

    2. Re:No root login? by shish · · Score: 1
      If the crackers get hold of an admin account

      If you disable root logins, then they can't get hold of the admin account... Although your use of "an" admin account suggests that you mean someone other than root who can write to the system binary locations -- that seems like a bad idea anyway, and is unrelated.

      --
      I mod down anyone who says "I will be modded down for this", regardless of the rest of their comment
    3. Re:No root login? by Anonymous Coward · · Score: 0

      Im not that well versed in the ways of linux, not hard to tell is it :)
      but cant you just log in through ssh using a regular login then su - to root?

  33. why not disable passwords entirely? by toby · · Score: 4, Informative

    If you only need access from a limited set of machines which can have pre-generated keys, you can disable password authentication entirely (PasswordAuthentication no) and use RSA instead, with optional passphrase. In addition to PermitRootLogin no, I suggest judicious use of AllowUsers in sshd_config.

    --
    you had me at #!
    1. Re:why not disable passwords entirely? by ngunton · · Score: 2, Informative

      Careful if you're doing this on a remote host that you don't have easy console access to (e.g. co-located or rented from a hosting company). If you happen to delete or otherwise lose the key on your local computer (or if you need to login from another computer for some reason) then you'll be unable to.

    2. Re:why not disable passwords entirely? by Dwonis · · Score: 1
      That's the idea. If you don't have access to the client machine, then it's very hard to get access to the system.

      Bruce Schneier talks about similar security-defeating effects of secret questions.

    3. Re:why not disable passwords entirely? by Federico2 · · Score: 1
      If you happen to delete or otherwise lose the key on your local computer


      How about... backups?
    4. Re:why not disable passwords entirely? by vinlud · · Score: 1


      In addition to PermitRootLogin no, I suggest judicious use of AllowUsers in sshd_config

      My SSH2 config wont swallow this, it gives a warning: Restarting Secure Shell server v2: WARNING: Unrecognized configuration parameter allowusers
      sshd2.

      Why that message when it works with your setup?

      --
      Repeat after me: We are all individuals
    5. Re:why not disable passwords entirely? by shokk · · Score: 1

      You have an old version of ssh. Please hie thee to http://www.openssh.org/ and compile yourself something recent and secure. And be sure to set these up:
      AllowUsers usernamehere
      PermitEmptyPasswords no
      PermitRootLogin no

      My logs have been increasingly filling up with these lately but they are all denied.

      --
      "Beware of he who would deny you access to information, for in his heart, he dreams himself your master."
  34. Reporting is useless by cdrguru · · Score: 1
    Nobody cares. I've tried that approach and it is a waste of my time and the person's on the other end.

    We use sshd_sentry which puts the IP address into the hosts.deny list for 24 hours after five failed attempts. This eliminates the problem completely and it doesn't fill up our logs with useless trash.

    I am thinking of doing the same thing for relay attempts because that seems to have become the new sport. One reject you would think would be quite sufficient, but no, we're getting a hundred or more requests from the same IP address.

    1. Re:Reporting is useless by kuom · · Score: 1

      I would agree with you for the most part, but there is one ISP that took care of the issue in a timely manner, and followed up with me: Liquid Web.

      DISCLAIMER : I am in no way affliated with Liquid Web. I am just very impressed with their response time + customer service. I work at an ISP myself, and I constantly fire off abuse reports to various other ISPs. And these guys really get stuff done, fast.

  35. That's port 22 by AndroidCat · · Score: 1

    For those that want to check their own logs. I just get a sprinkling of those, maybe an average of one or two a day.

    --
    One line blog. I hear that they're called Twitters now.
  36. add AllowUsers to /etc/ssh/sshd_config by dd · · Score: 3, Insightful

    A good thing to do is to use the AllowUsers configuration directive for sshd in /etc/ssh/sshd_config. The following would allow some account named 'unprivguy' authenticated ssh access from anywhere. All other ssh connections must come from local and local domain authenticated users. So root@localhost or root@*.mydomain.com could log in. All others are blocked, even if they have the password.

    AllowUsers unprivguy *@*.mydomain.com *@localhost

    You still see the attempts in your logs, but now you also see:

    User root not allowed because not listed in AllowUsers

  37. Won't work by Anonymous Coward · · Score: 0, Flamebait

    Too much trouble. If you want someone to log in, you'll have to tell him to use the non-standard port.

    1. Re:Won't work by _fuzz_ · · Score: 2, Informative

      If the people you are giving shell accounts too are not smart enough to figure out how to change the port on the client, you have other problems. The exception to this may be restricted accounts, such as sftp. But if people are smart enough to change the dropdown from "ftp" to "sftp," they are smart enough to change the port value from 22 to 22222.

      Changing the port does work. I went from having hundreds of attacks a day to zero. Not a single attempt in months.

      --
      47% of all statistics are made up on the spot.
    2. Re:Won't work by slavemowgli · · Score: 1

      So? You just have to tell them once. One could use the same reasoning to say that passwords are too much trouble because people have to type them in every time want to log in (assuming you're not using public key-based authentication).

      Running services that don't need to be open to a wide variety of people on a non-standard port is generally a good idea. It's not a replacement for properly securing your services (obscurity never is), but it's another layer on top that can't hurt.

      For that matter, do look into port knocking. A port scan will still pick up services on uncommon ports, but properly-implemented port knocking will hide the services completely. I think there was a paper linked to in a Slashdot story earlier this year - a very interesting read, if you can find it.

      --
      quidquid latine dictum sit altum videtur.
    3. Re:Won't work by Mr2cents · · Score: 1

      I don't believe what you just said! Too much trouble using a non-standard port? -p 12345 is slowing you down? I bet you don't get much work done, with all those troubles you must be having.

      --
      "It's too bad that stupidity isn't painful." - Anton LaVey
    4. Re:Won't work by Anonymous Coward · · Score: 0

      For the really lazy, you can just set the Port option for that host in their ~/.ssh/config.

      Now I don't even have to remember usernames or ports to certain hosts, and with PubkeyAuthentication I don't even have to remember passwords! ssh <host> Just Works(tm).

    5. Re:Won't work by Anonymous Coward · · Score: 0

      I'm not sure what the other guy meant by too much trouble, but I use non standard ports, and it is a pain in the ass. ssh -p, okay fine. Now try that with scp? Oops, that's -P. Sftp? No there is no option to set the port, you have to pass the long ssh option through scp -oPort=??? . when doing that through rsync you end up with an extra -e 'ssh -oPort=xxxx' (-p never works for me with rsync) , and yeah, that is a bit more work than just using the default where you wouldn't have to type anything.

      But no one said security was convinient.

  38. Brute force attacks by Jarlsberg · · Score: 1

    Brute force attacks are the predominant form of attack on my web server, which are host to several large web shops in Scandinavia. Just this weekend, I've gotten tons of requests from 80.18.87.243 and 200.163.190.132. Most attacks come from Italy, South-America, Korea and China... We don't have a root login, and the user logins are restricted, so the login attempts are annoying more than anything else.

  39. Dynamically blocking with iptables by meisenst · · Score: 3, Informative

    I tried to post this in the talkback on the article but it got horribly munged.

    Here are the iptables rules I use to dynamically stop this kind of thing (with a good degree of success):

    # SSH
    -A PREROUTING -m tcp -p tcp -d $EXTERNAL --dport 22 -m recent --rcheck --hitcount 3 --seconds 600 -j LOG --log-prefix "SSH attack: "
    -A PREROUTING -m tcp -p tcp -d $EXTERNAL --dport 22 -m recent --rcheck --hitcount 3 --seconds 600 -j DROP
    -A PREROUTING -m tcp -p tcp -d $EXTERNAL --dport 22 -m recent --set -j DNAT --to-destination $INTERNAL:22
    -A OUTPUT -m tcp -p tcp -d $EXTERNAL --dport 22 -j DNAT --to-destination $INTERNAL:22

    Your mileage may vary. This blocks attempts for 1 minute after 3 attempts (successful or failed, so if someone forgets their password, they may trip it as well).

    --
    Green's Law of Debate: Anything is possible if you don't know what you're talking about.
    1. Re:Dynamically blocking with iptables by meisenst · · Score: 1

      And by 1 minute, I meant 10 minutes... no edit button. Sorry.

      --
      Green's Law of Debate: Anything is possible if you don't know what you're talking about.
    2. Re:Dynamically blocking with iptables by Homology · · Score: 1

      Sweet Jesus, I've forgotten how much iptables syntax sucks. The OpenBSD pf is much, much better than this.

    3. Re:Dynamically blocking with iptables by Anonymous Coward · · Score: 0

      Open BSD - open your asshole fuckwad! No need to insert youyr geeky preferences into every conversation you come across!

    4. Re:Dynamically blocking with iptables by omega_cubed · · Score: 1

      Try blocking it for 5 minutes. I've been using a perl + iptables solution for it. From my log files, I see that the attacking script typically tries for 3-5 minutes after it gets the first connection-time-out.

      --
      Engineers also speak PDE, only in a different dialect.
    5. Re:Dynamically blocking with iptables by cute-boy · · Score: 1
      If you are looking for documentation on some of those options, as I was, I found my man pages to be too old to be useful, however this document turned out to have in information I wanted...

      netfilter-extensions-HOWTO.txt

      -r

  40. Port Knocking + FireHOL by kuom · · Score: 1

    Personally, I find port knocking useful in providing an extra layer of security.

    Some of the systems that I am responsible for, have restrictions on when and how I can apply patches. So if a vulnerability is discovered, if I cannot patch it right away, I am relying on my FireHOL and port knocker to protect these systems. Since implementing these measures (and good security policy), none of these machines have been compromised in three years.

    Of course, saying that, I probably just jinxed it...

    1. Re:Port Knocking + FireHOL by michaelrash · · Score: 1

      Try fwknop. The single-packet strategy it implements provides many advantages beyond port knocking: http://www.cipherdyne.org/fwknop/

  41. Like the prior /. story said, Korea is anarchy by merc · · Score: 1

    Most of the attacks I see originate from Korea. Its gotten so bad that we are finally blocking around 3 class A (CIDR/8) networks from our border routers that belong to KRNIC/KORNET/HANANET.

    I hope they enjoy their intranet.

    --
    It's true no man is an island, but if you take a bunch of dead guys and tie 'em together, they make a good raft.
    1. Re:Like the prior /. story said, Korea is anarchy by Anonymous Coward · · Score: 0

      Dropping China and Korea by iptables (you will still be able to access their servers if you didn't give up on sending complaints there):

      # iptables -N BUBBLENET
      # wget -N http://blackholes.us/zones/country/china.txt
      # for IPRANGE in `cat china.txt | awk '{print $2}'`; do iptables -A BUBBLENET -s $IPRANGE -p TCP --syn -j DROP; iptables -A BUBBLENET -s $IPRANGE -p UDP ! --sport 53 -j DROP; done
      # wget -N http://blackholes.us/zones/country/korea.txt
      # for IPRANGE in `cat korea.txt | awk '{print $2}'`; do iptables -A BUBBLENET -s $IPRANGE -p TCP --syn -j DROP; iptables -A BUBBLENET -s $IPRANGE -p UDP ! --sport 53 -j DROP; done
      # iptables -A BUBBLENET -j RETURN
      # iptables -I INPUT -j BUBBLENET

  42. Mmm... by ledow · · Score: 1

    I've been seeing these sorts of "attacks" in number since I installed my Linux Desktop machine about 6 months ago. I'm only on plain ADSL that isn't published, not like I'm a likely target.

    Every day I get two or three new attackers, most of whom try 50-60 times on common account names (fred, jeff, user, test etc.) and about one a week that goes full-bore for a particular username or a large spread of a few thousand attempts.

    I took the appropriate measures... disallowed root login, use public-key authentication only and I also have a script that checks through my logs once every five minutes, permanantly blacklisting anyone who has more than five attempts within a 7-day period (except for known whitelist addresses).

    Currently, it runs to 390 unique lines of IP's, some of which have come via

    http://www.cyber-defense.org/blacklist.txt

    and at least 50% from my own blacklist. That site (http://www.cyber-defense.org/ incidentally, also notices the same phenemona.

  43. They actually got in on my parent's computer by yorgasor · · Score: 4, Interesting

    I made an account for my dad on my mom's computer so he could have a samba share over the network, and gave it a really easy, completely forgetting that it was also accessible via ssh. Fortunately, I added their computer to my personal DNS domain so I could remember how to get to it easier. Shortly after it was compromised, I got an email informing me that phish spams were being sent from the computer.

    I analyzed the system, and quickly determined that the person was not a big time hacker. Looking at his .bash_history file His only attempt to gain root access was to run 'sudo'. He copied over a list of people to spam, a mail script, and an email. He fired off a test email first, and then spammed the email list. A couple days later, he copied over a different list and message and sent those off. After that, I was tipped off and sealed off his entry.

    Since he made no effort to cover his tracks or avoid detection, either this script-kiddie didn't know how to, or had so many computers to manage it wasn't worth his while to do so.

    --
    Looking for a computer support specialist for your small business? Check out
    1. Re:They actually got in on my parent's computer by Anonymous Coward · · Score: 0

      I also had a clients machine compromised. The client had their domain as the firewall, and useless password security. No matter how much I implored them to move it behind the firewall, they just didn't get it.

      Then they got burned. The attacker got one of the loose passwords and set up a key logger. On the Monday morning, the user logged into the machine to perform the CD burning of backup files, and the keylogger gathered the root password, placed it in a file called /tmp/su, as well as in the users .bash_history.

      The idiot who cracked the machine, logged in almost immediately, and believe it or not, changed the root password. This interfered with operations within the clients office, so they called me, and I found the intrusion pretty quickly. Not too hard to figure out they've been cracked when the admin can't su to root.

      Had them shut down the machine, and replaced the install the next day, with all services behind the firewall at clients request ( funny, now he thinks it was his idea).

      They were fortunate that the person who cracked the box using the script was an idiot. The machine was offline before they could do much with it. The scary part was that the initial crack happened on the previous thursday, but root was not compromised until the monday. That was a potential 4 days of compromise where even as a user they could have wrecked havoc.

  44. First, I put ssh on another port, then... by Dr.+Manhattan · · Score: 3, Interesting
    ... I wrote a program that was utterly immune to buffer overflow and other attacks, and use that program to enable SSH for just the IP address I'm coming from. See the .sig for the details.

    I sleep just fine now.

    --
    PHEM - party like it's 1997-2003!
    1. Re:First, I put ssh on another port, then... by Anonymous Coward · · Score: 1, Funny

      I wrote a program that was utterly immune to buffer overflow and other attacks, and use that program to enable SSH for just the IP address I'm coming from.

      Apart from the commendable fact that you seem to write safer code than those SSH clueless developers, I'm surprised at SSH not having some, you know, way to restrict SSH access to a few IPs. Like a sshd_config directive called RhostsAuthentication. Also I can't believe OSs nowadays don't have a firewall or something to save you the work of doing something as l33t as that program clearly must be.

      Boy, I wanna be like you when I grow up.

    2. Re:First, I put ssh on another port, then... by Dr.+Manhattan · · Score: 1
      Apart from the commendable fact that you seem to write safer code than those SSH clueless developers

      Go read the site. Mine is safer because it doesn't do nearly as much. SSH is complex because it has to be to do what it does. On the other hand, for many purposes SSH is overkill. At no point did I say that the authors of SSH are "clueless", though I'm tempted to say that about you at this point.

      I'm surprised at SSH not having some, you know, way to restrict SSH access to a few IPs. Like a sshd_config directive called RhostsAuthentication.

      But what if I'm travelling and don't even know what IP I'll be coming in from?

      Also I can't believe OSs nowadays don't have a firewall or something to save you the work of doing something as l33t as that program clearly must be.

      Your sarcasm-fu is impressive, but your research-fu is a bit weak. The closest thing to what my program does is port knocking, and that has reliability problems as you increase the security. Not that you, y'know, checked or anything.

      Tell ya what, you point out a remotely exploitable hole in Ostiary, and then I'll bow down before you. I'm not going to hold my breath.

      --
      PHEM - party like it's 1997-2003!
  45. These have been going on for a long time by angst7 · · Score: 3, Informative

    I've been logging and reporting these attacks since last October (when I first started using BFD). I'm figuring they've been going on for a long long time. A simple install of APF and BFD will keep you from having too much trouble though. That and making sure noone is using easy to guess passwords.

    APF and BFD can be got here: RFX Networks.

    --
    StrategyTalk.com, PC Game Forums
  46. 20th Century Authority by handy_vandal · · Score: 5, Insightful

    The article goes into depth on how to monitor these attackes and to report them to the authorities.

    The authorities ... how very ... twentieth-century.

    Better we should self-organize our collective defense.

    Peer-to-peer government -- making the nation-state obsolete, one node at a time ....

    -kgj

    --
    -kgj
    1. Re:20th Century Authority by bhima · · Score: 1

      This has got to be the best, most lucid, most interesting post on slashdot for at least 5 years.

      --
      Nothing in the world is more dangerous than sincere ignorance and conscientious stupidity.
    2. Re: 20th Century Authority by gidds · · Score: 0
      Nice idea, but anarchy is an inherently unstable system. Deep down, in some respects people want authority; they want someone to take charge, someone to stop the Bad Guys, or just someone to blame.

      Let's look at what happens if there's no authority on security, no laws or rules. To start with, the knowledgeable few protect themselves very well; many people do so badly; and many more don't at all. Some Bad Guys come in and have a field day. What happens then? Well, several possibilities. One is that the ignorant masses try to learn how to secure themselves. How do they do that? They don't all know a techie to ask. Maybe some techies decide to publicise their techniques (whether for money, respect, or whatever). But then all it takes is some bad guys to publicise the wrong techniques; how do people know who to trust? The situation is ripe for a central knowledge base -- an authority. Of course, at first it probably wouldn't dictate policy, but that's a strong possibility for where it would go; and then maybe start enforcing that policy too.

      Or take another possibility: maybe the ignorant masses cry to their government or other authority, and get it extended to cover this area too. Or maybe they form vigilante groups or whatever, which become a form of authority.

      Yes, in an ideal world, people would be responsible for their own security; but in an ideal world, there wouldn't be anyone to be secure against. Unfortunately, the Real World(tm) is awkward, and makes us choose between unpleasant alternatives.

      --

      Ceterum censeo subscriptionem esse delendam.

  47. Other Attacking IP's by ToAllPointsWest · · Score: 1

    I've seen these in my logs as well: 168.148.40.58 210.22.153.134 80.55.129.94 195.184.172.1 195.5.57.5

    --
    They came for the Communists, and I didn't object - For I wasn't a Communist; They came for the Socialists, and I didn'
  48. sshdban.sh by Noksagt · · Score: 1
    I have the following script cronned once daily on a FreeBSD box. It bans attempts at logging in with illegal users. My hosts.allow already has the hosts which should never be banned white-listed.

    Once a month or so, I check the list of banned IPs & manually report U.S. ones to the relevant abuse@ email addresses (figuring that they can de-zombify the boxes.
    #!/bin/sh
    cd /usr/local/sbin
    #remove old file entries
    rm ./sshd_block/block.txt
    rm ./sshd_block/new_block.txt
    #This will parse the messages file and extract the sshd lines
    grep sshd /var/log/all.log* | grep 'Illegal user' >> ./sshd_block/block.txt
    grep sshd /var/log/auth.log* | grep 'Illegal user' >> ./sshd_block/block.txt
    #This line will cut only the IP addresses out of that file
    cut -d \ -f 10 ./sshd_block/block.txt | uniq >> ./sshd_block/new_block.txt
    #This line will add The references from new_block.txt to the ssh.blacklist
    target=`cat /usr/local/sbin/sshd_block/new_block.txt`
    for i in $target; do
    echo \ \ ALL:$i:deny >> /etc/hosts.allow
    done
    #remove duplicate entries from ssh.blacklist
    cat /etc/hosts.allow | sort | uniq > /etc/hosts.allow.new
    mv /etc/hosts.allow.new /etc/hosts.allow
    1. Re:sshdban.sh by Anonymous Coward · · Score: 1, Informative

      # You'd like awk
      awk '/Illegal user/ { print " ALL:" $10 ":deny" }' \
      /var/log/authlog | uniq >> /etc/hosts.allow

  49. Why do people use ssh with passwords? by Lord+Bitman · · Score: 2, Insightful

    I just disabled any SSH use without a key. Duh, right?

    --
    -- 'The' Lord and Master Bitman On High, Master Of All
    1. Re:Why do people use ssh with passwords? by Anonymous Coward · · Score: 0

      A number of you idiots have posted the "just disable ssh with passwords" comment.

      What if I NEED ssh with passwords ? I.e., I travel and connect in to check my mail from all kinds of different machines ? What if you connect in from random computers in the lab at school ?

      Another "solution" is to disable ssh completely, or throw your computer out the window, or better yet, shotgun mouthwash yourself and be done with it.

      Please avoid security related "solutions" that correspond to simply using your computer less.

    2. Re:Why do people use ssh with passwords? by Lord+Bitman · · Score: 1

      somebody who's never heard of a floppy disk, how cute!
      (since disabling password-based access, I have actually used my computer /more/, since so long as I'm carrying around my key I also made sure to keep a couple ssh clients for various archs/OSs)

      Floppy disk/Mini-CD/USBKeychain/USBWatch/USBPhone, there's really no excuse.

      --
      -- 'The' Lord and Master Bitman On High, Master Of All
  50. .authorizedkeys by jgercken · · Score: 1

    The solution is to not expose SSH to the Net without disabling interactive authentication. IMHO anyone not using certificates or IP access-lists is being negligent.
    UsePAM no

    --
    Never ascribe to malice what can be adequately attributed to ignorance. -Napoleon
  51. Recent? by LittleLebowskiUrbanA · · Score: 1

    Have been seeing these on my public Linux boxes for 6 months. Trivial to stop. Just allow only unique user names, enforce good passwords, etc...
    Traced one attack from a Windows box in an Ohio school.

  52. Youre, right, this has NOTHING to do with Linux. by DaedalusHKX · · Score: 2, Interesting

    This has to do with Linux getting to the mainstream... people are using lame passwords and leaving unnecessary services with weak passwords open to the public. (Hey, if you'd know how many people **I** alone know that use "password" or "god" or "mom" as their root (*nix/bsd) or admin (windows) passwords. (Or, funnier still, the ones who leave it blank for ease of use.)

    Do people on slashdot NOT know what a brute force / dictionary / wordlist attack is??? It is an attempt to connect to a service, using a random or scripted password and username generator or a list of commonly used ones (root and administrator on various systems obviously comes to mind.)

    Most people use SSH without redirecting it through a trusted tunnelling protocol or connection. There are many ways to secure even the most trivial home network.

    A word to the wise... instead of clicking okay and next mindlessly when installing your OS, start making a practice of READING the warnings and learning something... it should keep the brown fat cells from drowning out your otherwise idle brain as you get older. (IANAMS - I am not a med student, but so I've heard)

    -DaedalusHKX

    --
    " What luck for rulers that men do not think" - Adolf Hitler
  53. easy fix by gyratedotorg · · Score: 2, Informative

    if your ssh server needs to be publicly available, you can always have it listen on a different port. that seems to thwart 100% of these automated attacks.

    --
    Gyrate Dot Org - "Where high-tech meets low-life"
  54. Lame attack == Lame response by Anonymous Coward · · Score: 0

    This lame attack can be thwarted with an equally lame response. Any of the following can stop it:
    a. Change default port from 22 to something else.
    b. Put a delay in iptables for new connections.
    c. Portsentry - Sourceforge
    d. Denyhosts - Sourceforge

    Changing the port number is the easiest, but a delay rule in netfilter is a good way to stop any brute force attack, so it is a generic solution. Portsentry and Denyhosts has the danger that you can lock yourself out, if you are not careful.

  55. may 2005? by gyratedotorg · · Score: 1
    "It was around May of 2005 that these attacks were first brought to light on the "intrusions" mailing list at SANS."

    it should be noted that these attacks have been going on since at least 2003.

    --
    Gyrate Dot Org - "Where high-tech meets low-life"
  56. care with remote hosts by toby · · Score: 1

    Yes, good point. I always try to have more than one machine configured with access for this reason.

    It's also important to revoke keys if the client machine is stolen or otherwise compromised, although passphrases help in this situation.

    --
    you had me at #!
  57. No counter from me by Anonymous Coward · · Score: 0

    I've never understood this either. Once they get in as some other user, can't they just start bruting root via su? If there are better brute protections there than in SSH, then just make the SSH protections more robust...the problem has nothing to do with root.

    Also, if you are not logging in as root simply because you want to make the attacker break two passwords, just make your root password ecompass the keyspace of both of them and it is just as secure as two.

    The 'dont run as root' mantra I don't take much of an issue with, because some exploits can only work if someone is logged in as root on the system at the time... although even then 99% of this advice is just based on the fact that most people do stupid things and root lets them screw it all up worse, not an any real security concern. But not logging in via SSH as root is just ridiculous.

  58. Re:Youre, right, this has NOTHING to do with Linux by Pantheraleo2k3 · · Score: 1

    On Windows, you can't remote login to a user with a blank password. I believe the same is true with Linux.

  59. The ISP's don't care by Anonymous Coward · · Score: 0

    I tracked down an IP to a local ISP in the middle of an attack and the ISP just didn't care. They should do something to the owners of the computers attacking whether their zombies or not.

  60. Tiger Server by koehn · · Score: 1

    One of my favorite features of Tiger Server is that I can enable ssh login (and just about every other service including console login) only for the users I choose. That way, even if one of my lusers' accounts is compromised, the bad guys can't get to a command line.

    Oh yeah, and I (manually) set their shell to /bin/false. That way if I screw something else up, there's no way anybody's launching a shell as them.

    Last, Tiger doesn't have passwords for any of the standard unix accounts, so no amount of dictionary attacking is getting in.

    I'm sure most of these features exist for other OS distros, but it's nice that there's GUI access to them in Tiger Server.

  61. SSHBlack works well by Drakino · · Score: 1

    I just installed SSHBlack.pl the other day on my server to deal with this. It is at http://www.pettingers.org/code/sshblack.html . What it does is monitor /var/log/secure or whatever file has the failed attempts. If it sees 5 failed attempts in a recent time from an IP, it by default adds a new iptables rule fo X amount of days. It also has some protection to prevent a DOS issue from two many IPs being added.

    For me, since I run shorewall, I changed one line to run shorewall drop instead of adding its own iptables rules.

    In 2 days I now have 3 IPs blocked.

  62. Re:Youre, right, this has NOTHING to do with Linux by DaedalusHKX · · Score: 1

    True yes, but that doesn't mean that other services cannot be exploited in such a manner. I recall walking into a server room where the admin pwd was indeed blank. I was authorized to be there, but it didn't really make much difference, the door was NEVER locked (against company policy for those people). Yep, it was a public facility without even any physical security other than 2 renta cops and 4 cameras (main entrances, this being an educational facility) Oh wait... did I mention that this facility's network had access to the entire Novell and Windows network of the local city government?? Yeah I forgot to mention that part.

    Imagine how easy it would've been to install some backdoor or rootkit, as the admin. It would've been THAT poor chap's fault. Simple steps that can prevent a system being rooted are rarely taken. I ended up nearly getting sacked for bringing it up, since "it was not my job to be looking in places where my job description didn't tell me to go". At least the place is a little less hackable now.

    --
    " What luck for rulers that men do not think" - Adolf Hitler
  63. one line... by Anonymous Coward · · Score: 0

    block drop in log on $EXT_IF proto { tcp, udp } \
    from any os Linux to any port ssh

    -> _Zero_ failed login atempts.

  64. Got nailed by something like this about a year ago by (H)elix1 · · Score: 1

    http://it.slashdot.org/~(H)elix1/journal/38378

    I had installed DB2, and used db2admin/db2admin as the default account. Win32 box, but was undead by the time I got back from a roadtrip. Not only do you need to make sure your passwords are strong, but avoid the 'common' passwords folks will set up for a dev account. Looking at my firewall logs for the last year just confirms how fast you will go down if you use a simple/common account and password.

  65. Simple iptables-only port knocking for Linux by Anonymous Coward · · Score: 1, Interesting
    I use simple iptables based port knocking for an added layer of protection. It has absolutely no resistance to sniffing (to find the port sequence), but I don't care about that. It goes something like this:
    $IPTABLES -A INPUT -p tcp --dport 50 -m recent --remove --name SSH_PART2
    $IPTABLES -A INPUT -p tcp --dport 50 -m recent --remove --name SSH_PART3
    $IPTABLES -A INPUT -p tcp --dport 40 -m recent --remove --name SSH_PART3
    $IPTABLES -A INPUT -p tcp --dport 50 -m recent --set --name SSH_PART1
    $IPTABLES -A INPUT -p tcp --dport 40 -m recent --set --name SSH_PART2
    $IPTABLES -A INPUT -p tcp --dport 30 -m recent --set --name SSH_PART3
    $IPTABLES -A INPUT -p tcp --dport 22 -m recent --rcheck --seconds 30 --name SSH_PART1 --name SSH_PART2 --name SSH_PART3 -j ACCEPT
    You have to connect to port 50, 40, 30, then 22 within 30 seconds to actually get to sshd. This way I can access my box from anywhere, but I don't have to leave 22 open. This also has the huge advantage of not needing to log attempts and run a daemon/cron job to periodically check and modify the firewall. The kernel does it all for me.
  66. Thanks by handy_vandal · · Score: 1

    This has got to be the best, most lucid, most interesting post on slashdot for at least 5 years.

    Thanks, made my day.

    In the interest of journalistic balance, it should be noted that I've posted plenty of asinine, ill-thought-out comments in the past five years.

    But I recognized the Authority post as a keeper, the moment the idea came to me. So, thanks again for your affirmation.

    -kgj

    --
    -kgj
    1. Re:Thanks by bhima · · Score: 1

      This is slashdot, if you didn't occasionally show your ass, you wouldn't fit in.

      --
      Nothing in the world is more dangerous than sincere ignorance and conscientious stupidity.
    2. Re:Thanks by handy_vandal · · Score: 1

      ... :)

      --
      -kgj
  67. pam_abl by TimCrider · · Score: 1

    We've been using pam_abl on our server for quite some time and it has been very successful.

    One of our guys actually hacked it so it would use MySQL and iptables to automatically add certain types of offenders to the firewall.

  68. gg, asshat! by Anonymous Coward · · Score: 0
    % find /etc |grep ssh /etc/rc.d/sshd /etc/ssh /etc/ssh/ssh_known_hosts /etc/ssh/ssh_config /etc/ssh/sshd_config

    I've got a .44 you can borrow to shoot yourself with...
  69. temporary accounts by gyratedotorg · · Score: 1
    its interesting to note that these attacks rely heavily on the tendency of a surprising number of (new?) linux admins who create various temporary accounts (eg: username = test) with weak passwords (eg: test). of course, its not uncommon for these accounts get forgotten until the box is compromised...

    this goes to show why even your temporary accounts (if you need them) should have strong passwords.

    --
    Gyrate Dot Org - "Where high-tech meets low-life"
  70. MOD PARENT UP by Anonymous Coward · · Score: 0

    Running apache as root is the real mistake in that case.

  71. Especially Comcast NJ by robogun · · Score: 1

    A skript kiddie from there had been pounding me for months from 68.39.149..
    I've gone back and forth with Comcast but the upshot is: Pound Sand.
    As a result I banned his entire ip range. I had to, his password attacks were coming too fast & blocking out legit clients. This action took out 255 innocent customers of Comcast NJ - but's that's the risk of subscribing to a rogue ISP.

  72. old shit by dillee1 · · Score: 1

    This is hardly news. Everyday there are ~100 such attempts from China and S. Korea (Which have ip range close to me). I just block the /6 ip range and white list someone if necessary.

    Set up a honeypot and track which idiot is behind those bots are much more fun though.

  73. APF + BFD by ManuelKelly · · Score: 1

    I use APF and BFD on servers I manage. BFD will automatically block ip addresses that generate too many invalid login attempts.

    I have been seeing attacks since the server went online, but they have increased recently.

    BFD comes with a 10 minute cycle time. I recently changed it to 1 minute on one of my servers. It looks like the scripts expect it to be running on a 10 minute cycle, since a lot of the attacks start on 10 minute intervals.

    I am blocking 3-10 new ip's per day.

  74. Re:Youre, right, this has NOTHING to do with Linux by Richard+Dick+Head · · Score: 1

    On Windows, oh yes, you can. I've gotten into many computers on the university network with Adminstrator:[blank]. Haven't tried on Linux.

  75. daemonshield.sf.net blocks these attacks by philgross · · Score: 1

    http://daemonshield.sourceforge.net/
    will temporarily block IPs that have more than a certain number of failed login attempts in a certain amount of time. It seems to block these attacks nicely.

  76. So? by kosmosik · · Score: 1

    Just set up SSH auth only with pubkey method. It is more convinient and much safer (but you need to protrect your keys). Also if your system uses PAM you can use pam_tally module to limit login (via PAM - so it covers anything from SSH thru console, X11 and finishing on FTP) attempts to f.e. 3 tries per hour - it will render bruteforce attacks basically useless.

  77. iptables tarpit for ssh password guessing bots? by brian.hall · · Score: 1

    Since attempts to shut these attacking bots down by reporting the source IPs seem to be ineffective, how about using an iptables ruleset that tracks the abusing IPs, and if they fall into that category, put the connection into a tarpit so the scripts stop scanning and guessing? I suppose this would just make the script kiddies use a timeout of some kind, but it seems more satisfying to at least attempt to tie up the resources of these scripted attack bots.

  78. USE Fail2Ban to block brute forcing clients by Anonymous Coward · · Score: 0

    Fail2Ban will monitor any custom log file (mail, ssh, apache, etc) and will ban IPs with the help of iptables.

    http://fail2ban.sourceforge.net/

  79. i've been suffering these attacks for over a year by yodaj007 · · Score: 1
    I used to get 300 of these attacks per day, but sometime last year I wrote a Python script to run through my log file, strip out all the "Illegal user" lines, pull the IP addresses from those lines, and if that IP address hits more than 7 times, add it to the iptables ssh blocking table.

    I changed the port, but my university blocks all the non-standard ports, so I had to change it back or change it to 80 or something, and a friend of mine reported being unable to ssh into it on port 80, so I've left it on the standard port.

    I run the script once a month now and only block a few more addresses each time. I've noticed that most (maybe 80%) of the IP's that I've blocked are from Romania or Italy. Right now I'm adding to the script to detect several IP's from the registered IP range blocks, and to block those entire ranges.

    If anyone wants it, I'll be happy to provide it, but keep in mind that at the moment it doesn't work since I've taken it apart to make these and other improvements.

    One of these attacks got a correct password, back in December. It installed some IRC software and a small SSH program, a script to run these programs under some aliases, and everything was in multiple locations including the users home directory, many directories under tmp, and a few others. Yes, its clearly part of a bot network. The guy writing this article provided so little useful information. I knew more than he did.
    --
    These aren't the sigs you're looking for.
  80. heh` by Anonymous Coward · · Score: 0

    1. nmap -sV an attacker and see the box has a rootkit installed,default port,default pass.

    2. Login,browse,setup a sniffer

    3. Gain access to 13 other hosts

    4. Repeat

    5. Profit?

    1. Re:heh` by Anonymous Coward · · Score: 0

      6. Go to jail

    2. Re:heh` by Anonymous Coward · · Score: 0

      Lets not be too naive now. The groups breaking into these boxes to begin with are not caught....Yet a person who attacks the attackers would be? Yes,it's possible. Likely? Nope...

  81. This has been going on for awhile by Anonymous Coward · · Score: 0

    Recent ssh attacks?
    Bull! This shit's been happening for over a year. I resorted to using tcp-wrappers & restricting IP addresses only to allow access from work to my home systems. I tried to "whois" the accounts & post email to the abuse email accounts, but most of this shit is happening from countries that don't give a damn what their people do on the internet. I'd like to see all access to those countries dropped from the internet, and that will solve the problem.

  82. CPU Usage by lullabud · · Score: 1

    I see these frequently on my Mac, and while I'm positive they'll never get in due to AllowUsers, it's incredibly irritating when my CPU starts heating up crunching encryption for long periods of time. That's usually how I realize what's going on, then I notice my CPU bar going steadily about 20% or so above usual usage, and my network bar with constant minimum traffic. Really, really irritating, and I honestly haven't got a good excuse for not switching to a non-standard port... In fact, I'll just do that right now. What would be awesome though is a counter-attack honey pot shell on my Mac. Then I could just let them have access and watch them go down.

  83. Does obscurity help here? by Anonymous Coward · · Score: 0

    Yes, I know security through obscurity is generally bad, but I have two boxes, one that runs sshd on a different port (so they don't conflict). I just looked at my logs again.. the one on 22 is still going (I did notice these attacks before and kinda freaked.. before it started getting reported in the news). But there have been no attacks to the box on the other port.I just closed port 22 on my firewall, so now you would have to go through the other box...
    What do you think? Stupid annoying attacks can have stupid annoying solutions? Or no? (That is, if you do all the other stuff.. no root logins... strong passwords.. etc...)

    1. Re:Does obscurity help here? by Sjobeck · · Score: 0

      Yes, a little. We move all SSH daemon to high numbered non-standard port numbers, which does a coupel of things, no it does not remove the issue, but it does let Snort have a chance to see the port scan taking place, looking for the SSH daemon, then we can do something about that, if the casual snooper has not given up by then.

      We are also working in the use of "fwsnort" & "blockhosts".

  84. never, via ssh by toby · · Score: 1
    ONLY allow public key authentication. I've never seen such a box compromised remotely

    It cuts the risk of someone guessing a password, but doesn't eliminate the chance of an exploit in ssh or elsewhere. As you say, have as many layers of security as possible. (I've never seen a compromise on my ssh servers either, touch wood.)

    --
    you had me at #!
  85. Host solution by kyndig · · Score: 1

    I ran into this problem some time ago. I had a client account that was logged into with this brute force attack. Luckily the client was in the shell at the time and terminated the login, then notified me about the problem. I went to the drawing board immediately. This is the solution I use across my small network farm of Linux servers.

    Read the common server log files with a PHP script and wrapped through the PAM authentication module ( a quick call for the script through /etc/hosts.deny ) /var/log/messages /var/log/secure /var/log/xfer.log /var/log/maillog
    using regular expression, determine any failed password attempts. This gets tricky when dealing with RedHat boxes, as the logger will compress numerous "like" messages in something similiar to: "Last message repeated x number of times". Keeping this in mind, check for failed logins for _any_ account by the same IP X number of times.

    What I found was the brute force scripts used numerous names: admin, root, webmaster, user, temp, etc.. ; therefore you are unable to use the detection system on a per-user basis, instead it must be per-IP basis.

    If the IP attempts X number of failed logins, ban them in /etc/hosts.deny and add them to the firewall through IPTABLES.

    Problems that arose due to this:
    Some clients are just all thumbs on the keyboards. To augment this, a modification to the script to first read /etc/hosts.deny is performed. If an IP is already in /etc/hosts.deny, then do not block it. I will manually go into /etc/hosts.deny and #comment out any valid user IP to prevent them from triggering what I call 'the mitigator'.

    This system has worked to prevent ssh brute force and rumple style dictionary bombing against sendmail.

    The only problem I have run into with the script was when I ported it to a new server and forgot to add that servers IP to a 'safe_list'. Oops. A quick firewall flush though fixed the issue and the mitigator was back in business.

    --
    My Thoughts, Kyndig
  86. just increase your delay length by 5plicer · · Score: 1

    If you increase the time between successive login attempts, you basically eliminate the threat of brute force on SSH. If someone is only allowed to try logging in once every 3 seconds, it's pretty unlikely that they'll get the correct password anytime soon.

    --
    The bits on the bus go on and off... on and off... on and off...
    1. Re:just increase your delay length by Bodysurf · · Score: 1

      And just how would a normal user go about doing that? One that can't grok C, I mean?

    2. Re:just increase your delay length by Anonymous Coward · · Score: 0

      well, it depends on your system. On AIX, for example, you could edit logindelay in /etc/security/login.cfg

  87. anyway to do this with plain cisco routers? by Anonymous Coward · · Score: 0

    Is there a way to auto-route to 0.0.0.0 for these people with cisco routers?

    (using a cisco routers with lots of rules as the "firewall" opened up just the ports that are necessary inbount AND outbound)

  88. fail2ban by imogthe · · Score: 1

    For anyone experiencing SSH attacks, I suggest you have a look at fail2ban http://fail2ban.sourceforge.net/. I got fed up with random script kiddies trying to bruteforce my DSL connected box. Now all repeated SSH authentication failures are iptable'd to a tarpit:)
    This may of course not be suitable for everyone, as it creates potential denial of service conditions. Caveat Emptor.

    1. Re:fail2ban by yarikoptic · · Score: 1

      And it is packaged for debian and is entering the distribution so apt-get it ... in a day or two

  89. People are lazy.. by msimm · · Score: 1

    I work as a systems administrator. Thats the first thing I suggest when someone actually starts paying attention to the logs. I invariably get a similar cross-eyed look.

    Maybe they find it more exciting to talk about then to address.

    --
    Quack, quack.
  90. Why? Convenience. Duh. by Anonymous Coward · · Score: 0

    I can keep a password in my head. I can't do that with a key.

  91. mmm, yummy pies in your sky! :) by Xtifr · · Score: 1

    Yeah, 'cause you should definitely limit your options as much as possible. How about doing BOTH? Frankly, my expectations of what "the authorities" will do is pretty low, but then my expectations of this "peer-to-peer government" you speak of is also pretty low, especially at present (since it doesn't exist yet).

    It's easy to have high expectations of organizations that haven't been formed. Frankly, I suspect that this peer-to-peer organization you have in mind will have all sorts of unexpected problems in practice. I mean, democracy looks good on paper too. But I'm willing to wait and see. In the mean time, I'm going to try to take advantage of the infrastructure that does exist. I may be a cynic, but I'm a practical one.

  92. I've also noticed this by astralbat · · Score: 1
    Strangely enough, I only noticed this today while looking through my logs that there have been a number of attempts on my system within the last couple of months. It seems there must be some script going around because the same usernames that the article lists also appear in my logs.

    I was a little worried and decided to look around the web to see what I could do. I heard a couple of mentions of disabling password authentication and going for something like RSA public key authentication instead. This means the client provides a public key that the server already allows through and the client proves it's the owner of the public key by signing something with it's private key. This is more secure, but it's not possible to connect from an unknown client easily.

    Another interesting way of increasing security is to implement a port-knocking strategy.. I'm not sure myself how much effort this would take, but again, it does perhaps make connecting from secure clients more difficult.

    After looking into that, my solution was to simply change my passwords to non-dictionary words. But with the ever increasing CPU power and distributed networks out there, how long before memorable passwords fail altogether?

  93. open source constitution by handy_vandal · · Score: 1

    Nice idea, but anarchy is an inherently unstable system.

    I'm not calling for anarchy, it's a bad way to live.

    Think of how the Greek city-states learned to develop constitutions, entered into by a relatively large proportion of citizens (exclusive of slaves and women, of course), and debated in the agora. Some constitutions suited their cities; some were less successful; but in any case, men learned to collectively develop laws by which they reasoned they could live. We're speaking here of the sixth, fifth, fourth centuries B.C.

    Fast-forward to our time. We have the technological means to develop new institutions, in the manner of city-state constitutions but suitable for our modern global survival. This is what I mean by peer-to-peer government: open source code, collectively developed and debated, of benefit to all and malice to as few as possible.

    -kgj

    --
    -kgj
    1. Re:open source constitution by Anonymous Coward · · Score: 0

      A decentralized government - built on the same fundamental design principles that governs the Internet - I like it! And the geeks shall inherit the earth! Mwuhahahaha! Umm, you think I could get chicks if I became one of it's politicians? I mean, if Clinton can then.. well, y'know =P

      <imagines>
      - Senator Anonymous Coward, how do you feel about proposition AC37337?
      </imagines>

      Hehe, I like the sound of that. When do we start?

      -ac

  94. Seeing these weekly by mi · · Score: 1
    My dad's computer -- on RCN's network -- is probed quite often.

    The automated script runs through the default logins such as "root", "toor", "daemon" -- which on FreeBSD would not be able to login remotely even if attackers could guess the password.

    I've configured syslog.conf to feed ssh's notifications of such attacks to a simple script, that routes the attacker's IP into blackhole...

    --
    In Soviet Washington the swamp drains you.
  95. OOPS! by gsasha · · Score: 1
    Just checked, my comp appears to have loads of these.

    Checked the originating address - FSCKing students from India!

  96. Yet another direction by einhverfr · · Score: 1

    I think in yet another direction.

    I limit accounts on the externally accessible system to those who need access from outside the network, require key-based authentication, and strungly encourage users to passphrase-protect their keys.

    And I get over 300 authentication failures a day *without* allowing password attempts.

    BTW, I know of someone who had allowed an account with a weak password to be accessible via SSH over the internet and was compromised by this sort of attack. Once they break in, they usually install a root kit and set up scripts to scan for other systems. It is sort of a classic zombie attack. One wonders if this process is sufficiently automate to be considered a worm...

    --

    LedgerSMB: Open source Accounting/ERP
  97. vision is good, but practical pay the bills by handy_vandal · · Score: 1

    my expectations of this "peer-to-peer government" you speak of is also pretty low, especially at present (since it doesn't exist yet). It's easy to have high expectations of organizations that haven't been formed. Frankly, I suspect that this peer-to-peer organization you have in mind will have all sorts of unexpected problems in practice. I mean, democracy looks good on paper too. But I'm willing to wait and see.

    Quite right, my so-called peer-to-peer hasn't emerged ... it may be emergent, I don't know. Nor am I very confidant of how things might turn out -- really, I'm like you -- I'm willing to wait and see.

    Interesting that you mention how democracy looks good on paper ... see my post regarding Hellenic city-state constitutions and the development of modern open-souce government.

    In the mean time, I'm going to try to take advantage of the infrastructure that does exist. I may be a cynic, but I'm a practical one.

    Agreed, I'm with you. I omitted this line of thought from my original post, to more sharply define my manifesto. But of course we must be practical: vision alone does not pay the bills.

    -kgj

    --
    -kgj
  98. Knowing password length helps by po8 · · Score: 1

    "We can eliminate a huge portion of the search space by only searching passwords of length x"

    Nope! This is the beauty of iterative deepening. The number of possible (7-bit) passwords of length x is 128**x. The total number of possible passwords of length less than x is also 128**x. So, if you just search passwords in order of increasing length, it will cost you at most twice as much to search all passwords of length less than or equal to x as to just search passwords of length equal to x.

    The vulnerability is just that you can watch ssh connections going by on the network and find accounts with short passwords.

    1. Re:Knowing password length helps by feronti · · Score: 1

      That's true. But by starting closer to the solution, we increase the probability of finding a solution earlier. So, while the improvement on a brute force search would probably be negligible, a more intelligent dictionary attack would more often find an early solution, thus the effective search time is decreased.

      When you're talking about search spaces this big, any amount of intelligence you can add to cut down the size of the search space helps.

    2. Re:Knowing password length helps by Mr+Z · · Score: 1

      Of course, though, knowing that it's "no longer than x" stops you from searching that much larger space of passwords longer than x.

    3. Re:Knowing password length helps by Everleet · · Score: 1

      The total number of possible passwords of length less than x is also 128**x.

      Nope, not even close. The number of possible passwords of length less than x is 128**x / 127 - 1, a miniscule fraction of the number of passwords of length x.

      --
      It's tragic. Laugh.
  99. 200 to 300 *per zombie* by Chris+Snook · · Score: 1

    I've been getting a few of these per day, so that's more like a thousand per day. So far none of them have guessed my root password, which is 12345.

    --
    There's no failure quite as dissatisfying as a complete and total solution to the wrong problem.
  100. Quick copypaste... by Anonymous Coward · · Score: 0

    ...for all the lazy slashdotters on some linux box.

    iptables -A INPUT -p tcp -m tcp --dport 22 --tcp-flags SYN,RST,ACK SYN -m recent --update --seconds 180 --name SSH --rsource -j DROP

    iptables -A INPUT -p tcp -m tcp --dport 22 --tcp-flags SYN,RST,ACK SYN -m recent --set --name SSH --rsource -j ACCEPT

    Usually they're not that patient...

  101. Indeed by jayloden · · Score: 1

    I get these all the time on every system that's internet accessible, including on my cable internet connection. It's pretty clearly lots of different people using similar scripts, since they always try the username "Patrick", for instance.

    As others have noted, changing the port makes them stop, and it's a good idea to use the AllowUsers directive in sshd_config to only allow access for people that absolutely need it. Don't allow root access from ssh directly, because if they do somehow get your ssh password, it's better that they don't get root at the same time at least. Lots of other people were arguing over the value of disallowing direct root logins, but for me it's as simple as separating the break-in from the privilege escalation. :)

  102. IDS: swatch + portsentry by mokeyboy · · Score: 1

    You can defend against these attacks by installing and implementing "swatch" a perl based script that you can use to execute commands (eg iptables blocking). This can be done by tailing /var/log/messages or your relevant log file dynamically or by passing swatch over historic files. This has worked well since Nov/Dec 2004 when this was reported to AUSCERT. You might also like to look at "portsentry" which can watch for probes and block using iptables rules (takes out Windows machines infected with viruses for instance). Both systems have exclusion rules that allow internal traffic to transmit normally.

  103. My box was compromised by this by Malc · · Score: 3, Interesting

    A few months back my Debian Woody system was compromised by this. I had major security issues: a weak password and an old unpatched kernel.

    I got up in the morning and looked at my logcheck emails. It was odd: there were messages saying the ethernet card had entered promiscuous mode, and several kernel modules loaded. Further investigation revealed two connections to remote port ircd, but netstat wouldn't show the process ID(s) that owned this connections. The machine was in a mess: I couldn't run man, or gzip (needed by the apt-get process) and several other key commands as they immediately seg faulted. Rebooting resulted in the same issues: ethernet card in prom. mode, etc. Perhaps a packet sniffer was running on my networking looking for passwords to upload.

    My problems started when I created an account for a friend and gave it a weak password without making him change it. The ssh dictionary attack broke in that way. Furthermore, I wasn't running a normal Debian kernel. Instead one that somebody else had created with MPPE support (it would be nice after all these years if one could have MS-CHAP support for PPP straight out of the box). I hadn't kept tabs on the kernel notices and ensured that this kernel was ok with them - it hadn't been updated for at least a year. Thus the script that broke in via SSH was able to exploit a local security hole and elevate privileges - game over.

    I write all this as a reminder to people to take care. Debian is fairly secure if you use standard packages and keep them up to date. I'm generally quite carefull about what I install, which services run, what ports are exposed to the internet, keeping and eye on it, etc. Two careless mistakes and I had to rebuild the system and change all my passwords - thankfully nothing more. Be warned.

  104. It's easy to get tools for that by Anonymous Coward · · Score: 0

    Some googling shows:

    http://www.frsirt.com/exploits/08202004.brutessh2. c.php

    Still requires some additional effort, in getting a password database, and some additional functionality, but it seems to be easier than I thought.

    I wonder where all those attacks are comming from. Somebody probably must be fairly sure he doesn't get prosecuted.

  105. sshdfilter by leighklotz · · Score: 1
    I'm surprised nobody has mentioned sshdfilter:

    sshdfilter blocks the frequent brute force attacks on ssh daemons, it does this by directly reading the sshd logging output and generating iptables rules, the process can be quick enough to block an attack before they get a chance to enter any password at all.

  106. Turtle-headed keys by fcw · · Score: 1

    Is a passworf some kind of Klingon security measure? If so, then I bet it looks tough, but somehow always gets defeated first by the bad guys.

    1. Re:Turtle-headed keys by Lennie · · Score: 1

      I doubt Klingon use passwords, they'd probably use the other kind of brute force, I'm sure.

      --
      New things are always on the horizon
  107. IPv6 vs Brute force scans by tialaramex · · Score: 1

    These are blind scans, the attackers are searching the entire routable IPv4 space (actually they may even be searching unroutable space although obviously that will just slow them down).

    If at any time 10% of Internet addresses actually lead to a machine that's switched on, and 5% of those machines are running a Unix of some kind (these numbers are probably a little wrong, but not by an order of magnitude) then typically 1-in-200 addresses scanned will answer a SSH connection, at that point the attacker tries a few dozen (or hundred in some cases it seems) user+password combinations and then moves on to someone else. They're probably scanning hundreds of thousands of machines every day in this way.

    BUT.. let's try that again with IPv6 addresses. Under the present scheme for unicast address assignments blind jumps into the routable address space probably only have a 1-in-a million billion chance of hitting any machine at all choosing at random -- they'd need to scan a million billion times as long to get the same results, or to put it another way, you'd get scanned a million billion times less often.

    I don't know about other readers, but despite daily encounters I haven't been scanned even _one_ million billion times yet, so making this problem a million billion times smaller seems like it would effectively go away completely.

    So far experience bears this out, of course IPv6 isn't that widespread yet, so it could be that somehow no bad people are using it, but I suspect the vast address space simply makes scans prohibitively expensive. The daily logs I read show a fair few attempts with IPv4, but no unexpected connections using IPv6.

  108. I've never had trouble with sshd after this: by hacker · · Score: 1

    Since I can't take the risk of one of my users choosing a weak password, I've simply locked sshd down. Easy to do, and keeps things sane.

    One of my friends had his box broken into because a user on his machine had a weak default password. The maliscious person got in, replaced sshd, and started capturing all failed login attempts. Since most of us had authorized_keys set up, when we tried to log in and were prompted for a password, we got suspiscious. Other users would try their password several times and give up. Those passwords were being sent back off to some site in Russia or Slovenia or something.

    The other interesting prong of this attack was that the users who failed to log in and "handed" their password to the attackers, had their ~/.ssh/known_hosts scanned for external hosts they've connected to, and the username + password they just used was attempted on those other hosts, propagating the attack further.

    The following short script firewalls off port 22 for unknown hosts. Simply add the IPs of your users or netblocks you connect from, and you're done.

    #!/bin/bash
    sshhosts="127.0.0.1 10.0.1.0/24 1.2.3.4 5.6.7.0/24";
    for sshhost in $sshhosts; do
    iptables -A INPUT -j ACCEPT -p tcp -s $sshhost --dport 22
    done
    iptables -A INPUT -j DROP -p tcp --dport 22
  109. stop brute force with swatch by deadlocked · · Score: 1

    ---------
    #!/bin/sh
    pfctl -t blacklist -T add $1
    echo $1 >> /etc/blacklist
    logger swatch: $1 caught with bad login. Added to blacklist pf table
    ---------
    ---------
    rc.conf:
    swatch_enab le="YES"
    swatch_rules="1"
    swatch_1_flags="swatch --config-file=/root/.swatchrc --tail-file=/var/log/auth.log --awk-field-syntax --daemon --pid-file=/var/run/swatch.pid"
    swatch_1_user="ro ot"
    swatch_1_pid="/var/run/swatch.pid"
    ---------

    pf.conf:
    ---------
    table <blacklist> persist file "/etc/blacklist"
    block in quick log on $WANIF from <blacklist> to any

  110. Ways around SSH Brute forcing by meridian · · Score: 1

    There are esentially three ways to fix this problem.
    The first is to patch sshd which is probably the least preferable way as you would need to continually keep patching with each upgrade. But this seems effective allowing you to exec a system command such as iptables.
    http://ethernet.org/~brian/src/timelox/

    The second is to use iptables to limit connection attempts from an IP address. One problem with this is people who use scp alot may quickly rack up that connection limit.
    Here is a recent example from the iptables mailing list
    iptables -A INPUT -p tcp --dport 22 -s ! $My_Home_Firewall_IP -m state --state NEW -m recent --name SSH --set --rsource -j SSH_BF
    iptables -A SSH_BF -m recent ! --rcheck --seconds 60 --hitcount 3 --name SSH --rsource -j RETURN
    iptables -A SSH_BF -j LOG --log-prefix "SSH Brute Force Attempt: "
    iptables -A SSH_BF -p tcp -j DROP

    The best in my opinion is a pam module found at http://www.kernel.org/pub/linux/libs/pam/modules.h tml called pam_abl
    This does not have the problem of the IPTables method that may mistake multiple fast scps etc as an attack attempt, and will not require coninutal repatching of the kernel such as the timelox patches.

    Lastly you probably want to lock down ssh somewhat using the below config lines, primarily changing the PermitRootLogin to either no or without-password.

    Protocol 2
    PermitRootLogin without-password
    # disable skeys
    PasswordAuthentication no
    ChallengeResponseAuthentication no
    ClientAliveInterval 60
    ClientAliveCountMax 30

    --
    meridian at tha.net
  111. Deception Tool Kit by Anonymous Coward · · Score: 0

    Another approach is shown in the Deception Tool Kit. DTK is a collection of scripts which connect to unused ports and appear to be various servers. When many servers use it, a forest is created which helps hide individual trees.

  112. Boring article by AtomicJake · · Score: 1

    The article describes one attack method known as dictonary attacks on SSH ports of *nix systems. This attack method is known by ALL system administrators -- since years. It is even known to newbies that happen to read the manual.

    So, nothing new here. And it is definitely not an article that goes "into depth on how to monitor these attackes and to report them to the authorities" and it also does not discuss various tools, but simply name some.

    So, just a superfluous posting...

  113. Hah, thanks... by DaedalusHKX · · Score: 1

    A Windows XP computer, joined to a Windows 2003 domain with password auditing enabled will not allow you to share its terminal services ports 3389 or 3391 without having a password.

    When you try to share it out, it "should" request that you set a pwd. Of course, knowing Windows, nothing Microsoft ever does is either stable, or of any relevant quality.

    In the end, they and their greedy colleagues in the IT industry and business community just bully everyone else into accepting their way and selling their shit to the rest of the world.

    --
    " What luck for rulers that men do not think" - Adolf Hitler
  114. Anti-attack heuristics by typical · · Score: 1

    Currently, we have a complex set of heuristics that get used to help stop spam, yet our decisions to help stop random attacks coming in from the network are almost entirely non-heuristic.

    I could see software that decides that an IP that has hit me twenty times with an incorrect password over the past week without ever successfully logging in correctly is not a legitimate user.

    We shouldn't ever rely on heuristics alone for security, but I could see them being a useful addition.

    --
    Any program relying on (nontrivial) preemptive multithreading will be buggy.
  115. Re:Youre, right, this has NOTHING to do with Linux by Anonymous Coward · · Score: 0

    You are so wrong. You can definitely remote login to the Administrator account, even if it has a blank password.

  116. The approach that works for me... by padamj · · Score: 1

    I manage a few hundred linux installations and in order to give avoid such issues and make management easier, I have created a shell wrapper.

    The shell wrapper works exactly like the ones found on any router, it allows you to change the service configuration, and do diagnosis like ping and traceroute. If you need "shell" access, you just login as another user.

    Here I have had cases where a few of these have got broken in because of weak root password, but no damage is possible because access the commands available are only a few ones, and none of them give access to the filesystem or allow launching generic processes. So probably the script sends commands to "infect", the shell simply replies with a "command not found".

  117. Brute Force Atttacks? by Sounder40 · · Score: 1

    Oh, you mean like this from yesterday on my little Linux box?

    sshd:
    Authentication Failures:
    root (38.117.242.11): 3370 Time(s)
    unknown (38.117.242.11): 369 Time(s)
    unknown (110076.ntpu.edu.tw): 3 Time(s)
    games (38.117.242.11): 2 Time(s)
    news (38.117.242.11): 2 Time(s)
    nobody (38.117.242.11): 2 Time(s)
    ntp (38.117.242.11): 2 Time(s)
    operator (38.117.242.11): 2 Time(s)
    postfix (38.117.242.11): 2 Time(s)
    sync (38.117.242.11): 2 Time(s)
    unknown (mail.tskt.co.th): 2 Time(s)
    uucp (38.117.242.11): 2 Time(s)
    adm (38.117.242.11): 1 Time(s)
    apache (38.117.242.11): 1 Time(s)
    bin (38.117.242.11): 1 Time(s)
    daemon (38.117.242.11): 1 Time(s)
    dbus (38.117.242.11): 1 Time(s)
    ftp (38.117.242.11): 1 Time(s)
    gdm (38.117.242.11): 1 Time(s)
    gopher (38.117.242.11): 1 Time(s)
    halt (38.117.242.11): 1 Time(s)
    lp (38.117.242.11): 1 Time(s)
    mail (38.117.242.11): 1 Time(s)
    mailnull (38.117.242.11): 1 Time(s)
    named (38.117.242.11): 1 Time(s)
    nfsnobody (38.117.242.11): 1 Time(s)
    nscd (38.117.242.11): 1 Time(s)
    pcap (38.117.242.11): 1 Time(s)
    root (110076.ntpu.edu.tw): 1 Time(s)
    root (mail.tskt.co.th): 1 Time(s)
    rpc (38.117.242.11): 1 Time(s)
    rpcuser (38.117.242.11): 1 Time(s)
    rpm (38.117.242.11): 1 Time(s)
    shutdown (38.117.242.11): 1 Time(s)
    smmsp (38.117.242.11): 1 Time(s)
    squid (38.117.242.11): 1 Time(s)
    sshd (38.117.242.11): 1 Time(s)
    vcsa (38.117.242.11): 1 Time(s)
    webalizer (38.117.242.11): 1 Time(s)
    xfs (38.117.242.11): 1 Time(s)

    A little out of control, if you ask me.

    --
    A clever person solves a problem, A wise person avoids it. -Einstein
  118. Disagree. Use 22, plus ports 0, 53, 80, 88, 443 by Anonymous Coward · · Score: 0

    Many people suggest having no ssh daemon listening on port 22. I
    suggest having an ssh daemon on port 22, and also on at least four
    other ports. My goal is to reach my home machine from anywhere, even
    from an arbitrary wireless network where I have no control over the
    policy for outbound TCP. The outbound TCP policy might allow only one
    port. I run ssh daemons for all of the common one-allowed-port cases:

    port 22 - certainly there are networks that allow outbound SYN packets
    only on port 22. Often occurs when the net admin uses ssh himself.

    port 80 - very common, especially on networks where the admin forgot
    to also allow 443. Or the admin blocked 443 to stop online shopping.

    port 443 - if this is the only allowed outbound port, it usually means
    that clients are supposed to use a proxy server for port 80.

    port 53 - the admin read that blocking DNS was bad, and figured it'd
    be simplest to allow port 53 UDP and TCP from all machines.

    port 88 - usually means the network was designed to allow Kerberos
    traffic outbound. See http://support.microsoft.com/kb/811832

    Another handy step is to hack your laptop and your home machine to
    support ssh on TCP port 0. This works around a 1-65535 firewall rule.

  119. Please post it. by Inoshiro · · Score: 1

    I'm sure that there are plenty of people, like myself, who have deployed other IDS tools, but don't have time to re-write it :)

    --
    --
    Internet Explorer (n): Another bug -- that is, a feature that can't be turned off -- in Windows.
  120. Web-based variant of port knocking by Anonymous Coward · · Score: 0

    One technique that has worked very well for me is to close the ssh port to all IPs except those on a whitelist. I can't use a static whitelist since I need to allow logins from anywhere. So I add IPs to the whitelist using a web page that users must access first. The URL is kept secret, and there aren't any links to it, so the URL itself is a kind of password; and of course I could easily protect the web page with a password too.

    There is a CGI script connected to the web page that adds the IP of the requester to the whitelist. (This almost always works automatically for me, since the CGI script gets the IP address of the browser that requested it; this will be the correct IP to add to the whitelist unless the web request goes through a proxy.) IPs are removed automatically from the whitelist by a cron job.

    This is essentialy a variant of port-knocking, except that you don't have to try to tell unsophisticated users to go to some complicated sequence of ports; they just have to go to a web page, which is something that's pretty easy to understand. You can also use it to protect any port where you're worried about password security (e.g., an IMAP port, etc.).

    I get many probes on my ssh port every day, but I get no failed ssh logins. So for the moment this technique seems to have substantially reduced the danger of a breakin through the ssh port from some random machine.

  121. simple fix for my redhat server by cruel_elevator · · Score: 1

    This goes in /etc/hosts.allow

    sshd,sshdfwd-X11: 192.168.0.1

    This goes in /etc/hosts.deny

    sshd,sshdfwd-X11: ALL

    Replace the IP with yours. If you don't have a static IP then put in your netblock. I didn't really have break-in but got sick of seeing hundreds of failed attempts in my system log. After I'd put those lines in I don't seem to get any more attacks.

    C.E.

  122. Well there you go by ross.w · · Score: 1

    yet another attack due to poor security in Windows. If only everyone used Linux, we'd stop these attacks dead in their tracks...

    wait a minute...

    Nevermind.

    --
    If my call is important, why am I talking to a recording?
  123. Subject by Legion303 · · Score: 1

    I filter by MAC for my internal network and by a single IP so I can get to it from work if I need to. It's not a perfect solution, but the script kiddies are shit out of luck.

  124. I think OTP passwords are more secure. by GekkePrutser · · Score: 1
    I don't think RSA keys are very safe. Ok, they stop remote brute force attacks, but remember your users will most likely keep their RSA keys on a Windows machine, where they are likely to be compromised due to a trojan horse, spyware, exploit, etc. Once the attacker has got control of the RSA key file, brute-forcing the password on it is fairly easy as they don't need to connect to your system to do it. They can just run a very fast brute-force attack on the encrypted keyfile locally, trying thousands of passwords per second.

    So instead of having to worry about your computer being compromised, you now have to worry about ANY of your users' computers being compromised, over which you have no control at all. Epecially if you have sudo users.

    For this reason I prefer using OTP keys (S/Key for example). They use a program that generates a different (very long) password every time. A bit like the RSA SecurID token thing does. It's much more work and it's very obvious (you get a challenge asked before connecting) but it is even secure against keylogging on your users' computers, if they are using a key calculator on a different device (I have them on my Palm and Java-enabled mobile phone).

  125. no idea by epine · · Score: 1


    OK, if I were to write a daemon for my zombie Linux cluster that originates SSH root login attempts to machines distributed world wide, I would have no idea that any of my zombies might be passively monitored by any of the systems where my zombies have tried to slip their digits into the root user hotpants.

    What the author meant to say is that the attacker would have no idea that this particular host was engaged in passive monitoring. Whoopee dig doo. The puppet master of a zombie cluster has no awareness of any host it zombines are bombarding until some wall is breached.

    Let's make this even more colourful. The internet is a like a giant, super crowded night club where the vast majority of the patrons are so drunk or drugged up they fail to even notice random hands prying into their pants. Yes, the internet is pretty darn strange in some ways. And what a clever mode of attack we must confront.

    Spare me. Save your breath on this point for a future article about administrating a honey pot.

  126. Please google for it. by jms1 · · Score: 1

    I'm sure that there are plenty of poeple, like myself, were able to find it in less than ten seconds.

  127. Add Allowgroups to /etc/ssd/sshd_config by Dark$ide · · Score: 1
    I added:

    • AllowGroups dialout

    to /etc/sshd/sshd_config so that only users connected to the dialout group can connect from remote addresses.

    That way I have total control of which ids can use SSH.

    --

    Sigs. We don't need no steenking sigs.

  128. A possible solution? by zeth · · Score: 1

    On my server, one can login either using OTP or public key.

    It's working nicely for me, as it allows me to conveniently log in from my own computer using public key, and when I login from other computers, I just fire up an OTP client on my phone and log in.