News for hackers. Stuff that matters.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by tptacek on Friday October 06, 2023 @05:25PM (#37796639)
Yes. At this point, fail2ban has become almost a shibboleth for people following security checklists as opposed to reasoning about a coherent threat model. This is a perennial topic on HN, and almost always devolves to some appeal to grooming logs, because of all the authentication errors fail2ban is presumably preventing.

Don't use fail2ban. (Don't use passwords, either!)

https://hn.algolia.com/?dateRange=all&page=0&prefix=false&qu...

Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by callwhendone on Friday October 06, 2023 @05:29PM (#37796681)
I am one of the people to whom you refer. I read about fail2ban in a "Linux Server Bible" e-book around 2010 and have used it on all of my servers since, even though I am careful with my keys and use password-less login.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by wolverine876 on Friday October 06, 2023 @08:59PM (#37798113)
Does fail2ban have authorization to write firewall rules? That's a high-impact vector of attack, should fail2ban have a vulnerability. Also, does fail2ban store credentials that provide that authorization?
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by inferiorhuman on Friday October 06, 2023 @09:32PM (#37798291)
Yes, no.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by dizhn on Saturday October 07, 2023 @11:58AM (#37802784)
It runs as root.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by meepmorp on Friday October 06, 2023 @06:13PM (#37797039)
I use fail2ban because I take break in attempts personally, especially when it's some script trying default logins one after another. It's insulting.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by quesera on Friday October 06, 2023 @06:27PM (#37797159)
> It's insulting

Brute force / credential stuffing attacks against ssh are the mosquitos of the Internet.

Ubiquitous, annoying, and persistent. But nothing personal.

Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by meepmorp on Friday October 06, 2023 @08:54PM (#37798092)
I also take mosquitoes personally, so maybe it's a larger character flaw on my part.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by gnfargbl on Friday October 06, 2023 @06:44PM (#37797297)
You have that exactly backwards: if someone is hitting you with a password bruteforce from a single IP address (which is the only threat that fail2ban mitigates) then it is assuredly nothing personal at all.

A personal insult, if you are ever unfortunate enough to receive one, will be much more stealthy and neither fail2ban nor any other magical rock will protect you against it.

Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by CapitalistCartr on Friday October 06, 2023 @08:25PM (#37797963)
You don't see any tigers around, do you?
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by gog on Saturday October 07, 2023 @04:43PM (#37805386)
Usually they use a big pool of IP addresses, but that doesn't make fail2ban completely useless since they do reuse IPs.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by Cpoll on Friday October 06, 2023 @09:33PM (#37798300)
If anything, you're doing them a (miniscule) favor by keeping them from wasting more resources on failed login attempts. If you really hated them, you'd set up a honeypot.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by diggan on Friday October 06, 2023 @09:44PM (#37798335)
More fun: setup a fail2ban actionban script that instead of banning the IP, shapes the traffic coming from it to have abysmal bandwidth so requests/responses takes really long time, so they'll have to timeout instead of getting failures.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by Tijdreiziger on Friday October 06, 2023 @10:16PM (#37798464)
This is known as tarpitting, and apparently iptables can do it: https://en.wikipedia.org/wiki/Tarpit_%28networking%29
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by nvy on Saturday October 07, 2023 @02:43AM (#37799537)
This is hilarious
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by diggan on Saturday October 07, 2023 @08:50AM (#37801299)
Neat, didn't know that! Think before I've used Traffic Control (tc) for it, but iptables would be simpler.

Available in `xtables-addons` it seems. After install:

    iptables -A INPUT -p tcp -s $SOURCE_IP -j TARPIT # add IP to tarpit
    iptables -D INPUT -p tcp -s $SOURCE_IP -j TARPIT # remove IP from tarpit
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by tetris11 on Saturday October 07, 2023 @12:00AM (#37798904)
Restrict your SSH login yo a single user, then su to your admin
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by meepmorp on Saturday October 07, 2023 @06:42AM (#37800604)
I know how to lock machines down. That's not why I bugs me.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by tetris11 on Saturday October 07, 2023 @03:00PM (#37804497)
Apologies, I guess I just wanted my two cents in and didn't see anyone writing it
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by meepmorp on Saturday October 07, 2023 @05:05PM (#37805563)
No, it's solid advice. Thanks for looking out for others.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by ozim on Friday October 06, 2023 @06:43PM (#37797287)
Grooming logs from attempts seems like shibboleth on its own that is indicating junior level or “security enthusiast”.

Anyone who manages servers professionally does not read logs anymore and does not care about obvious things like people brute-forcing.

Reading ssh logs on your single VPS is security LARPING. Discussing faill2ban as well :)

Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by totetsu on Friday October 06, 2023 @07:22PM (#37797582)
As that gaps of inequality of our winner takes all societies ever widen, anyone just trying to do something for themselves and not for global scale SV company is just meaninglessly role playing.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by ozim on Friday October 13, 2023 @04:20PM (#37875164)
Not really. Only that reading logs by human or even grepping "manually" is super inefficient where you can make a script that will for instance send you a notification when someone actually logs into your VPS.

In world where "login attempts" are basically all day reality reading logs is meaningless. In 2023 no one should be reading logs you should have alerts on events. In 1995 or something if someone was trying to brute-force your user password that was security event to look at and block IP. In 2023 someone brute-forcing is not an event, it is either wrong configuration like not using ssh authentication or not using tools that filter logs automatically and make alerts when something is actually going on.

Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by ivlad on Saturday October 07, 2023 @12:14AM (#37798972)
While I agree fail2ban is a wrong tool to prevent password brute force - better authentication mechanisms should be used instead - it has its uses. For example, it can be used to automatically ban (or alert about) dumb http scanners like gobuster. I am not saying, a determined attacker cannot bypass it, but if it saves me some hassle and raises the bar for them, why should not I do it?

More general, some attacker actions, especially during recon, rely on making many attempts to connect, fetch an URL, resolve FQDN, etc., these could be detected and automatically responded to, making attacker’s job harder and providing extra visibility to defenders.

Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by kasey_junk on Saturday October 07, 2023 @09:10AM (#37801413)
You shouldn’t use it because fail2ban itself can (and has been) attacked. It doesn’t make the attackers job meaningfully harder but does add complexity to your systems, that complexity is weakness.
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by ivlad on Saturday October 07, 2023 @09:25PM (#37807039)
I looked at fail2ban exploits and they are either LPE due to file permissions or command injection in other tools like mailutils.

Citation needed for the claim “has been attacked” if you refer to real attacks in the wild.

Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by wglb on Sunday October 08, 2023 @12:34PM (#37811944)
Re:Fail2Ban – Daemon to ban hosts that cause multiple authen... by ivlad on Sunday October 08, 2023 @12:56PM (#37812214)
Yeah, that’s command injection in mailutils I mentioned, not in fail2ban itself. Did you see how it’s supposed to be exploited? Did you see a real-life exploitation?

While it’s a nice trick, it’s simply not relevant. And the vulnerability before that seems to be 10 years old. I’d say it’s a decent track record.