Some Bits: Nelson's log

ssh firedrill: patches, fail2ban

Major new ssh vulnerability including a remote root exploit of SSH servers. So far the exploit has only been demonstrated on 32 bit systems and that takes several hours of hammering a race condition. But it’s likely to get worse over time.

The easy fix is to install an update; here’s how to do that in Ubuntu. The openssh release notes are also helpful. They released version 9.8 to fix it. Ubuntu backported that fix to older versions. Unfortunately I have a system stuck at Ubuntu 23.04 which is not getting updates anymore. So I need a temporary workaround.

I went with installing fail2ban. I do not like that system, it’s a gross hack with way too many config options that can completely break your system. But I got it done. The ubuntu fail2ban by default doesn’t ban anything (I think). You copy jail.conf to jail.local and then edit the sshd section to enable it. There’s a bunch of outdated guides, I ended up using the Claude AI to figure it out.

Anyway, end of the day fail2ban scans your ssh log files and creates IP table rules to block aggressive clients. Not a full fix but should make a race condition exploit a lot harder. You can see what fail2ban is doing in the moment with fail2ban-client status sshd or use iptable -L to see the rules it’s creating and removing. Lol, just realized I log in with CGNAT. So some other Starlink user on the same IP address as me could conceivably block me from logging in. Oops.

Another option mentioned in the release is to set sshd’s LoginGraceTime to 0. That means “no limit”, so clients never get dropped if they hang during login. But that now opens you to a DDOS, I think by default sshd allows 100 simultaneous logins and if someone’s trying to exploit the race condition they’d quickly fill all those slots. Not positive.

The last thing I did was look at my bash history to see what hosts I ssh into to make sure they are all updated. Unfortunately you can’t read known_hosts anymore to see where you’ve logged in since the hostnames are hashed. Again Claude AI to the rescue, here’s what it recommended:

history | grep ssh | awk '{for(i=1;i<=NF;i++) if($i~/^[^-].@./) print $i}' | cut -d'@' -f2 | sort -u

I should probably disable ssh entirely on my public interfaces and require tailscale to log in. But despite a year+ of reliability I still don’t fully trust tailscale, what happens if it breaks for some reason and I can’t log in?

Comments


Ugh, thanks for the nudge. I have almost everything of mine on serverless, except for one little box way back on Ubuntu 20 that can't go serverless just yet. Fortunately, it's not stuck, so I can upgrade! ...unfortunately, that means I need to upgrade. 😕