News for hackers. Stuff that matters.
Re:Who's Attacking My Server? by Topolomancer on Sunday March 13, 2022 @11:37AM (#30662177)
Thanks, I was unaware of this---I initially (naively?) thought that being banned would at least deter some wannabe attackers. In your experience, does it do anything if I start collecting some reports on repeat offenders and notify their ISP? Or is that just more wishful thinking of my part?
Re:Who's Attacking My Server? by tptacek on Sunday March 13, 2022 @11:40AM (#30662206)
Absolutely nothing will be done about reports of people running SSH scanners against your host; it would be like Cnut on his seashore throne ruling the waves to recede: even in the unlikely event that a hosting provider shut someone off (we probably would, if you told us), they'd be followed by 10,000 more.
Re:Who's Attacking My Server? by Topolomancer on Sunday March 13, 2022 @11:44AM (#30662258)
Thanks for the reality check, I appreciate it! At least I got a nice map out of this (and made sure that nothing was configured incorrectly, to the best of my knowledge)...
Re:Who's Attacking My Server? by bombcar on Sunday March 13, 2022 @11:52AM (#30662364)
You can get a similar reduction in ssh scans simply by moving the port (and doing nothing else) as the majority of scans only hit port 22.

Whether this is worth the hassle is left to the reader: if you have passwords disabled and only use keys it really shouldn’t matter.

Re:Who's Attacking My Server? by creeble on Sunday March 13, 2022 @06:18PM (#30666305)
In my experience, they find it anyway.

I've run ssh on non-standard ports for over 20 years, and my auth.log is gets a hundred knocks an hour - and mind you, they all return "no key".

It's just life, and it will continue to get worse. Secure your server and ignore it.

Re:Who's Attacking My Server? by pvg on Sunday March 13, 2022 @03:50PM (#30665038)
ruling the waves

This aggression will not stand

Re:Who's Attacking My Server? by ufmace on Sunday March 13, 2022 @03:17PM (#30664740)
I don't think this idea is aligned with how these types of attacks actually work. The dumb stuff like this is almost entirely automated, nobody will notice enough to be deterred by it. Possibly whoever is running it will get a list of servers where the bruteforce login attempts worked, or maybe they just get some kind of low-effort thing like cryptominer or spam server installed automatically.

If an actual person of at least modest skill takes an interest in your server in particular, they're probably not going to do the sorts of things that would trigger fail2ban anyways. They're going to do things like probe around as lightly as possible to determine which services and which versions are running where to try and find things that are misconfigured or at known-vulnerable versions.

Re:Who's Attacking My Server? by cube00 on Sunday March 13, 2022 @12:14PM (#30662620)
As an individual your reports will likely be ignored, however if you do want to report consider contributing to a service like AbuseIPDB. It probably doesn't do much either but at least it feels like I'm doing my part to report abuse and maybe some ISPs will choose to act on it.
Re:Who's Attacking My Server? by klausagnoletti on Monday March 14, 2022 @04:09AM (#30669657)
That's one of many reason why https://crowdsec.net/ was created. It collects (anonymized) threat intelligence from all users, vets it and distributes it as relevant blocklists. Once there's enough users it will be a very effective way to fight bad guys. And unlike your suggestion it DOES make a difference. Currently around 800k signals are collected daily and around 19k vetted malevolent ips are distributed to users on a daily basis.
Re:Who's Attacking My Server? by taf2 on Sunday March 13, 2022 @12:19PM (#30662673)
You should just not allow any IP to access your server to begin with… have a list of trusted IPs - this and only allow public / private key access with a second factor device and I think you should be good…
Re:Who's Attacking My Server? by 71a54xd on Sunday March 13, 2022 @12:23PM (#30662725)
I like to be able to maintain contact with my servers outside of a few specific ip's - I've locked myself out far too many times when I whitelist a very small number.

Anyone have a better workaround for this?

Re:Who's Attacking My Server? by raggi on Sunday March 13, 2022 @02:26PM (#30664252)
Stop using fail2ban/tallow/etc, and follow a sensible guide like https://infosec.mozilla.org/guidelines/openssh to harden your ssh configuration. This will result in about half the attempts failing at protocol negotiation, long before auth (though that ratio is decreasing over time).

Wireguard is also very strong here, as it learned from this kind of problem in SSH and does not reply at all unless authentication succeeds. This makes debugging harder, but also makes leaving it openly listening quite a bit safer, as the protocol surface in pre-auth is absolutely minimal.

Re:Who's Attacking My Server? by stock_toaster on Sunday March 13, 2022 @02:14PM (#30664132)
Maybe use spiped[1] if you are worried about ssh security?

[1]: https://www.tarsnap.com/spiped.html

Re:Who's Attacking My Server? by randomtwiddler on Monday March 14, 2022 @12:21AM (#30668494)
I tried it.

I found it harder to use. I even wrote tests for my use cases and what I learned was a real appreciation of what ssh does, is, and provides and I went the other way and use it in more places than I did before.

Re:Who's Attacking My Server? by whartung on Sunday March 13, 2022 @12:31PM (#30662830)
Perhaps a port knock.

I don't know the mechanics, but a port knock is hitting pre-defined ports in a pre-defined order. When you "shave and a haircut" the ports properly, the server opens something up. In this case white listing (gray listing?) the IP that the knock came from.

You could add a layers to it to make it more complicated.

Re:Who's Attacking My Server? by tptacek on Sunday March 13, 2022 @01:56PM (#30663900)
Please don't use silly stuff like port knocking. Your SSH server already does a cryptographically sound authentication step. "Port knocking" is even more performative than fail2ban.
Re:Who's Attacking My Server? by ficklepickle on Sunday March 13, 2022 @04:24PM (#30665360)
I VPN into my home network as a bastion host, so I'm always connecting from the same IP.

I'm using the cloud providers IP filtering to block everything but my IP on port 22. If something goes horribly wrong, I can disable it thru their web interface.

Re:Who's Attacking My Server? by PeterisP on Sunday March 13, 2022 @12:38PM (#30662931)
IMHO there's no need to worry (but you should disable password access), but if you really want to, port knocking is an option.
Re:Who's Attacking My Server? by jcynix on Sunday March 13, 2022 @02:49PM (#30664479)
During holiday trips, where I might need to access a server from anywhere, I use a list of one time passwords (more or less just a bunch of md5sums) which I can send to a server on https, which then adds the requesting ip address to /etc/hosts.allow for a limited time. This ip address will be able to connect via ssh (still secured with a key) then for that time.
Re:Who's Attacking My Server? by 71a54xd on Sunday March 13, 2022 @11:43PM (#30668320)
This is a really cool idea! I've also toyed with a similar approach of watching ssh logs within very specific time windows and providing a one time key in order to temporarily add another SSH key which I can use to recover the server.

Probably a bit overkill - but it was a fun feature to implement with Go over the weekend. The new Fido2 SSH implementation is also incredibly cool.

Re:Who's Attacking My Server? by NavinF on Sunday March 13, 2022 @11:55AM (#30662389)
Eh I’ve scanned the entire IPv4 space and tested default passwords over ssh from both AWS and my Comcast connection at home and never got banned from either one. I’m sure it can happen, but it’s no big deal.

The GP is right: If you use ed25519 keys, looking at logs and playing whack a mole with countries is just security theater for people who are new to the internet and get scared when their MOTD says “500 failed logins”.

Re:Who's Attacking My Server? by arjvik on Sunday March 13, 2022 @12:12PM (#30662602)
How long did scanning the entire IPv4 space take?
Re:Who's Attacking My Server? by chockchocschoir on Sunday March 13, 2022 @12:42PM (#30662978)
masscan with the right setup (namely hardware + drivers but also connection obviously) can scan the entire IPv4 space (+ all ports) in ~5 minutes.

Source Code: https://github.com/robertdavidgraham/masscan

Article from PoC || GTFO with more internal details on how it works: https://www.alchemistowl.org/pocorgtfo/pocorgtfo15.pdf (Page 66) [Note: PDF is both a valid PDF + valid ZIP file with source code]

Re:Who's Attacking My Server? by kkirsche on Sunday March 13, 2022 @12:22PM (#30662704)
That depends on the machine you are using. Tools like mass scan to locate open ssh ports and then testing them doesn’t need to take long if you have a beefy machine and pipe to the internet.
Re:Who's Attacking My Server? by NavinF on Sunday March 13, 2022 @12:21PM (#30662696)
~4 hours on a 1G port, IIRC

I’m sure you could do it a lot faster with a better CPU and 20% commit on a 10G port