84 comments

[ 40.9 ms ] story [ 1272 ms ] thread
musl only, the quick fix:

     PasswordAuthentication=no

Which is a good advice in general.
How do you break back into your digital life? You wake up in a strange place. Something happened. Everything's gone. No wallet/keys/smartphone/tablet/laptop. How would you get back into your digital life given only a laptop with access to the Internet, unless something, somewhere is passwordauthenticate=yes.
Remotely: An encrypted file with a seed / master passwords to all the other data, published under a public url you can remember, but not linked anywhere and not listed.

Locally: Same, but printed out, laminated, in a safe place with other documents.

[delayed]
You go travelling in a foreign country and get mugged. You have no phone no wallet no keys, just something you know and the goodwill of strangers.
> goodwill of strangers

Who can presumably get you in touch with the relevant embassy or consulate or, failing that, local authorities.

> You wake up in a strange place. Something happened. Everything's gone. No wallet/keys/smartphone/tablet/laptop.

at this point the _last_ thing i care about is my email.

where am i? am i ok? how are my friends/loved ones?

once those are in place, it becomes clearer how to get back to "normal"

With nothing, how do you reach them? Your friends and loved ones are what's at the other end of the email/Internet access.
i guess if i have some sort of internet access (otherwise why would i be worrying about passwords), i'd set up a new account(s) and message those friends
1Password subscription and the memorized key. 1Password is the only place my ssh private keys are stored.
1PaSsWoRd... SuBsCripTIon... it's just unbelievable how pathetic today's average HN user is...
The somewhere for password authentication is a place you have physical access. Not ssh.
There's been a natural disaster and your home is now inaccessible. With global warming going the way it has, that's looking more and more likely each day. Fires, hurricanes, earthquakes, war, tsunami, etc.
If access to a system is critical, I'm going to have some way to access the system other than SSH (out-of-band access through a BMC, serial port, or VM host) that doesn't exclusively rely on the same means of authentication.

On systems that receive regular updates, SSH can fail for many reasons other than authentication problems, after all.

I log in via console, either physical or virtual (the latter requires MFA though)
A scenario where all the backups are gone and the server is somehow the only thing that survived is not a very plausible one.
Depends if you're backing up somewhere else online (also is that protected by 2FA?). You must not be in a place with many huge natural disasters.

And this is assuming the server is somewhere else on the cloud.

> You must not be in a place with many huge natural disasters.

Or I have proper backups synced across the world on different providers. The likelihood of everything failing is not a vector I worry about. If that happens I have bigger problems to worry about.

Does this happen to you a lot? You may have other issues
PasswordAuthentication=no usually means that ssh stops directly reading /etc/passwd to authenticate, not that it stops accepting passwords completely. You'll still be able to log in with a correct password, provided KbdInteractiveAuthentication is still on, PAM is available, and the PAM policy allows for it.
The email at the root of my identity is tied to a country code domain in my country. There are robust legal processes for enforcing my status as the registrant and regaining control of it. Once I have access to that, I can use that to gain access to everything downstream.

Is it fast? No, but that's a feature.

But it does mean I get to lean on the existing processes and identity verification already part of the government bureaucracy and the courts as my backdoor.

Sometimes you just have to start over. It’s not the end of the world.
imo this is a good advice only if the devices that connect to the server have their home encrypted and ssh private key protected.
Another thing I would recommend is having your servers in a wireguard net and only allowing ssh from inside that virtual network. There is no need to publicly expose ssh.
Why is wireguards auth better than openssh auth?
(comment deleted)
Wireguard allows effectively no configuration around auth, and so it's more likely that it is configured in a secure manner.

Openssh allows: password auth with weak passwords, PAM with potentially insecure PAM modules, gssappi, configurable ciphers, etc. Wireguard has none of those.

Each of those auth methods adds more possible vulnerable code paths and accidentally insecure configurations. It's very reasonable to believe that wireguard auth, since it has far fewer moving parts and configuration knobs, is will have fewer ways it can be insecure.

I was always uncomfortable that it's on by default and surprised anyone uses it it. It's also more cumbersome compared to just using a key. I feel like using keys is the password manager analogue for SSH.
It's irrelevant. There's no reason this should be any more effective in the face of software bugs then anything else.
I presume Dropbear, thus musl-based OpenWrt routers are also not affected? Not that Dropbear has been an example in that regard.
There is this write-up/fancy page from the person who found the vulnerability[0] (HN discussion[1], how I found this thread).

At the bottom of that it says dropbear is unaffected.

> on debian, ubuntu, fedora or anything else with glibc? going through pam? dropbear? openbsd? you're fine

[0] https://sshhole.com/

[1] https://news.ycombinator.com/item?id=50378228

No, the majority should not be affected.

Except in the case where their images are built with OpenSSH instead of Dropbear, which is the case for some manufacturers. (Turris, was noted as one such vendor)

I'm sure some people running lightweight containers just had a heart attack.
I would imagine the vast majority of lightweight containers don't contain an ssh server?
You'd be surprised by the amount of people using containers that don't know/care what is inside.
Seems slightly confusing that the OpenSSH release notes page says:

> This release contains a critical security workaround that affects Linux systems that use the musl libc and PAM disabled.

But that there's nothing about it on their security page.

Even if it's not technically a bug in their code, the fact that they've made a "critical" release to address it suggests that it should probably be listed on the security page as well. But maybe (hopefully) they just haven't updated the security page yet.

musl libc violates the POSIX documented behavior of `crypt()`¹

> Upon successful completion, crypt() shall return a pointer to the hashed password; the first two bytes of the returned value shall be those of the salt argument. Otherwise, it shall return a null pointer and set errno to indicate the error.

Musl returns '!' or '*', not null.

¹https://pubs.opengroup.org/onlinepubs/9799919799/

Who does PasswordAuthentication=yes in this day and age anyway.
People who use AuthenticationMethods "publickey,password"

You must present a key first after which you must enter a password.

Just do no password at all.
As this is apparently affecting openwrt, probably a fair number of openwrt users, if I had to guess
I thought OpenWrt used Dropbear by default?
If you run a cockpit service on your server you will need password authentication enabled, unfortunately.
(comment deleted)
I went and checked this. I can admin my server with Cockpit using either the web service (using my username/password) or the desktop client (via private key) without issue even with SSH password authentication disabled. I do usually disable the web service so had to reconfigure to check.
it's the default for most systems. I can't remember a time I had to not turn it off.
We have clients (regulated banks and insurers of various sizes) that send us feeds via SFTP. You might be surprised what proportion of them ignore our “we strongly recommend key based authentication” and ask for password auth instead.
[delayed]
Previous company: probably. It could be a dealbreaker for the client, and we bent over quite readily on a number of issues considered minor (keys are best practise, but passwords are so common it is difficult to argue that they are so bad they should be refused).

Current state (now we have been bought and are effectively more than an order of magnitude bigger): I definitely don't have opportunity to make a unilateral decision like that. Even though the larger company has a more “fair enough, feel free to go elsewhere” attitude when a small client says “if you can support × that is a dealbreaker for us” then we could previously afford to take as our stance, some of the bigger clients are definitely paying us enough, and do use passwords, that someone above me would overrule a keys-only decision.

When I set up a client sftp drop I had the luxury of saying "key based access only"

Then it was a surprisingly customer service intensive process to get the keys from the customers. I never did manage to automate it fully. Weird enterprise systems I have never heard of with strange key formats. ssh1 keys, email mangling them. Their internal processes requiring a password.

And way to many "I am sorry but that was the private key you sent me, That key is now compromised and you will need to remove it and generate new keys anywhere it was used"

I almost regret not allowing passwords, almost, despite the headaches key based is still much better.

Don't most cloud providers default to that? I know I had to force some to deploy with a key and even then PasswordAuth was often on and had to be disabled.
Wow, what a bug. I expect the exploit is literally as simple as trying to ssh in as a user with the password has ‘*’ in /etc/shadow and typing anything as the password.

To the extent that systems that are configured in the vulnerable manner exist in the wild, I’m surprised they weren’t exploited years ago by trivial ssh bots.

P.S. Wow, I’m reminded of just how awful traditional UNIX-y C APIs and code are.

P.P.S. The musl code in question is nuts. The API it implements is awful. Seriously, here’s the manpage:

https://man.archlinux.org/man/crypt.3.en

You can’t call this function correctly. sshd’s “fix” is basically to assume that a too-short return is an error return instead of a success return.

PAM is also awful, but this is worse.

Maybe I'm misunderstanding, but u/tonnydourado pointed out on another thread https://news.ycombinator.com/item?id=50378228#50380029

"It starts with a bold claim: "ssh accounts that should not accept a password will accept any password between 256 and 1024 characters". But then it keeps adding qualifiers:

- 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

The conditions are all ANDed, miss a single one and you're fine."

This doesn't seem to be nearly as big as an issue as they're making it out to be

Alpine matches the first.

Disabling PAM has been "generally good security advice" for decades; I remember suggestions to not use it in the 2000s.

Password logins are often enabled, especially on multi-user and default setups.

If alpine uses the * feature, it's going to be pretty common. Gentoo has it, as does Ubuntu.

If password logins are enabled, you're almost guaranteed to have at least one user with a password (root on all my boxes has one, even if I never use it and it's random garbage).

So the cheese lines up pretty well, this affects quite a bit.

If password logins are enabled, someone almost certainly has a password.

So it's essentially one of the 'recommended configurations'?

I'm seeing people I generally trust in the scene memeing on twitter, while others are freaking out. Its hard for me to tell how fucked we are, I guess

It's always 50/50, you're either fucked or you ain't.

I think this time around it's mainly Alpine Linux and a few custom-rollers (Gentoo with musl could easily get to this place).

Yeah, as the dust starts to settle a bit it seems this is the largest case. Many 'stock' Alpine images, Docker images built on those, and embedded systems seem to be the main candidates.
Which distro has password authentication enabled by default? I haven’t seen that in years.
No, no don't let all of that distract you. We gotta hype this. This is the new SSH2SHELL dude. Have we registered the domain yet? I'm scheduled on Fox News tomorrow.
They are going to be disappointed with SSH2SHELL it definitely isn't worth the hype. Using argument injection vulnerability created by a recent pull request that has been patched isn't exciting enough for a web site.
>We consider the root cause of this bug to be outside OpenSSH itself, but we're in a good position to deliver a mitigation quickly.

So not a ssh issue but an issue specific to Linux using "musl libc without PAM".

Well, OpenSSH contributes to this by mixing hashes from the shadow file. The musl code would be correct if OpenSSH passed in the hash from the user account that is being logged-in.

They instead pass in a different user’s hash (to avoid timing attacks) but end up comparing the result from musl against the actual user account, defeating musl’s simplistic safeguard to avoid this very issue.

I’d probably still call this a musl thing. Errors should result in a NULL return even if the application crashes from there, but at the very least a return value intended to not match any actual hash in /etc/shadow should be a random string or predefined UUID or something other than *.

Randomly using a different users's hash seems so wrong to me, but maybe I've just been too deep in PII stuff for too long.
This looks terrible for musl, what a collection of terrible decisions on their part. I guess I'm staying away from it.
To err is human. There’s no escaping it, I’m afraid.
I agree entirely, but I'm not sure changing `crypt` to return `"*"` instead of `NULL` on failure qualifies. It's much more of a considered decision, which happens to be very wrong.
> We are making this release as fast as possible (we learned of the problem yesterday) because we have recently observed multiple cases of rapid bug rediscovery by AI agents, sometimes within hours, and so now consider long embargo periods to be a dangerous practice that primarily benefits attackers.

I think this will likely become standard. Nevertheless, a few stormy months are ahead.

Is this actually effective against Alpine? The default install seems to use ! as the placeholder in /etc/shadow instead of * and trying the attack doesn't seem to work.
I would say that PasswordAuthentication=yes is by itself a vulnerability.
Since OpenSSH is included in the base install, and enabled on OpenBSD - is it correct that they will need to update the famous:

“Only two remote holes in the default install, in a heck of a long time!”

https://www.openbsd.org/

This vulnerability doesn’t exist on non-Linux systems, so not yet!
OpenBSD doesn't provide musl-linked OpenSSH by default, so not yet[x2]
No, the bug is in musl but manifests in OpenSSH when compiled against it.
OpenBSD is not affected, so apparently they are doing something right. But also glibc linux is not affected and pam linux is not affected, so it is only musl linux with the remote hole.
You became a victim of a very misleading post title. This isn't an OpenSSH problem at all, it's a musl problem.

I'm pretty sure the misleading wording is deliberate, OpenSSH is an excellent but non-commercial project which a bunch of entities would love to gain control of, in order to bug it with their spy-bugs - thus the constant nagging on the bot-infested web.

The OP should be flagged.

Here's an unrelated security issue I opened with Alpine earlier this year

https://gitlab.alpinelinux.org/alpine/aports/-/work_items/16...

It didn't give me the impression that I was dealing with a secure piece of software, it seemed like they were dealing with very complex issues while laughably failing at the industry basics that were settled years ago.

Similarly Ubuntu was also the only other distro that fucked this simple permissions config up, and lately with the latency to fix the TCP vuln, it seems to confirm that these are not reliable distros for the coming security era.

I use "AuthenticationMethods publickey" which would disable all authentications except public key.

Isn't this better than "PasswordAuthentication no"?

The potential affected space is huge.. it does not matter if most docker images ship without openssh.. it does not matter that most security conscious image builders do not enable plain passwordauth.. it does not matter that ssh port is not commonly exposed.. the amount of alpine docker images in current live use over the whole internet is such a vastly huge number that you're going to bet that even given a small percentage of those 'misusing' docker and their containers being affected is still going to result in a a huge number of affected containers.
crypt glibc also sets errno to ERANGE if the string is too large, doesn't Musl libc do the same? OpenSSH should also add this check.