Live data from Hacker News

What SSH Hacking Attempts Look Like

medium.com

101–110 of 186 posts

Re: What SSH Hacking Attempts Look Like

#101
post #2

Fairly standard stuff, definitely interesting to see all the IoT credentials attempred. I'd recommend SSHGuard over fail2ban though, I seem to remember the version of fail2ban in the Debian repos completely choking on IPv6 and failing open which is obviously undesirable.

Fail2ban failing on ipv6 is strange given it doesn't do anything networky. It just analyses logs and updates iptable.

Calling "iptables" with a v6 address doesn't sound too clever actually.

Re: What SSH Hacking Attempts Look Like

#102
post #80
post #52

Changing the SSH port proved to be most successful. Yes, of course you can find the port with a port scan. But it keeps the logs clean. And I don't want to waste CPU cycles on some brute-forcing idiots.

(I'm primarly a developer, not sysadmin) Is using non standard ports a reasonable approach? On one hand, it's kind of a security-by-obscurity measure, and it's also a (very minor) inconvenience to real users. However if it's not being used in place of other reasonable security measures, I'm not really sure what's bad about it, but it does feel a bit janky to me. Same goes for other non-public services such as VPN. Wh…

> I'm not really sure what's bad about it

You say it yourself:

> also a (very minor) inconvenience to real users

I would disagree with the “very minor” part. To paraphrase myself (https://news.ycombinator.com/item?id=6617312):

As I understand the argument, it’s “Changing port number add security, therefore it’s a good idea.” I think nobody argues that it adds security. The problem is that:

1. It adds very little security: 16 bits is not much, and the result is not 256 bits (say) of SSH key plus 16 bits equals 272 bits, but instead effectively still 256 bits, or 256+8×10⁻⁷³ bits.

2. The security it adds is itself bad (sent in cleartext, easily brute-forced)

3. These problems stand against the many drawbacks of this previously discussed (complexity, confusion, etc.).

And the final argument: If increased security is what you want, simply increase your key lengths and/or password lengths, and you will get much more than 8×10⁻⁷³ bits of security, without any of the above problems.

Re: What SSH Hacking Attempts Look Like

#103
post #93
post #80

Earlier quoted context omitted.

(I'm primarly a developer, not sysadmin) Is using non standard ports a reasonable approach? On one hand, it's kind of a security-by-obscurity measure, and it's also a (very minor) inconvenience to real users. However if it's not being used in place of other reasonable security measures, I'm not really sure what's bad about it, but it does feel a bit janky to me. Same goes for other non-public services such as VPN. Wh…

I am using high ports >30000 but you can chose what you want.

Really, this sounds like a bad practice to bind on non privileged port.

A user can keep running a program to check if your non privileged port can be bound and if it could, it can start any behaving daemon that could be pretending to be a valid SSH daemon but could have anything like key loggers. Even a single restart of sshd could make it happen.

Re: What SSH Hacking Attempts Look Like

#104
post #2

Fairly standard stuff, definitely interesting to see all the IoT credentials attempred. I'd recommend SSHGuard over fail2ban though, I seem to remember the version of fail2ban in the Debian repos completely choking on IPv6 and failing open which is obviously undesirable.

My experience with SSHGuard was it treated monitoring events (specifically from monit) as failed attempts and blocked further attempts marking the service as unreachable. I'm sure this can be configured but fail2ban does not block such attempts.

Re: What SSH Hacking Attempts Look Like

#105
post #55
post #3

$ grep -c sshd /etc/hosts.deny 1192 $ uptime 11:58:51 up 327 days, 21:33, 1 user, load average: 0.13, 0.11, 0.09 I'm using DenyHosts for this, there are alternatives but this works for me. http://denyhosts.sourceforge.net/

you should probably upgrade that kernel

What can you tell from the line?

Re: What SSH Hacking Attempts Look Like

#106

Earlier quoted context omitted.

I'm pretty fanatical about efficiency, but it's kind of annoying to have to remember where in the argument sequence for a whole bunch of commands the input file goes. Of course once you use the 'cat' trick you then have to remember which comments require '-', '-f -' or something to that effect because whoever programmed them didn't think the primary use case was to work as a filter. Pipes are one of Unix's most usefu…

As a compromise you could just do "< infile grep word | awk '{...}' | sort" so you still have the input file first but got rid of cat ;)

Typing speed has never been my handicap. To me this seems like just another case of premature optimization, the fact that you are typing in a command is a pretty good indication it is a one-off.

Re: What SSH Hacking Attempts Look Like

#107
post #80
post #52

Changing the SSH port proved to be most successful. Yes, of course you can find the port with a port scan. But it keeps the logs clean. And I don't want to waste CPU cycles on some brute-forcing idiots.

(I'm primarly a developer, not sysadmin) Is using non standard ports a reasonable approach? On one hand, it's kind of a security-by-obscurity measure, and it's also a (very minor) inconvenience to real users. However if it's not being used in place of other reasonable security measures, I'm not really sure what's bad about it, but it does feel a bit janky to me. Same goes for other non-public services such as VPN. Wh…

It's not security by obscurity; obscurity can be a useful component of security. Something that's well protected and hard to find is less likely to be compromised than something that's well protected and easy to find, because some percentage of attackers won't bother to look for it. "Security by obscurity" occurs when someone tries to use obscurity in place of security, by 'hiding' their insecure thing.

Besides, running a service on a non-standard port offers pretty good protection against a fairly common threat scenario in which a new vulnerability is discovered in a well-known service and attackers start sweeping the internet for open ports in order to exploit it.

Not that you should automatically run your services on non-standard ports; there are tradeoffs as others have mentioned. But if you've got to expose something dangerous to the internet at large (and that's an assumption that you should question frequently), then avoiding the standard ports can be a useful tool.

Re: What SSH Hacking Attempts Look Like

#108
post #52

Changing the SSH port proved to be most successful. Yes, of course you can find the port with a port scan. But it keeps the logs clean. And I don't want to waste CPU cycles on some brute-forcing idiots.

I have my perimeter sshd on port 22... Only bound to IPv6

It's a big quiet void out there in sixspace.

Re: What SSH Hacking Attempts Look Like

#109
post #80

Earlier quoted context omitted.

(I'm primarly a developer, not sysadmin) Is using non standard ports a reasonable approach? On one hand, it's kind of a security-by-obscurity measure, and it's also a (very minor) inconvenience to real users. However if it's not being used in place of other reasonable security measures, I'm not really sure what's bad about it, but it does feel a bit janky to me. Same goes for other non-public services such as VPN. Wh…

> it's kind of a security-by-obscurity measure This comes up as a point of confusion often, so allow me to clarify: A non-standard port as the only security mechanism (e.g., an unauthenticated HTTP admin-interface) would indeed be 'security through obscurity', but a non-standard port as an extra mitigation layer on top of existing security mechanisms (e.g., SSH authentication) is 'defense in depth'.

That’s a distinction I never understood but makes a lot of sense. Thanks for the explanation.
Post reply on HN