Live data from Hacker News

Bug in widely used OpenSSH opens servers to password cracking

arstechnica.com

11–20 of 62 posts

Re: Bug in widely used OpenSSH opens servers to password cracking

#11
post #3

Earlier quoted context omitted.

Have you tried fail2ban? It really helps to keep the hacking attempts down on your ssh-server(s), especially if you increase the bantime from the default 600 seconds to a couple of million...

It is all fun and games until you ban yourself for a couple of million seconds... Far too many people ban themselves with fail2ban.

Just make sure to whitelist known-good IPs.

Re: Bug in widely used OpenSSH opens servers to password cracking

#12
post #2

It's interesting to log failed SSH attempts, I normally get someone trying to brute force access within an hour or two of brining a server up. Changing to a non standard port doesn't deter them for long.

Recent Google Cloud Engine images have Sshguard enabled by default.

Now I do wonder: does this 'exploit' still cause a log line immediately after each attempt? And also, do iptables firewall rules also apply to open connections, or just to new ones? In the latter case, Sshguard and fail2ban are circumvented for a rather high number of attempts.

Re: Bug in widely used OpenSSH opens servers to password cracking

#13
post #3
post #2

It's interesting to log failed SSH attempts, I normally get someone trying to brute force access within an hour or two of brining a server up. Changing to a non standard port doesn't deter them for long.

Have you tried fail2ban? It really helps to keep the hacking attempts down on your ssh-server(s), especially if you increase the bantime from the default 600 seconds to a couple of million...

Note that Fail2ban doesn't support IPv6 at all [1]. I'm currently using sshguard [2] instead.

Edit: Thinking about it, I guess that blocking single IPv6 addresses, as sshguard does, doesn't really help at all, as it's easy to obtain huge subnets. (This might even open the door to an iptables DDoS?) Blocking whole subnets, on the other hand, doesn't sound clever either. (Who knows how many users are sharing the same subnet?)

So, should I just close port 22 on IPv6 altogether? Not a very sustainable solution. This needs more research!

[1] https://github.com/fail2ban/fail2ban/issues/39

[2] http://www.sshguard.net/

Re: Bug in widely used OpenSSH opens servers to password cracking

#14
post #2

It's interesting to log failed SSH attempts, I normally get someone trying to brute force access within an hour or two of brining a server up. Changing to a non standard port doesn't deter them for long.

Recent Google Cloud Engine images have Sshguard enabled by default. Now I do wonder: does this 'exploit' still cause a log line immediately after each attempt? And also, do iptables firewall rules also apply to open connections, or just to new ones? In the latter case, Sshguard and fail2ban are circumvented for a rather high number of attempts.

Iptables applies to all processed packets.

One of the common gotchas though is that if you add a rule to allow "Established" connections, and then try to add a new rule after that which says "block IP X", that will not sever existing connections.

To block existing connections you can remove that entry from the connection tracking table, or you can insert your "block IP X" rule above your "allow Established connections rule".

Re: Bug in widely used OpenSSH opens servers to password cracking

#15
post #9
post #3

Earlier quoted context omitted.

Have you tried fail2ban? It really helps to keep the hacking attempts down on your ssh-server(s), especially if you increase the bantime from the default 600 seconds to a couple of million...

Never seen the need for fail2ban when you can do the same thing with a couple of iptables rules.

Mind sharing those ? (Or do you mean you add them manually at each attempt ?)

Re: Bug in widely used OpenSSH opens servers to password cracking

#16

Earlier quoted context omitted.

It is all fun and games until you ban yourself for a couple of million seconds... Far too many people ban themselves with fail2ban.

I use key-based authentication and fail2ban. Since that won't fail like passwords, it works wonderfully and the chances of my being banned are nil.

* Until you have too may keys on your agent

* Until you have a script repeatedly attempt w/o your keys unlocked

* Until you try from a new computer on the same network and fail to setup your keys first.

Ask me how I know :)

Re: Bug in widely used OpenSSH opens servers to password cracking

#17
post #2

It's interesting to log failed SSH attempts, I normally get someone trying to brute force access within an hour or two of brining a server up. Changing to a non standard port doesn't deter them for long.

Are you using a low port number? I see precisely 0 failed ssh login attempts on my servers.

Re: Bug in widely used OpenSSH opens servers to password cracking

#18
post #2

It's interesting to log failed SSH attempts, I normally get someone trying to brute force access within an hour or two of brining a server up. Changing to a non standard port doesn't deter them for long.

Here's a one-line patch that logs the passwords the bots are trying too. http://w8rbt.org/patches/sshlog.patch

Re: Bug in widely used OpenSSH opens servers to password cracking

#19
post #10
post #2

It's interesting to log failed SSH attempts, I normally get someone trying to brute force access within an hour or two of brining a server up. Changing to a non standard port doesn't deter them for long.

But what does deter them is port knocking. We went from many attempts per hour to not a single one since adding port knocking to our firewall. Port knocking has been mentioned before on HN and it generally gets a luke warm to negative response. It completely baffles me, this response.

It's just caution. Using port knocking by itself would be a recipe for security disaster. As an addition to an already secure system, it's okay if you just want to reduce junk in your logs, perhaps. Many would ask, in that case, why use port knocking at all?

Re: Bug in widely used OpenSSH opens servers to password cracking

#20
Disable password auth and ensure you have another way in if necessary. Fail2ban, changing ports and port knocking doesn't really add anything more unless you're concerned about log sizes, and just increases the hassle for you.

Mozilla's wiki has some information on strengthening the security of your OpenSSH setup.

https://wiki.mozilla.org/Security/Guidelines/OpenSSH

Post reply on HN