r/linux • • Nov 05 '26

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

https://hachyderm.io/@damienmiller/117563026759098135

https://x.com/astuyve/status/2118344982134128837

558 Upvotes

139 comments sorted by

View all comments

Show parent comment

2

u/SN4T14 29d ago

No, because many libc implementations support many different hashing algorithms with widely varying compute requirements. If you pass a random string into glibc for example, it falls back to descrypt, which is many orders of magnitude faster than yescrypt, scrypt, bcrypt etc. that are the default on most systems. The settings are also implementation specific and a valid random string in one libc implementation may be rejected as invalid for another and not trigger any hash computation at all.

The only safe, portable way to ensure it will take a realistic amount of time is to use a real hash.

1

u/KontoOficjalneMR 29d ago

The only safe, portable way to ensure it will take a realistic amount of time is to use a real hash.

Not really. The other solution I've proposed is perfectly valid. You compute bogus hash once at the start - using the same method that you use to hash the password otherwise.

1

u/SN4T14 29d ago

That still doesn't solve the issue of not knowing the hash function that is used for users on the system you're running on. There is no portable way to determine what the system default hash function is, or which settings to pass in to crypt to get it to use that hash function. The only portable way to ensure you use the same hash function is to pass in a real hash.

1

u/KontoOficjalneMR 29d ago

At runtime you know. You're literally using that hashing function to hash the user input and compare.

1

u/SN4T14 29d ago

I don't think you know how most crypt implementations work. The 2nd argument to crypt is the hash you plan to compare it to. This hash is not just the output of the hashing function, it also usually includes the hashing algorithm used, and the salt.

If you check your /etc/shadow on a box running glibc right now you'll see that every password hash starts with something like $2b$ or $y$ which indicates which hashing function was used. Glibc for example supports around a dozen hashing algorithms, and the hash you give to crypt determines which algorithm gets used.

None of this is standardized. There's nothing mandaring that format, or that your libc supports certain hashing algorithms, or defaults to the right one, so there is no portable POSIX compliant way to do this other than just use a hash you found on the system.

1

u/KontoOficjalneMR 29d ago

Yes, and? How does any of this apply to what I said?

Either the hashing algo matters or not. If it matters - we use that one. If it doesn't - we use whichever we have available.

Nothing you wrote prevents us from using an arbitrary hashing algo if the shadow uses arbitrary hashing (and a random one is picked).

My solution would be as safe as picking a random hashed value, but without the issue that causes this bug.

1

u/SN4T14 29d ago

Either the hashing algo matters or not. If it matters - we use that one.

Yes but which one? You don't know, and there's no portable way to find out which it is or how you enable it.

Like I said, glibc will default to descrypt if it doesn't know. An ancient algorithm that's lightning fast compared to the algorithms that are used on today's systems. But to prevent timing attacks, the speed needs to be the same as it normally is on that system. So if you end up using descrypt instead of bcrypt or whatever is actually used on that system, you've failed to prevent the timing attack. The only way to prevent the timing attack is to use the same hashing algorithm as real passwords on the system use, and the only portable way to do that is to use a real password hash.

Just try it. Benchmark calls to crypt on your system with random inputs, and compare it to calls where you pass an actual password hash from /etc/shadow as the 2nd argument. You will see a time difference of several orders of magnitude, more than enough for a practical timing attack over the network.

0

u/KontoOficjalneMR 29d ago

Dude, stop explaining to me things I already know and at least try to understand what I wrote ok?

1

u/SN4T14 29d ago

How do you intend to determine which hashing algorithm to use in a portable manner? You said "if it matters we use that one", which one? The system you're running on consistently uses one most likely, but there is no portable way to determine which one that is!

Can you show me portable C code that I can run on my machine that guarantees it'll use the same hashing algo my system already uses for real accounts?

1

u/KontoOficjalneMR 29d ago

The same one that user's credentials are hashed with before comparing. It really is that simple.

→ More replies