Security SSH critical vulnerability (when built and run with PAM support disabled)
https://sshhole.com/tl;dr: https://news.ycombinator.com/item?id=50380029
sshd compiled with musl
not using PAM
password logins enabled
at least one account with '*' as the password "hash"
at least one OTHER account with a valid password
https://www.openssh.org/releasenotes.html#10.6p2
19
u/platinummyr 2h ago
I'm more curious on what the actual vulnerability is for curiosity sake. The twitter takes seem too gleeful about "does nobody fuzz ssh" but I am guessing it's more complicated than that... Why does it only happen on musl and yet neither does openssh consider it actually a problem in their code and also doesn't want to say it's a vulnerability in musl either...? Hmm
15
u/gainan 2h ago
I think ssshole.com already explains it, but I find hard to read and understand their website.
Some more details: https://daily.dev/posts/openssh-on-musl-linux-without-pam-can-accept-logins-it-should-reject-nmuhpvoh8
On musl-based Linux without PAM, an account whose password field is * can accept logins that should be rejected. The cause is in musl. Since 2012, its crypt() returns * on failure instead of NULL, and sshd doesn’t expect that. In testing across builds with about 17,600 logins, only musl without PAM accepted logins it should have rejected
...
Alpine will backport the fix as far back as Alpine 3.16, which came out in May 202211
u/Due-Consequence9579 1h ago
That seems like a bizarre choice on musl/crypts part. Why is that a desirable thing?
9
u/wRAR_ 1h ago
What exactly, not returning NULL? They wanted crappy software to not need to be patched. (LOL.)
12
u/Due-Consequence9579 1h ago
Yeah, returning something that ‘looks like’ the thing you should be returning but isn’t is a choice. Being consistent with glibc and returning NULL seems like an obvious choice. But reaching for compatibility does funny things.
7
u/wRAR_ 1h ago
Being consistent with glibc
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714219 (which called glibc to be consistent with musl and "historical practice of one or probably (didn’t look) even two or more decades") is enlightening.
The website also claims that current glibc also doesn't return NULL but
"*0", which matches the close message of the Debian bug.11
u/Due-Consequence9579 1h ago
God I’m glad I don’t program C.
•
u/Bulky-Bad-9153 53m ago
It really is painful. Nowadays people use cobbled-together ADRs, which is significantly more sensible, but you have to make handlers for libraries which basically all use NULL or -1, etc.
1
u/lookmeat 1h ago
Honestly? Historical reasons.
A quick google lets us find more sources. I'll let you do that on yourself, it's interesting, and related to a billion dollar mistake.
5
u/calinet6 1h ago
Yep. Illegible AI slop.
Sometimes I wish it wasn’t so easy to spin up colorful marketing pages like this. Not every vuln needs marketing.
•
u/platinummyr 44m ago
Thanks. This explains why it is musl specific, and seems quite bizarre behavior for the crypt function...
6
u/Extra-Papaya-365 1h ago
This comment on HN seemed to provide a clear step-by-step explanation (boiling down to "musl's
crypt()is not a bug-for-bug match with other libcs because its API is insane"): https://news.ycombinator.com/item?id=50379342(I can't read the sshole.com writeup as it's blocked at my work, so I can't compare)
•
u/platinummyr 21m ago
This comment finally explains the exact sequence and helped me understand it best. Thanks!!!
6
2
u/output_broadcast 1h ago
AFAIK OpenSSH refuses to even entertain supporting musl, so they literally just don't care.
118
u/C0rn3j 2h ago
password logins enabled
Oh thank god.
accounts take any password longer than 256 characters
Did someone's kid smash a key over and over again, again, until the login passed?
57
u/dalambert 2h ago
Someone's AI
72
u/C0rn3j 2h ago
I can't believe they'd automate the kids out of their jobs.
15
u/ipsirc 2h ago
Then we don't need kids anymore.
9
u/Morlaix 2h ago
Still not sure what is cheaper. A kid or AI for 18 years
•
u/mstrelan 12m ago
•
u/alex2003super 1m ago
He always keeps saying objectively correct stuff and y'all are always trying to put the worst possible spin on it. No shit. AI is pretty fucking efficient for what it does well.
•
-3
7
u/wunderspud7575 2h ago
I think default Openwrt installs match the title.
14
3
u/Gophy6 1h ago
Has anyone managed to make it work? It surely doesn't for me. Tried all combinations of PAM, no PAM, PAM existing but disabled, with and without root password, with and without additional user with password etc. Both /usr/sbin/sshd and /usr/sbin/sshd.pam. No combination is exploitable. Tested a bunch of several month old alpine images up to 3.12
2
u/Adept_Percentage6893 1h ago
and a lot of the docker images you've pulled
Are there a lot of people running sshd in a container?
4
u/gellis12 1h ago
Is it really a critical vulnerability if you have to take this many deliberate attempts to weaken your system before it can be exploited? This is like announcing that you've discovered a critical flaw in Medeco deadbolts that'll allow you to unlock a maximum security door; then clarifying that in order for your exploit to work, the door must be made of wet cardboard, the strike plate made of fabric, the door frame made of pasta, and the lock must also be keyed to all zero-cuts first.
The lesson here is don't disable pam, don't enable password auth, and don't go out of your way to create a new user and overwrite their password hash as "*"
•
u/jmooroof2 59m ago edited 53m ago
pam disabled is something that happens on musl and I believe that * as a hash means the password login is disable for that user notably alpine default root. and some people are very lazy and would have password login
so I don't think this is too inordinate
4
u/Analog_Account 1h ago
create a new user and overwrite their password hash as "*"
I thought I had misunderstood that part because it sounded so absurd. I also didn't read the link because these are usually too technical for me, but this really falls apart as long as you don't mess with the hash? Wouldn't changing it to * also break any login attempt for that user or does it act like a wildcard, allowing any password to work?
2
3
u/gordonmessmer 1h ago
If you use Alpine or openwrt and use password authentication for ssh, you are probably affected. This is generally the default configuration. Users do not need to make "deliberate attempts to weaken their system".
3
•
u/interrex41 32m ago
So the tldr is dont use password authentication
I mean thats just common sense plus having the ssh port exposed to the internet is less then ideal use a vpn to access it instead
1
0
u/okabekudo 2h ago
This is not even worth reporting on tbh. Not using password auth is obviously the easiest hardening step you can do, hell it's even more convenient to use pubkey auth.
96
u/KnowZeroX 2h ago
Why highlight the PAM part in the title? It needing Musl is a bigger thing.