Slashdot Mirror


The Optimum Attack Rate For SSH Bruteforce? Once Every Ten Seconds

badger.foo writes "Remember the glacially slow Hail Mary Cloud SSH bruteforcers? They're doing speedup tweaks and are preparing a comeback, some preliminary data reported by Peter Hansteen appear to indicate. The optimum rate of connections seems to be 1 per ten seconds, smack in the middle of the 'probably human' interval."

167 comments

  1. WTF, Editors? by Anonymous Coward · · Score: 0, Insightful

    WTF is a "Hail Mary Cloud"?

    I clicked the link in the summary, which talks about something I'm supposed to "remember", but must have missed the first time it was discussed. That goes to another summary that also doesn't explain what it is, but also mentions that it's been discussed before. Then I click the link on that summary and I get a big long page of information.

    Does anyone review submissions at all before they go live?

    1. Re:WTF, Editors? by Anonymous Coward · · Score: 0

      WTF is a "Hail Mary Cloud"?

      From the link: "cloud of distributed, password-guessing hosts"
      I thought of it as a possibility when I first started using fail2ban, but I first saw it happen with Mac OS X machines (for some reason, the botnet would target only OSX hosts).

    2. Re:WTF, Editors? by Samantha+Wright · · Score: 4, Informative

      It's the name of a botnet. Assume any unfamiliar word in any Slashdot summary is the name of a botnet; it makes them eminently more readable. You can try out the technique on this one.

      --
      Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
    3. Re:WTF, Editors? by Anonymous Coward · · Score: 0

      So you've learned something in just two clicks. What exactly are you complaining about?

  2. Passwords are for philistines by halber_mensch · · Score: 5, Informative

    RSA keypair auth, disable password auth, bruteforcers irrelevant.

    --
    perl -e "eval pack(q{H*},join q{},qw{70 72696e74207061636b28717b482a7d2c717b343 637323635363534323533343430617d293b})"
    1. Re:Passwords are for philistines by aztracker1 · · Score: 3, Insightful

      RSA key/pair is something you have... you still need something you are, and something you know... Once someone has your key, it's no more secure than your password. A trojan can read local files, just as easily, if not more so than snoop for a password.

      --
      Michael J. Ryan - tracker1.info
    2. Re:Passwords are for philistines by the+eric+conspiracy · · Score: 4, Interesting

      Anyone see these guys on a port other than 22?

    3. Re:Passwords are for philistines by 0racle · · Score: 4, Insightful

      If you have a trojan keylogger, you probably don't have to worry about SSH bruteforcing.

      --
      "I use a Mac because I'm just better than you are."
    4. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      Sloppy and careless thinking about security is worse than no security. The questions "What do I have?", "What am I?" and "What do I know?" all live in the provinces of theology and philosophy. Computers should try to pass the Turing test first.

    5. Re:Passwords are for philistines by allo · · Score: 2

      soon computers will pass the tests better than humans.

      there are two types of tests:
      - ones with a rather small set of human-made puzzles, computers can just learn them one time
      - ones which are generated by computers. Those can be solved by computers, too.
      The most ridiculous ones are simple math problems in the html-text.

      the average case is some distorted text, which will soon be no problem for computers anymore, as OCR software is getting better.

    6. Re:Passwords are for philistines by TheLink · · Score: 3, Informative

      Yeah to me that's the best approach - use a different port. Simple and effective enough. You could resort to port knocking or similar (use some other method[1] to selectively allow access to the ssh server). But just running the ssh server on a different port allows you to avoid nearly all automated attempts, so when you actually see brute forcing on your ssh server, it's more likely to be a serious targeted attack (hence you can set up an automated response/alert without getting too many false positives).

      [1] For example, if you already have to expose https to the world you could have a web app that triggers the opening of ssh access for the web client's current IP.

      --
    7. Re:Passwords are for philistines by drosboro · · Score: 4, Informative

      Good point. My standard setup is to move SSHD to a non-standard port, and to turn off PasswordAuthentication completely in favour of RSA key-pairs.

      Just checking my SSHD logs, it looks like I've had exactly one rejected attempt on a busy public-facing web server (which may in fact have been me, connecting from a machine that I hadn't set up a key for) in the past month... so in my experience, no, they're not trying too hard off of port 22.

    8. Re:Passwords are for philistines by nine-times · · Score: 4, Insightful

      Once someone has your key, it's no more secure than your password.

      Whether the token is something you know, something you are, or something you have, it *all* becomes useless once someone else has it. That's not really the issue here. The issue is brute-force attacks on SSH, and using a key makes them significantly more difficult than passwords.

      Stealing someone's key/password is not a brute-force attack.

    9. Re:Passwords are for philistines by mlts · · Score: 2

      If the computer with the key is compromised, the game is over. The password can be slurped, the key snarfed, and even the session hijacked.

      It is all about limiting exposure. Going to public keys closes a potential common method of access, brute force guessing.

      No security method is 100%, but in a lot of cases, something is better than nothing, and having at least root locked out from password guessing is a must for Internet facing systems.

    10. Re:Passwords are for philistines by JWSmythe · · Score: 2

          I've been passing as human for years, you insensitive clod!

      --
      Serious? Seriousness is well above my pay grade.
    11. Re:Passwords are for philistines by stackdump · · Score: 2

      Agreed! - this seems like the simplest tweak to bypass brute-force attacks -- After all why attack a server that isn't listening on port 22 when so many are?

    12. Re:Passwords are for philistines by jandrese · · Score: 2

      Wouldn't it be easier to just choose good passwords? The downside of port knocking is when you are using ssh because all of the other ports are blocked (including 80, thanks to your ISP).

      This is probably not a solution if you have a bunch of users, but for a home machine it's not that hard to create a password that will never be guessed by some bot trying one dictionary word every 10 seconds.

      --

      I read the internet for the articles.
    13. Re:Passwords are for philistines by sexconker · · Score: 3, Interesting

      RSA key/pair is something you have... you still need something you are, and something you know... Once someone has your key, it's no more secure than your password. A trojan can read local files, just as easily, if not more so than snoop for a password.

      When you send bits out, everything in those bits is "something you know".

      You don't need to have the keyfob, you just need to know what it will output at any given time, or what a prior output was (as long as you use it within the time window for which it is valid - typically 30 seconds to 2 minutes). Yes, it's mathematically hard to get the key by brute forcing, but it's not impossible. When you log in with one of those, you're not proving that you have the thing, you're proving that you know what it output at a given time.

      Imagine if PS4 games had built in RSA shits right onto game discs. (Or the Vita game cards if you can't imagine a thing battery, cpu, and display on a disc.)
      Touch an area on the surface of the game disc (or card) and get a password on a little display. You have to put that password in within X time to access the game. This isn't secure because even if Bob holds onto the disc physically, Alica can call him up and ask him to read the code.

      Sony wants the disc to be in Bob's physical possession (and no one else's) at any given time, but they cannot rely on this type of security to ensure that. For all they know Bob is visiting Alice and brought his new game over.

    14. Re:Passwords are for philistines by JWSmythe · · Score: 4, Informative

            I double that up. sshd to a nonstandard port, and firewall rules to only allow access in from very specific IPs and networks.

          You really shouldn't be able to ssh in from just anywhere. Even if that means throwing a copy of OpenVPN up at a static location, to ssh to the second.

          I can get to most of my stuff directly from home. At a hotel, airport, or coffee shop, I am on a hostile network, and shouldn't even be able to see that the port is open.

          But, most people scanning for machines with SSH on them to hit are blindly scanning port 22. It's people interested in your specific network will scan every port on every machine. Someone determined to hit your machine specifically will try every trick they can, and having SSH on port 2222, 9222, or 64222 won't help, if you have a weak password or an exploitable version.

      --
      Serious? Seriousness is well above my pay grade.
    15. Re:Passwords are for philistines by RichardJenkins · · Score: 1

      Are you thinking of RSA SecurID? That is something quite different.

      If you want to log in to my SSH server, then in practice you need a private counterpart to a public key which you have added to your authorized_keys file.

    16. Re:Passwords are for philistines by artg · · Score: 1

      You're assuming the loss is via a compromised computer. For me, the most likely loss of the key is laptop theft. So I want to ensure that isn't going to give an automatic login to the home machine. i'd prefer to have both key pair and password, but failing that I think password is preferable to key pair.

    17. Re:Passwords are for philistines by artg · · Score: 1

      Oh, wait, passphrase. duh.

    18. Re:Passwords are for philistines by multimediavt · · Score: 4, Interesting

      I made it just a different port on my router at home; still points to port 22 on the internal address forward. That way I can just turn sshd on (after configuring max tries to '3') and not worry about port fiddling on the machine. Works. Haven't seen many attempts at it since I did that years ago.

    19. Re:Passwords are for philistines by Brucelet · · Score: 4, Funny

      It is if I break into your house and brute-force you to hand it over

    20. Re:Passwords are for philistines by loufoque · · Score: 1

      Someone cannot have something you are without you being aware of it.

    21. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      23 (sadly)

    22. Re:Passwords are for philistines by alanmeyer · · Score: 2

      Anyone see these guys on a port other than 22?

      +1. Moving to a different service port dropped my failed login attempt logs down to nothing (at least, for now). Prior to that, my logs still weren't too big because I block IPs after #MAX_ATTEMPTS within a 24 hour window. However, the attempts were coming in at a rate of 10 minutes apart. Still, they got blocked. It's just that the hacking community seems to be well aware of trying to keep the number of attempts / unit time down to avoid detection.

    23. Re:Passwords are for philistines by nine-times · · Score: 1

      I'm not sure if you're kidding, but that's not what people mean by "brute force attack".

    24. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      Well, what if he breaks into every house on the block brandishing a LART and demanding "Gimme nine-times's ssh private key, and nobody gets hurt!", until he runs into nine-times himself and gets it?

      I mean, in addition to seriously baffling the local PD, that would be a brute-force attack, no?

    25. Re:Passwords are for philistines by nine-times · · Score: 4, Insightful

      That's nice in theory and all, but it depends on what that "something you are" is. Essentially we're talking about biometrics, so what are we measuring? Is it a thumbprint scan? Those have been defeated in the past by taking a thumbprint and replicating it by some means. Is it a DNA scan? Then they might just need to get ahold of your DNA.

      Really, the "something you are" is still "something you have", but you "have" it attached to your body. That doesn't necessarily mean it can't be stolen or replicated somehow. Similarly, the "something you know" can also be considered to be "something you have", but you "have" it in your mind. In some circumstances, it can still be figured out or retrieved, or you might be tricked into providing it.

      Real security isn't quite as simple as you make it sound.

    26. Re:Passwords are for philistines by v1 · · Score: 2

      RSA keypair auth, disable password auth, bruteforcers irrelevant.

      I'd also recommend changing the ssh listener port to something else, to keep the secure.log a little cleaner and easier to spot possible issues in.

      443 is a fun one, few if any of the ssh bots even consider that one.

      --
      I work for the Department of Redundancy Department.
    27. Re:Passwords are for philistines by nabsltd · · Score: 2

      443 is a fun one, few if any of the ssh bots even consider that one.

      The other advantage to 443 is that pretty much no ISP/WiFi provider/whatever will block access to that port, and since they expect to see encrypted traffic, they probably won't mess with the connection at all.

    28. Re:Passwords are for philistines by miknix · · Score: 2

      Meh, just add proper rules to iptables and you will be fine:
      http://www.ducea.com/2006/06/28/using-iptables-to-block-brute-force-attacks/

      sshguard is pretty good too:
      http://www.sshguard.net/

    29. Re:Passwords are for philistines by hairyfeet · · Score: 2

      Am I the only one that HATES those stupid "R U a Human?" tests? I swear some of them have gotten so damned ridiculous on the word twisting i just write a nasty note to the contact with a JPG of some of their "tests" saying "You tell ME WTF this is supposed to be? is it a 7 or a T? O or 0? Your tests suck" and I've actually gotten a few responses along the lines of "Geez i hadn't tried it since we started using those and didn't know they were THAT bad".

      Look I appreciate you want to keep the bots and crap off your sites, i really do, but this stuff is just getting nuts. There has GOT to be a better way than all these hoop jumps because frankly the spammers will just pay some schmuck in Asia a few cents a hundred to spend all damned day cracking your crap while your actual users get fed up and move on.

      --
      ACs don't waste your time replying, your posts are never seen by me.
    30. Re:Passwords are for philistines by DamnStupidElf · · Score: 1

      Encrypt your private key with a passphrase that you know, which is a property of something you are (your brain). Nothing will protect you from local malware that can intercept your keystrokes. Even if you use a secure keyfob for your private key the trojan could just take over your session and execute commands on your behalf once you're securely connected.

    31. Re:Passwords are for philistines by DamnStupidElf · · Score: 1

      It's all too easy to socially engineer people into doing things without them being aware of it. "Hey, could you test this biometric scanner for me? It keeps saying 'swipe finger evenly' but I think it's just broken."

    32. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      the optimal rate for bruteforce testing the password on a private key is considerably more than once every 10 seconds

    33. Re:Passwords are for philistines by cynyr · · Score: 2

      And it is rather easy to ask nmap to do a simple sneaky-ish scan of a machine looking for SSH, and the pound away at that port.

      --
      All of the above was encrypted with a Quad ROT-13 method. Unauthorized decryption is in violation of the DMCA.
    34. Re:Passwords are for philistines by cynyr · · Score: 1

      I'm running fail2ban myself. 3 wrong guesses and get banned for 30 minutes. Not really an issue for me, I did leave pasword auth on for users, but not root you need a key to ssh to root. None of my users can su either, and sudo isn't even installed.

      --
      All of the above was encrypted with a Quad ROT-13 method. Unauthorized decryption is in violation of the DMCA.
    35. Re:Passwords are for philistines by Onymous+Coward · · Score: 1

      soon computers will pass the tests better than humans

      That's an interesting idea.

      At that point you have to apply a band-pass filter. If a computer can solve a problem more easily than a human, then superhuman performance is a sign of non-humanness.

    36. Re:Passwords are for philistines by Onymous+Coward · · Score: 2

      I put my sshd on port [redacted] instead of 22 and, looking through logs now, I see no attempts at all for the last year.

      Only two attempts in the past 2 years total.

      They're not brute forcing SSH logins by finding SSH servers through fingerprinting yet. They're still only using conventional ports.

    37. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      passphrase protect your ssh key, and audit access attempts on keyed boxes.

      then you still need to crack it once you have obtained the key, and you know when people are attempting to use it.

    38. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      Personally I'd argue that having a user capable of su or sudo (even if it is just one user) is probably more secure than allowing direct root logins.

    39. Re:Passwords are for philistines by dbIII · · Score: 1

      I used to, then I just dropped packets from any port that doesn't belong.
      I haven't seen anyone mention Fail2ban or any other automatic firewall block rule generation script yet. The concept is flawed in that attackers can spoof addresses and manipulate your firewall, but the execution gets around that by blocking for only a limited time and hoping the attackers go after somebody else (and that somebody that was locked out by making a mistake with their passphrase a few times can try again later).

    40. Re:Passwords are for philistines by gweihir · · Score: 1

      Sorry, but fail. 2-factor only works when both factors are independent. That is not the case here, as they are always used together. About the only way to compromise the RSA key is to compromise the SSH source host. But as soon as you have that, you also have the password on the first login, hence both are not independent.

      --
      Most ACs are not even worth the keystrokes to insult them. Be generically insulted by this and ignored otherwise.
    41. Re:Passwords are for philistines by MiG82au · · Score: 2

      Oh how ironic. You propose filtering based on performance on an article about the optimum login speed to bypass said filtering.

    42. Re:Passwords are for philistines by TheLink · · Score: 1

      On a firewall server I used to run, I had an sshd server bound to 127.x.y.z:P. Then I set firewall rules to forward external access to external_IP:high_port to 127.x.y.z:P.

      This way externals cannot access the ssh server if the firewall service is disabled or has no rules.

      --
    43. Re:Passwords are for philistines by dargaud · · Score: 1

      Really, the "something you are" is still "something you have", but you "have" it attached to your body.

      Not necessarily. Something you are is nine-times. The gard at the entrance knows you as nine-times. For hime you _are_ nine-times. Maybe you get fired from work and your badge (something you have) is revoked and your system password (something you know) is removed. But they forget to notify the guard and the next day you manage to walk in as usual, because he knows you. Of course the opposite situation is possible too: the boss throws you out and tells the guard not to let you in, even though your cards passwds won't be canceled for another few days. That's what 'something you are' means. To my understanding anyway.

      --
      Non-Linux Penguins ?
    44. Re:Passwords are for philistines by Trogre · · Score: 1

      Cool, so once the hackers compromise one of your computers they can get to all of them.

      Nice.

      --
      "Nine times out of ten, starting a fire is not the best way to solve the problem." - my wife
    45. Re:Passwords are for philistines by nine-times · · Score: 1

      Yes, but the guard at the entrance knowing me as nine-times really comes down to some way of measuring me as nine-times. If he just knows me on sight, then someone with a sufficient physical resemblence may be able to walk straight past. So it's stretching the concept of "have", but it's still "something you have". You have a face that looks like mine.

    46. Re:Passwords are for philistines by tepples · · Score: 1

      The drawback, of course, is that if "something you are" is compromised, it can't be revoked and reissued.

    47. Re:Passwords are for philistines by tepples · · Score: 1

      Good luck entering a long passphrase on the first try on, say, a tablet.

    48. Re:Passwords are for philistines by tepples · · Score: 1

      You could resort to port knocking or similar

      Port knocking won't help when both you and the attacker are behind the same NAT.

    49. Re:Passwords are for philistines by tepples · · Score: 1

      Meh, just add proper rules to iptables and you will be fine:

      As the article that you linked points out: The moment you open your third legitimate SSH window, you're blocked, and an IP whitelist won't work if you often have to work from home or somewhere else that has an IP address that changes nightly. Furthermore, a botnet with thousands of compromised Windows PCs on separate IPs can still bruteforce your account.

    50. Re:Passwords are for philistines by miknix · · Score: 1

      As the article that you linked points out: The moment you open your third legitimate SSH window, you're blocked, and an IP whitelist won't work if you often have to work from home or somewhere else that has an IP address that changes nightly.

      Then:
      - don't open a third ssh connection within 300 seconds (even if you do it is a temporary block, on contrary to what your argument is suggesting).
      - increase the hitcount parameter.
      - use GNU screen to multiplex several terminals into a single ssh connection
      - use sshguard (it isn't just a whitelist, it is actually a dynamic blocklist - fail login several times and your IP is temporarily blocked).

      You are bringing up a non issue and you missed my point entirely. TFA suggests there is an optimum attack rate for ssh brute forces which, despite still interesting, is far from reality. I do limit the connections to my sshd server and I'm no sysadmin. So I'm pretty sure any good sysadmin is using better tricks to slow down bruteforces to the point of making them nonviable.

      Furthermore, a botnet with thousands of compromised Windows PCs on separate IPs can still bruteforce your account.

      Can they? Considering my previous example on using iptables to slow down brute forces, each botnet node can only try 3 passwords in the first 5 minutes and then one password per 5 minutes from then on. Even if the botnet has "thousands" of nodes (lets say 9000 nodes), they can only try 3* 9000 + 11*9000 = 126000 passwords during the first hour. Do you really think this is even near a successful bruteforce rate?? (given that the password is minimally secure).

      Using sshguard makes it even harder...

    51. Re:Passwords are for philistines by TheTurtlesMoves · · Score: 1

      One of the programing sites i frequent was having a large problem with human spammers. The solution was to add a programming question. You have say what the program outputs. Not only did this get rid of the spammers, but it also got rid of the 16 year olds that just finished playing some AAA that demand you teach them how to write such a game before dinner.

      --
      The Grey Goo disaster happened 3 billion years ago. This rock is covered in self replicating machines!
    52. Re:Passwords are for philistines by TheTurtlesMoves · · Score: 1

      I have seen password attacks on all the ports i have sshd on. They port scan, or a least some do. Either way i can't see how this can work without really bad passwords/pass-phrases. As long as the password is not password, i can't see this working at all.

      --
      The Grey Goo disaster happened 3 billion years ago. This rock is covered in self replicating machines!
    53. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      move SSHD to a non-standard port

      Obscurity != security.

      SSH still gets brute forced on non-standard ports.

    54. Re:Passwords are for philistines by tzot · · Score: 1

      The site is asking its (hopefully human) visitors what will be the output of a given computer program? If I understood correctly and this is what you're saying, then I can't understand what's the difference to some HTML saying “what's the sum of eight and eleven?”.
      It would be better if they gave a short listing with a couple (possibly random) substitutions, insertions, deletions and the compiler/interpreter's error output, asking the wannabe visitor to fix the code (in the s/old/new format :). This way, when the spammers break the scheme, they'll have advanced the error-correcting capabilities of computers and they'll be worthy of admission :)

      --
      I speak England very best
    55. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      + add conditional iptables script or ssh-guard. Game over.

    56. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      Put your key on a USB stick + don't store locally + password protect key

    57. Re:Passwords are for philistines by Anonymous Coward · · Score: 0

      I will probably shoot you first.

    58. Re:Passwords are for philistines by Onymous+Coward · · Score: 1

      "Said filtering" was not captchas. Band-pass filtering for captchas isn't yet done. You can submit the article on optimum captcha performance throttling when that era comes about.

    59. Re:Passwords are for philistines by hairyfeet · · Score: 1

      Wouldn't that cut out programmers that are unfamiliar with the language they used? I mean if I were an old BASIC and FORTRAN programmer and you gave me a Java question I doubt seriously any of my experience would apply. So how do you make the question generic enough that the average programmer can answer it without making it easy for a computer to answer?

      Frankly though anything would have to be better than those damned twisted words, I've seen sites where i have had to hit refresh 2 dozen times to get a legible test as they used upper AND lower AND numbers and then twisted them so the whole thing looks like badly written Mandarin Chinese.

      --
      ACs don't waste your time replying, your posts are never seen by me.
    60. Re:Passwords are for philistines by MiG82au · · Score: 1

      But it's trivial to slow down your attacks and throw in errors. And while I can't link to evidence, I've seen a comment on slashdot about captcha bots doing exactly that.

    61. Re:Passwords are for philistines by JWSmythe · · Score: 1

          Correct. That's why you'd want to set up firewall rules to protect it. I generally drop all traffic except for what is allowed. It just makes it that much harder to scan. If you happen to be sitting on an authorized network, you'll see the port. If you're not, nothing.

          But the casual attacker just goes over large blocks looking for port 22. Failure to see it, they move on to easier targets.

          Consider a /24. 254 requests to check port 22 is fairly quick. Scanning ports 1 through 65534 is 16.6 million requests. Rejected connections are helpful. Dropped connections, or checking IPs without hosts on will delay it significantly. A lot of people drop unwelcome traffic, including ICMP, so you'd have to go with something like:

      nmap -sV -P0 --max-rtt-timeout 1000 --max-retries 1 -O 192.168.1.0/24

          That'd still an awful long time to try to check every port on every possible IP on any substantial size network. It's much easier to check a single host. One IP of 4.2 billion. Or only 8.7 million years for all ports, from a single machine and one thread to scan. Versus just 48,938 years to check one port on every IP. :) That's where the power of malware infested drones would come in useful.

      --
      Serious? Seriousness is well above my pay grade.
    62. Re:Passwords are for philistines by Onymous+Coward · · Score: 1

      Well, then my comment about captchas not yet using performance throttling may not be accurate. I suppose it's not hard to believe that there's some throttling going on. And, to concede your earlier point somewhat, these are all attacks and defenses in a similar vein, if they're not the same thing.

      An arms race. Like spam.

  3. Seems Easy To Detect by Anonymous Coward · · Score: 0

    Just look for large numbers of incorrect logins over a long-ish time span.

    1. Re:Seems Easy To Detect by aztracker1 · · Score: 1

      Never forgotten your password on a site have you... I'll usually try 5-6 times before I finally get it, or give up and hit the forgot password link.

      --
      Michael J. Ryan - tracker1.info
    2. Re:Seems Easy To Detect by Anonymous Coward · · Score: 0

      Maybe so but there is a difference between 5-6 times in a half hour and a couple of hundred times.

    3. Re:Seems Easy To Detect by TheRaven64 · · Score: 4, Insightful

      The problem is that botnets have a lot of IP addresses. They can do one try from one machine then another from the next. If you disable the account entirely after a certain number of failed logins, you've just created a simple DoS attack. If you disable it just from that IP, it doesn't matter because it will just try from another. There are some realtime block lists that you can use to reject things, but these add another attack route that can let someone who can spoof DNS prevent you from logging in to your own machine...

      --
      I am TheRaven on Soylent News
    4. Re:Seems Easy To Detect by steelfood · · Score: 1

      One ping every 10 seconds isn't really a DoS attack. Unless it's one ping from each of a thousand machines every 10 seconds. But that's a DDoS attack, and it doesn't sound like that's what this is doing.

      --
      "If a nation expects to be ignorant and free in a state of civilization, it expects what never was and never will be."
    5. Re:Seems Easy To Detect by dbIII · · Score: 1

      I saw one of those from about 16 hosts at once going in step through a dictionary of usernames, but that was a couple of years ago. If each IP address gets blocked after three attempts they are going to need a lot of hosts to get anywhere.
      Yes the problem where an attacker can lock you out is annoying and is why I initially ignored Fail2ban, but timeouts get around that or in the worst case physical access to the machine. I don't think I'd use Fail2ban or similar on anything important that I couldn't get a human being to plug a keyboard into in the middle of the night.

    6. Re:Seems Easy To Detect by TheRaven64 · · Score: 1

      You're misreading what I said. If you disable the account after n retries, irrespective of where they come from, then that allows a very simple and low bandwidth DoS - just try to log in n times from your botnet and then the real user can't log in at all.

      --
      I am TheRaven on Soylent News
    7. Re:Seems Easy To Detect by TheRaven64 · · Score: 1

      I use sshguard, but for a while I was seeing several hundred failed login attempts a day, even though they were blocked after 3 fails (for increasing periods). It may be that after a year my pf table of blocked addresses now includes the entire botnet, or it may be that they just gave up (password logins are disabled on that machine anyway). Or it might just be that the botnet found something more profitable to do than attack a server with half a dozen users...

      --
      I am TheRaven on Soylent News
    8. Re:Seems Easy To Detect by Anonymous Coward · · Score: 0

      "DoS" = "Denial of service". If one can "deny" the "service" of a user account by just doing remote failed logins with that user name a number of times, then one has created an opportunity for a denial of service, per definition.

      DoS does not have to be about denial of service through saturation of the connection.

  4. set ban interval to 11 seconds. by fincan · · Score: 2

    So, set your fail2ban or denyhosts configuration to 11 seconds intervals, and problem solved?

    1. Re:set ban interval to 11 seconds. by aix+tom · · Score: 1

      Until they set the try interval to 12 seconds.

    2. Re:set ban interval to 11 seconds. by Tehrasha · · Score: 2

      5 fails in a row...ever.

    3. Re:set ban interval to 11 seconds. by Tehrasha · · Score: 2

      Additionally... automatically block any single attempt to login as root, admin, www, ftp, etc..

    4. Re:set ban interval to 11 seconds. by mlts · · Score: 1

      What would be interesting is that if someone tries to log in as root with a password (as opposed to using a public key), rather than outright deny access, just make sure all access is denied from that IP or IP range, even if a future attempt at logging on would have normally been successful. This keeps the attacker busy thinking they can gain something.

      Or, if someone is really clever, spawn a fake shell which drops to a prompt, then 1-2 seconds later, have it look like it got logged out.

      Something like that widely distributed would be an effective poison, until the attack scripts started checking to see if the shell prompt is real or fake.

    5. Re:set ban interval to 11 seconds. by Tehrasha · · Score: 2

      just make sure all access is denied from that IP or IP range

      Which is exactly what denyhosts and fail2ban do.
      On failure, echo $IP:ALL >> /etc/hosts.deny

    6. Re:set ban interval to 11 seconds. by Anonymous Coward · · Score: 0

      I think what he meant was to allow them to keep attempting to log in but give the wrong username/password response regardless of whether it would work at all, rather than stop responding at all. My understanding is that fail2ban and denyhosts means that the server stops responding at all due to blocking at the firewall.

    7. Re:set ban interval to 11 seconds. by Samantha+Wright · · Score: 1

      Think more honeypottish. The defender's best tactic against an attacker is to deny the attacker knowledge of whether or not their break-in was actually successful: the more complex and bewildering you can make the fake prompt, the better. No one will try to brute-force a machine they think they already have access to.

      --
      Bio questions? Ask me to start a Q&A journal. Computer analogies available for most topics!
    8. Re:set ban interval to 11 seconds. by mlts · · Score: 1

      Exactly. If an attacker is running their stuff on some botnet clients, and gets reports that machines on a network all are accessible, it will waste their time and resources in having to vet each and every machine that reported a successful login.

      It isn't a true honeypot because the machines are not giving much of an environment for an intruder to play around in, but more of a way to fool the brute forcing scripts in giving them a bunch of false positives.

  5. Isn't that useless? by khasim · · Score: 2

    I'm going to guess it was a dictionary attack because otherwise it is even dumber.

    That's 6 attempts per minute.
    360 per hour
    8640 per day
    60,480 per week
    3,144,960 per year.

    So unless you're allowing usernames such as "root" or "admin" or "administrator" AND using dictionary passwords wouldn't this fail? And be obvious in the logs?

    1. Re:Isn't that useless? by PRMan · · Score: 1

      Also, you use logarithmically-increasing delays to both the username and the IP address (and to a lesser extent, range) that tries this. They won't be trying much for long. And no, I don't want people on zombie botnets coming to my site.

      --
      Peter predicted that you would "deliberately forget" creation 2000 years ago...
    2. Re:Isn't that useless? by girlintraining · · Score: 3, Funny

      So unless you're allowing usernames such as "root" or "admin" or "administrator" AND using dictionary passwords wouldn't this fail? And be obvious in the logs?

      You're thinking... this makes you a bad reference model for the average user.

      --
      #fuckbeta #iamslashdot #dicemustdie
    3. Re:Isn't that useless? by damn_registrars · · Score: 1, Interesting

      So unless you're allowing usernames such as "root" or "admin" or "administrator" AND using dictionary passwords wouldn't this fail? And be obvious in the logs?

      Yes, it would be obvious in the logs. However, most of the common hacks are now scripted and distributed. They'll use a dictionary attack that is spread over some number (dozens or more) of distinct botnet systems, making it very inconvenient for you the admin to try to block all those addresses.

      Although of course as you point out, it should fail if they are going for root or equivalent. That said from my experience the botnets usually seem to do a white pages type list of common usernames and then try either blank or extremely common user names to try to get in by. So you may also want to ensure that if you have users who use very common (English) first names as their login names, they are using strong passwords.

      Thankfully, ssh generally returns the same password prompt for a valid username as it does for a nonexistent one, and the same wrong password response regardless of whether or not the username exists, so at least your system won't be giving them useful information on which usernames are worth trying again with other passwords.

      --
      Damn_registrars has no butt-hole. Damn_registrars has no use for a butt-hole.
    4. Re:Isn't that useless? by Culture20 · · Score: 2

      That's 6 attempts per minute.

      per zombie in the botnet. Each zombie IP gets banned individually, and the slow attack attempts prevents a DDoS.

    5. Re:Isn't that useless? by lambent · · Score: 1

      it's remarkably dumb, yes. but they don't need to attack specific targets, they're going after the lowest hanging fruit. they just need ANY attack to work, not EVERY.

      very easy to mitigate against as you point out. but there are people out there who never get around to those steps, on account of being lazy.

    6. Re:Isn't that useless? by tepples · · Score: 1

      So what do you do when a legitimate customer has the same username that some botnet is trying to brute-force?

  6. Key AND Password by XanC · · Score: 4, Interesting

    So what I've never understood is why it's not possible (as far as I know) for a server to require BOTH a key AND a password. Sure, I can put a password on my key, but that isn't the same at all. Is this possible yet?

    1. Re:Key AND Password by datapharmer · · Score: 1

      If you are worried about that setup VPN with only access to ssh. Use a password for one and a key for the other. Otherwise, just keep your keys password protected and in a safe place. You can also restrict ssh/vpn to your IP address or a known range to limit the attack surface to locations you might actually be using to login. Add in fail2ban and a honeypot... wait why I am I telling you all this? If you are that worried just unplug it from the internet, don't use removable media and you will be fine!

      --
      Get a web developer
    2. Re:Key AND Password by allo · · Score: 1

      maybe with pam.

      at least you can for example use password AND one-time-password with pam, which applies for ssh, too.
      with OTP its more often used as password replacement (login from places where you do not trust the computer), but you can configure it as two-factor auth as well.

    3. Re:Key AND Password by heypete · · Score: 2

      Indeed.

      Google Authenticator (which is an implementation of TOTP, and doesn't send anything back to Google itself) can tie in with SSH/PAM quite easily.

    4. Re:Key AND Password by Qzukk · · Score: 1

      Non-Open-SSH has been able to require multiple authentication stages for some time now. Every now and then someone updates a patch for OpenSSH to do the same.

      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    5. Re:Key AND Password by Anonymous Coward · · Score: 0

      So what I've never understood is why it's not possible (as far as I know) for a server to require BOTH a key AND a password. Sure, I can put a password on my key, but that isn't the same at all. Is this possible yet?

      Nope. Submit a patch, or use a token mechanism (RSA, OTP, Yubikey) hooked in PAM for two-factor auth.

    6. Re:Key AND Password by allo · · Score: 3, Interesting

      yeah, or i once had a sshd with https://en.wikipedia.org/wiki/OPIE_Authentication_System running. Nice thing, you generate a bunch of passwords and print it. Then you can login from everywhere without looking out for keyloggers.

    7. Re:Key AND Password by mlts · · Score: 2

      Maybe even going back to the age-old S/KEY or OPIE protocol that has been part of BSD for 20+ years? This has fallen into disuse because it was mainly designed to foil packet sniffers, but might be a good way of doing things. Maybe modify the algorithm a little bit so it uses a modern hash, and perhaps add a random 4-5 digit number somewhere in addition to dictionary chosen words. That way, trying to brute force a pass phrase that will easily be more than 20+ characters will be almost impossible, especially with tarpitting, IP blacklisting, and locking an account out for 5-20 minutes if too many guesses are done wrong.

    8. Re:Key AND Password by Dr.+Sp0ng · · Score: 1

      I use Google Authenticator on my home server (and on Google itself). It's a great solution to this problem and works very well. Some ssh clients (notably on iOS) can't handle the two-factor authentication, but I just set those up with private key authentication.

    9. Re:Key AND Password by Anonymous Coward · · Score: 0

      You could put stunnel in front of your SSH port.

    10. Re:Key AND Password by What'sInAName · · Score: 2

      I use Mobile OTP (http://motp.sourceforge.net/) for two-factor auth at work. Once I figured out the PAM side of things, it was quite straight-forward. I installed it on my server at home as well, but I'm a little more relaxed about it -- I allow ssh from a few "trusted" boxes via ssh-keys, otherwise it requires password+OTP token authentication. Now, I just have to worry about keeping those "trusted" boxes safe. (I do have a password on the ssh keys, but wonder if I have a long-running login session with the keys installed into ssh-agent, I might be boned anyway if someone were to break in.)

    11. Re:Key AND Password by marcosdumay · · Score: 1

      Why would you want that? If you fear somebody else getting hold of your key, put a password on it; if you fear your key is too short, make it longer.

    12. Re:Key AND Password by XanC · · Score: 3, Interesting

      There's no way for a server admin to require a passworded key for login.

    13. Re:Key AND Password by Anonymous Coward · · Score: 0

      I thought this was possible. The SSH protocol standard definitely supports it; after the first authentication it would issue a conditional fail (a fail message with the bool set to true indicating process was made) and after the second method, it should issue a succeed. Funny, now that I go to configure my SSH box like that, I don't see how to do it.

    14. Re:Key AND Password by Anonymous Coward · · Score: 0

      passwords are inherently insecure, to the extent that requiring a key + password is less secure than asking for just a key.

      Remember: most security problems happen not because of bruteforce attacks, but rather because someone ignored proper security procedure. Adding another, utter insecure hoop to jump through is just asking for people to ignore the whole process.

    15. Re:Key AND Password by dbIII · · Score: 1

      Just a key means that a stolen laptop is a sure way in.

  7. Or never... by damn_registrars · · Score: 4, Informative

    Most of the bruteforce attacks I see on my home server are trying to get in as root. I don't allow remote root logins anyways (and even say so on the ssh greeting) so they'll never get in, even if they do manage to guess the password.

    Hence their most optimal rate for my system would be never, because they won't get in that way. Not that my system is impenetrable - I'm sure an intelligent hacker could compromise it - but they will never get in trying to ssh in as root.

    If they're doing white pages username + dictionary password - or white pages username + blank password (I've seen both, from botnet attacks), they still won't get in on my system as none of the common user names are used there.

    --
    Damn_registrars has no butt-hole. Damn_registrars has no use for a butt-hole.
  8. I have a portknocking setup by ledow · · Score: 5, Interesting

    I have a portknocking setup. All your packets bounce when you touch my port 22 until you have touched a "magic sequence" of port numbers first. That sequence can be cryptographically strong, time-dependent, etc. but even a simple one-port knock is enough to stop all this random SSH spam and has been for years.

    And if you do "get lucky" and find the right ports and then detect that port 22 is open and then start a brute-force on that? Public-key-only authentication and no root logins allowed.

    Impact on me? Another line in a shell script that I use to connect (and hell, even Android has free port-knocking apps, not to mention them being standard-enough to be in Ubuntu/Debian). Impact on server? Greatly reduced number of fake connections bouncing off iptables and a tiny little daemon that does nothing but listen on the ports I need (and can ONLY open the SSH port even if compromised). Impact on brute-forcers? They might as well give up and go home.

    Even those remote companies that we do allow to port-forward direct to their device on my work network (e.g. telecoms providers, etc.) understand it and "knock" before they come in (which tells us exactly when they are about to log in), while everyone else in the world sees closed ports.

    Why everyone doesn't use it, I have no idea. Even our VPN users have an automated script that just knocks to open the VPN ports (and only the VPN ports) before they connect. Transparent to them, invisible to everyone else, no different if "compromised".

    1. Re:I have a portknocking setup by Anonymous Coward · · Score: 2, Interesting

      Why go through all that just to leave your SSH server on port 22?

    2. Re:I have a portknocking setup by Gazzonyx · · Score: 1

      This is interesting. It's the first time I've heard of such a setup. How exactly do you have this setup in iptables? Is it just a chain that you jump to on the first port and return from on the last knocked port?

      --

      If I mod you up, it doesn't necessarily mean I agree with what you've said, sorry.

    3. Re:I have a portknocking setup by tocsy · · Score: 1

      I don't know anything about networking, but that all sounded REALLY sexual.

    4. Re:I have a portknocking setup by mrnobo1024 · · Score: 1

      TCP port numbers are unencrypted so a serious attacker will be able to find out your sequence anyway. All you're doing is wasting your own time by making legitimate connections take longer.

    5. Re:I have a portknocking setup by rastoboy29 · · Score: 1

      I had not heard of this--super interesting.

      Question though: how is it fundamentally different from simply having a slightly strongly stronger public-key-only authentication?  Just the fact that that sshd doesn't get involved?

    6. Re:I have a portknocking setup by Anonymous Coward · · Score: 0

      You can make it cryptographically strong and use one-time combinations. That means that the combination changes after every successful attempt and the algorithm that generates the sequence picks the ports essentially at random.

    7. Re:I have a portknocking setup by moderatorrater · · Score: 2

      All your packets bounce when you touch my port 22 until you have touched a "magic sequence" of port numbers first

      Using the old "ex-wife" model of security, eh?

    8. Re:I have a portknocking setup by ledow · · Score: 2

      There are cryptographically secure versions. But you've missed the point.

      This stops random port-spam, random brute-force attacks, and casual access. If you want something secure, you should SECURE it (e.g. by restricting access to the bare minimum necessary and provide only public-key authentication ONLY). You can do that AND add port-knocking, if you want.

      But the spam on port 22 on an unsecured machine will flood your logs the second you put it on the net. Port-knocking stops that without having to touch a SINGLE configuration for all your services. And, if you want it to, it can be cryptographically secure in itself too, no matter what application sits behind it.

      It's quite literally another level and a DIFFERENT level of security, above and beyond what you might usually deploy.

    9. Re:I have a portknocking setup by Anonymous Coward · · Score: 0

      Uhh-huhuhuh...shut up, port-knocker. Huhuhuh-huh-huh.

    10. Re:I have a portknocking setup by Anonymous Coward · · Score: 0

      You were already 100% secure with your "Public-key-only authentication and no root logins allowed."
      Portknocking is not actual security; it's just just e-peen.

    11. Re:I have a portknocking setup by Anonymous Coward · · Score: 0

      How does this fare with university/hotel/whatever internet?
      (Ones that restrict ports you can connect to, such as GuestNet at CalTech)

      The obviously answer is "It doesn't", but I'm hoping there's a good workaround!

    12. Re:I have a portknocking setup by Onymous+Coward · · Score: 1

      Yeah, just wait until the sshd zero day and associated worm.

      Or don't wait and try combing through your log with all the automated attacks on wide-open port 22s.

    13. Re:I have a portknocking setup by Anonymous Coward · · Score: 0

      Before I even leave, I set my system to "away mode," which turns on a special hidden web page generated at a random path. This is important later.

      When I want access, I run nmap scanme.nmap.org to see if it allows me to connect to arbitrary ports (A port in the range of 9000-10000 is usually open) if it is closed or filtered, then I know they block arbitrary ports. If so, I use the web page form to send certain information to show that. Once the information is sent (including the IP address I should be connecting from and any common ports that are blocked), a script changes the knockd knocking sequence from the randomly selected ports to different sequences of more common ports. Maximum time it has taken me is 30 minutes for the changes to occur.

      Fail2ban takes care of the rest.

    14. Re:I have a portknocking setup by Lost+Race · · Score: 1

      In the 7 years since I moved sshd to a different port, I've had exactly zero probes (ssh or otherwise) on that different port. I get about 50 a day on port 22.

    15. Re:I have a portknocking setup by Anonymous Coward · · Score: 0

      WAT? Who said anything about using port 22? The issue is port knocking. I assume everybody uses a non-standard port.

    16. Re:I have a portknocking setup by Trogre · · Score: 1

      Just curious, is there a reason you don't require both key pairs AND a password?

      --
      "Nine times out of ten, starting a fire is not the best way to solve the problem." - my wife
    17. Re:I have a portknocking setup by Anonymous Coward · · Score: 0

      If there is some exploit for sshd that gets them around the authentication scheme completely, they can't even try it until the knocking sequence is successfully completed.

    18. Re:I have a portknocking setup by Onymous+Coward · · Score: 1

      So I guess you mean "100% security" only if someone isn't targeting you directly and scanning your ports.

    19. Re:I have a portknocking setup by rastoboy29 · · Score: 1

      Oh I see, so basically another layer of security.  Makes sense.

      Thanks!

  9. Funny, I was tweakin' my firewall this morning by grasshoppa · · Score: 2

    iptables with the recent module...ssh brute force attacks a thing of the past. Actually, same with RDP and just about any other service you can identify via iptables.

    Rate limit those suckers to something useful ( for ssh, I configured 2 attempts in 5 minutes, everything else is dropped ), call it done.

    iptables -I INPUT -i eth0 -p tcp --dport 22 -m state --state ESTABLISHED -j ACCEPT
    iptables -I INPUT -i eth0 -p tcp --dport 22 -m state --state NEW -m recent --name sshattack --set
    iptables -I INPUT -i eth0 -p tcp --dport 22 -m state --state NEW -m recent --name sshattack --update --seconds 300 --hitcount 3 -j DROP
    iptables -I INPUT -i eth0 -p tcp --dport 22 -m state --state NEW -j ACCEPT

    ( Disclaimer: the above is from memory. I am positive there are better ways and more things you can do with it )

    --
    Mod me down with all of your hatred and your journey towards the dark side will be complete!
    1. Re:Funny, I was tweakin' my firewall this morning by Culture20 · · Score: 4, Insightful

      That's only useful if there's one attacker IP. TFA is talking about a botnet doing the attacking. Hundreds, if not thousands of IPs per minute. The only way to "protect" against that with iptables is to have iptables block all incoming on port 22 from any address. But then you're left with a DDoS where your ssh port is down nearly all the time. Same deal with locking accounts; if hundreds of attempts occur per minute, a lot of accounts can be locked out as a DDoS, intentionally or not.

  10. So how much time to break a strong password? by roman_mir · · Score: 2

    1 attempt per 10 seconds, so 360 attempts per hour, 8640 per 24 hours, 3,153,600 per year or 31 million passwords per 10 years.

    Well, if your password is not in some rainbow table and it's at least moderately strong, then you should be fine.

    1. Re:So how much time to break a strong password? by allo · · Score: 1

      rainbow-tables are not relevant for remote attacks.

    2. Re:So how much time to break a strong password? by roman_mir · · Score: 1

      I mean a dictionary attack.

    3. Re:So how much time to break a strong password? by Anonymous Coward · · Score: 0

      1 attempt per 10 seconds per IP.

  11. But it still would not work. by khasim · · Score: 3, Informative

    They'll use a dictionary attack that is spread over some number (dozens or more) of distinct botnet systems, making it very inconvenient for you the admin to try to block all those addresses.

    Who cares about blocking them? They're not getting in anyway. Blocking is just additional work that may cause problems.

    That said from my experience the botnets usually seem to do a white pages type list of common usernames and then try either blank or extremely common user names to try to get in by.

    That's the reason that they're not going to get in. They're using usernames that don't exist (unless the sysadmin is an idiot in which case you have the regular idiot problems and it's probably been cracked already through one of those).

    So you may also want to ensure that if you have users who use very common (English) first names as their login names, they are using strong passwords.

    If you're using JUST first names or last names as usernames then you have a bigger problem.

    Instead use something like one of the following:
    FIrstnameLastname
    Firstname.Lastname
    FirstnameMiddleinitialLastname

    You should be able to easily distinguish the potential threats from the random script-kiddies. That being a REAL username on your system with hundreds of login attempts.

    And then you deal with that issue by changing the username. Then investigate how that username leaked.

    1. Re:But it still would not work. by colinrichardday · · Score: 2

      That's the reason that they're not going to get in. They're using usernames that don't exist (unless the sysadmin is an idiot in which case you have the regular idiot problems and it's probably been cracked already through one of those).

      Do you have your system set up so that email names are not user names?

  12. Details? by gQuigs · · Score: 1

    Is there a package that includes this functionality or is it all custom done?

    1. Re:Details? by ledow · · Score: 4, Informative

      knockd on Linux. Apt-get should find it for you. It will execute a specified shell script when it receives a specified knock (default one is specified). That shell script can be passed the IP that knocked (so you can include it in an iptables opening within the script).

      There are also implementations for Windows, should you need that.

    2. Re:Details? by Anonymous Coward · · Score: 0

      for ubuntu. http://linux.die.net/man/1/knockd

  13. Denyhosts by Gaygirlie · · Score: 4, Informative

    I personally use Denyhosts on my Linux server; it is a simple application that keeps an eye on SSH log and blocks access to SSH and any other services you have configured when the limit threshold is reached. You can also configure whether to keep those IP-addresses blocked forever, or for a specified time. Plenty useful. And the attack described here wouldn't work with Denyhosts.

    Since I don't use my server for any actual business-use I have just configured Denyhosts to flat-out block access to any and all services altogether when the limit threshold is reached, and I've configured it to retain the block lists forever. These days I've got several thousand IP-addresses there and I rarely see anything malicious in my logs anymore.

    Of course, denying root login altogether and using either SSH-keys or proper, long passwords is still essential.

    1. Re:Denyhosts by Anonymous Coward · · Score: 1

      +1 on denyhosts. If you use pubkey auth and denyhosts set to permanently lock out the IP of ANYONE attempting to login using passwords (you NEVER use passwords anyway) you don't have to worry about this stuff any more.

  14. OpenSSH should block these by psydeshow · · Score: 2

    I've been blocking these "attacks" using a script+firewall for many years now. And I still think that, really, OpenSSH should have a configuration switch to block them internally. But BSD folks don't see it as a real threat, and they don't want to risk having actual users to get locked out of their servers. Fair enough, I guess.

    So we're left with mitigation strategies. At 6 connections per minute, it's more a a nuisance than an attack, but I've seen rates as high as 200 connections per minute in the past, and there is no reason it couldn't go higher on an out-of-the-box OpenSSH configuration.

    Some solutions, as others have pointed out:
      - Have ssh listen on a port other than 22
      - Turn on OpenSSH's internal rate limiting (MaxStartups config)
      - Use key-based authentication
      - Roll your own script to grep the log for failed connections, and firewall any IP addresses with 10 or more failures

    A real brute-force attack would do a portscan first so putting ssh on a high port isn't much of a solution. Key-based auth is a nearly perfect solution, except that there are situations in which it is undesirable/awkward to use keys. The others just slow down the attack, which prevents the force part of brute-force.

    1. Re:OpenSSH should block these by Anonymous Coward · · Score: 0

      How long does a port scan of all 65,536 ports take in nmap? Now, how many times can you try to brute force root on port 22 on somebody else's computer in the time that port scan took? Using a port like 65056 for sshd isn't *security*, in any real sense, in that it won't protect you from an APT, but it will shoo away the nuisance attacks.

    2. Re:OpenSSH should block these by subreality · · Score: 3, Informative

      Why roll your own firewalling script? fail2ban works great.

      In my experience fail2ban alone gets the attack rate down so low that they'll never succeed. They can scale the attack with more IPs, but large botnets aren't free and the price is apparently high enough for them to never bother any of my exposed machines.

    3. Re:OpenSSH should block these by Anonymous Coward · · Score: 0

      It could also be pointed out that it really s*cks for an attacker when the root login is not permitted.

      Because in addition to dictionary attacking the password they also have to "dictionary attack" the login name ; )

      The login names I'm using are of course not firstnames/lastnames...

      Have fun with your 6 attacks / minute doing your (exp 2 dictionary attack) : )

  15. Tarpity them by Tuipveus · · Score: 1

    I'll just TARPIT those tries automatically after 6 unsuccessfull tries with fail2ban + iptables + TARPIT -module. This will make their connection last forever... at least almost :) Too bad, just that I have not found working tarpit for the newest kernels yet...

  16. RFC6593 by Anonymous Coward · · Score: 1

    It might solve the problem
    http://tools.ietf.org/html/rfc6593 :-)

  17. Let me try to illustrate that. (Long post) by khasim · · Score: 3, Interesting

    Do you have your system set up so that email names are not user names?

    At home? Yes.

    I think I seen where you're going with that and I don't think you understand. Collecting email login names is easy.

    But being able to login to an outward-facing server (email or ftp or ssh or whatever) should be limited to a certain amount of failed logins (no matter from which IP address) per time period.

    The crackers would have to go through an ADDITIONAL step to try to match email login names with ssh login names and an ADDITIONAL ADDITIONAL step to match that name to a different type of server (such as ssh).

    Let me see if I can illustrate this.

    1. Attacking ssh on server A.B.C.D with username aaron - if there's any chance that the cracker can do it then the sysadmin failed. Even more so with "root" or "admin" or such.

    2. Collecting username aaron.aaronson via email spammer and then trying to attack ssh on server mail.example.com - more work for the cracker than scenario #1 but still the same as #1. If there is any chance that the cracker can succeed then the sysadmin has failed. SSH should only be allowed on the mail server from the inside interface.

    3. Collecting username aaron.aaronson via email spammer and then trying to attack ssh on servers in the block A.B.C.D through A.B.C.Z (and one of those is your SSH server). And the cracker is using multiple machines to make multiple attempts (one per machine) within time period X. - Again, if it works then the sysadmin has failed. Too many attempts in time period X should lock out the account for a set number of minutes. No matter how many IP addresses are involved.
    -continued-
    And that depends upon aaron.aaronson being a LEGITIMATE USERNAME ON THAT SYSTEM. Once the sysadmin sees that attack in the logs then the logins to that should be changed (ssh.aaron.aaronson or such) to break that attack if they were not already such. Or change them AGAIN (aaron.aaronson.ssh) and be aware that something leaked somewhere.

    4. See #3 except the logins are from multiple machines but only 1 login attempt in time period X so it never triggers the account lockout. Again, change the login names (ssh.aaron.aaronson) to break that attack (and did they leak?).

    In summary, getting your system cracked via SSH means that your sysadmin failed so many times.

    1. Re:Let me try to illustrate that. (Long post) by colinrichardday · · Score: 1

      And that depends upon aaron.aaronson being a LEGITIMATE USERNAME ON THAT SYSTEM. Once the sysadmin sees that attack in the logs then the logins to that should be changed (ssh.aaron.aaronson or such) to break that attack if they were not already such. Or change them AGAIN (aaron.aaronson.ssh) and be aware that something leaked somewhere.

      But you are being reactive. Wouldn't it be better to have the ssh user name different from the email name, and really different, so that it is difficult to deduce one from the other?

    2. Re:Let me try to illustrate that. (Long post) by khasim · · Score: 1

      But you are being reactive. Wouldn't it be better to have the ssh user name different from the email name, and really different, so that it is difficult to deduce one from the other?

      Being completely non-related to your login ID is okay. I won't hurt anything by having it like that.

      But it also won't add any additional security if you follow the other steps I've outlined.

      It all comes down to the cracker being able to match (pretty much in order):
      1. your SSH server
      AND
      2. legit username on that server
      AND
      3. matching password
      AND
      4. complete the crack before the sysadmin takes action to break the attack.

      Note, 2 & 3 can be any authentication method used on that server. Including keys.

      That is why, if your server gets cracked via Internet-based brute force SSH attack (not a 0-day exploit or compromised credentials or such) then it is the sysadmin's fault.

    3. Re:Let me try to illustrate that. (Long post) by dbIII · · Score: 1

      In summary, getting your system cracked via SSH means that your sysadmin failed so many times.

      I had that once - handed over a machine and then had to rush in to reinstall the hacked mess on night a couple of years later. The problems were:
      Everybody with an email account had shell access.
      Usernames were common first names.
      One user had a password of "coffee".
      A dire mistake or deliberate action was made with "chmod" giving all users full read, write and execute access to nearly everything on the system. Areas such as /bin /usr /lib and even /etc were fully open. Thus anybody that could log in as any user could change just about anything. This was in old backups and not an action of the hacking - I'd say it was how the attacker exploited the system once they were in.
      The last step was ssh was turned on to be accessed from anywhere (and any username!) and I think some script kiddie with a rootkit took it over and was using it to portscan other machines out on the net in under a week.

      Sometimes you can't just take any random software developer and expect them to care part time for machines that other people are using.

    4. Re:Let me try to illustrate that. (Long post) by tepples · · Score: 1

      If, due to the IPv4 address exhaustion, your SSH server is on the same public IP address as your something-else server, then the user has already matched #1.

    5. Re:Let me try to illustrate that. (Long post) by tepples · · Score: 1

      But being able to login to an outward-facing server (email or ftp or ssh or whatever) should be limited to a certain amount of failed logins (no matter from which IP address) per time period.

      So what happens when an attacker buys a spam list with the e-mail address of one of your customers and starts hammering your IMAP server? Denial of service for that customer.

  18. Using PAM pam_access to block hail mary by Forever+Wondering · · Score: 1
    An alternate method is to add the PAM pam_access module to /etc/pam.d/sshd. You set up /etc/security/access.conf to allow logins from console, secure tty, and local LAN and deny all others. Each user's ~/.ssh/authorized_keys file has his/her public key from the systems they want to login from (e.g. each user sets up a separate key pair for each system they have and adds the public key from each key pair to authorized_keys)

    ---

    When an attempt is made to login, sshd first checks authorized_keys and if the public key proffered matches an entry, access is granted (with no password challenge). This is standard PKI authentication for sshd.

    If no such match, sshd proceeds with PAM authentication and a password challenge will be issued. But, since the /etc/pam.d/sshd file has the pam_access module active, pam_access will deny the login after giving the password challenge. Even if the password given is correct, the authentication will fail.

    Thus, a system so configured to the remote world will look like it's ordinary and wide open but will be completely immune to the hail mary attack.

    Even if you don't (or can't) configure your systems in this manner, since sshd login by root is disabled by default in most /etc/ssh_config/sshd_config files, the hail mary is only effective with a valid [non-root] user/pw combo. If you use a different username/pw on each system, this reduces the odds on a successful attempt dramatically.

    The reason I say this is that I added an additional wrinkle to my PAM stack. After securing it as described above, I created an additional PAM authentication module that logs all incorrect attempts. I also enabled root ssh login, and modified sshd so that it would pass the actual password along.

    The normal sshd action is if either root is attempting to login (with root access configured off) or an invalid userid is given, sshd will replace the password with a fixed string of INCORRECT. This is supposed to prevent timing measurements that might give a clue as to whether a given userid is valid. I compensate for this by adding my own random delay that overshadows any response time measurement.

    With the mods, I now have a log of time/IP/user/pw attempts. For my home system, I have a dynamic IP with no DNS entry, so it's low profile. Still, after four months in operation, my log has netted some 6000 entries. The attempts fall into several categories:

    (1) user/id where they are the same (e.g. userid is mary and password is mary).

    (2) several different userids (e.g. a list of 10) and several different passwords (e.g. a list of 9) that are all tried against each other for a total of 90.

    (3) very specific userid/pw combos that come from a database of already cracked user/pw combos. These are repeated from far flung IP addresses from time to time indicating that somebody is passing around the database. Some are such specific one shot combos (e.g. root with the same password 439812uioewruiey19283793487123 [an actual password from my log]) that they actually form a signature for the crackers themselves.

    --
    Like a good neighbor, fsck is there ...
  19. I patched sshd to log attempted passwords by DamnStupidElf · · Score: 1

    But I was always too chicken to set it up to try every failed username/password combination against the host attempting to log in and executing a 'sudo shutdown -h now' if it succeeded. I can't imagine the botnet operators change the vulnerable passwords; that might alert the owner that something was up.

    1. Re:I patched sshd to log attempted passwords by shitzu · · Score: 1

      Here's an idea - route port 22 back to the connecting host. Then it will do a recursive bruteforce.

    2. Re:I patched sshd to log attempted passwords by the+eric+conspiracy · · Score: 1

      Might even work because the connecting host was prolly brute forced earlier. What you want to do if you get in is disable the machine somehow.

       

  20. fail2ban/ossec by Anonymous Coward · · Score: 0

    adaptive sec packages help. fail2ban or the like. jail duration of -1, denyrootlogin via ssh, done.

    anyone that tries and fails 6 times gets a perm -DROP iptable rule added

  21. Just like farm gun storage by dbIII · · Score: 1

    Gun one place, bolt and ammo somewhere else. You know where but somebody who breaks in at night doesn't.
    Biometrics or whatever don't matter, the important thing is to make sure an attacker can't get everything they need to get in from one place. A key on a USB stick or the local machines disk and the passphrase/password in your head is not one place. If an attacker aims to trick you into providing access then they have have to trick you twice, or steal and trick you.

  22. The authorized keys file can specify a program by Marrow · · Score: 1

    Perhaps that program could be "login" or something similar. Also, that give you the ability to use different command and different behaviors on a key-by-key basis for the account.

    1. Re:The authorized keys file can specify a program by XanC · · Score: 1

      That's brilliant! Specifying "login" seems to work quite well. Although I don't think it'll work for doing file transfers.

  23. fail2ban by hamsjael · · Score: 1

    Just install fail2ban: http://www.fail2ban.org/wiki/index.php/Main_Page And set it to something like 6 hours locktime. Really cleans up the logfiles and takes the load of the server, espicially with SMTP. Regards Brian Simonsen

  24. Unblock requests by tepples · · Score: 1

    Good luck paying customer service to handle requests to reset these blocks once your customers forget their passwords, forget caps lock is turned on (common for laptops that don't have a dedicated caps lock LED), etc., or once an attacker gets hold of a particular customer's username and intentionally fails to block the legitimate user.

    1. Re:Unblock requests by Tehrasha · · Score: 1

      Good luck paying customer service to handle requests to reset these blocks once your customers forget their passwords

      Typically there is an account 'lock' mechanism in place before the IP block. Something along the lines of answering 5 personal questions to unlock the account for n-more attempts, But guess who still gets to handle issues of not remembering 'Your favorite TV show ?' Especially when its been years since you answered that question last...

      once an attacker gets hold of a particular customer's username and intentionally fails to block the legitimate user.

      Not an issue, unless the attacker is at the same IP as the legit user.

  25. Carrier-grade NAT or over 9000 bots? by tepples · · Score: 1

    unless the attacker is at the same IP as the legit user

    Which is entirely possible under the carrier-grade NAT commonly used in mobile environments and less-developed countries. And if not, if these blocking measures treat each IP address separately, watch a team of over 9000 compromised PCs run through the over 9000 most common passwords.

  26. you could use a different key for file transfers by Marrow · · Score: 1

    And protect that key in a number of ways