
Trivial authentication bypass in libssh leaves servers wide open - okket
https://arstechnica.com/information-technology/2018/10/bug-in-libssh-makes-it-amazingly-easy-for-hackers-to-gain-root-access/
======
kevin_b_er
From the reading, the "hack" is pretty embarrassing. The server->client
message that announces you're authenticated is instead sent client->server and
the server just sets its mode to that. Abracadabra, you're logged in!

~~~
bigiain
Suspicious-me wonders who wrote/committed that code... Is it a "plausibly
deniable mistake"?

~~~
wepple
I guess you could say that about absolutely any bug though? This isn’t
particularly underhanded, and it’s more of a broad design flaw than a subtle
change. If you wanted a “backdoor” you could absolutely do 10x better than
this.

~~~
lozenge
How could you do 10x better? Because it's a broad design flaw there is no
suspicious LOC or suspiciously overcomplicated code needed to hide the
backdoor. You have to understand the whole context to notice the bug.

~~~
wepple
But it’s still there in plain sight. I’d hazard a guess that this may be the
first time a solid code reviewer looked at the code, and spotted it straight
away*

If you wanted 10x better, you could throw in some code that exhibits undefined
(but known on major compilers) behavior, or super subtle C issues. Even a
simple if statement in C forces all kinds of wonderful promotions and type
conversions which can truncate, wrap, and drastically change values in ways
that even most C developers aren’t aware.

I encourage folks to go check out the “underhanded C contest” before
suggesting that this bug is a backdoor.

*The person who found this, Peter, is indeed insanely good.

------
Sir_Cmpwn
Note that libssh != openssh, which is what's probably running on your server.

~~~
stephenr
I tried to find what it is used in. The site claims that it's used server-side
by GitHub: [https://www.libssh.org/#text-5](https://www.libssh.org/#text-5)

~~~
throwaway2048

        $ apt-cache rdepends libssh-4
        libssh-4
        Reverse Depends:
          libpam-x2go
          yafc
          x2goclient
          tmate
          remmina-plugin-nx
          remmina
          openvas-nasl
          libopenvas9
          libssh-dev
          cockpit-bridge
          kio-extras
          hydra
    

This is all of the packages that depend on libssh in Debian Testing, doesn't
seem to be very problematic, I've only heard of one thing on this list, and
that doesn't use the server code anyways.

~~~
tyingq
Tmate might have issues...there's both client and server code.

------
jzwinck
_" GitHub isn’t vulnerable [...] my guess is you’ll be left with a small
handful of random sftp servers or IoT devices and little else!”_

That sounds reassuring. It's not as if hacking some random IoT device is going
to win the jackpot.

Oh wait, it totally can:
[https://www.washingtonpost.com/news/innovations/wp/2017/07/2...](https://www.washingtonpost.com/news/innovations/wp/2017/07/21/how-
a-fish-tank-helped-hack-a-casino/)

~~~
ploxiln
Most embedded devices which have ssh server functionality use Dropbear. You'll
have to look really hard to find anything which uses this "libssh" server
functionality (which, again, is _not openssh_).

------
makomk
Apparently there was an almost identical vulnerability in the Python SSH
library Paramiko too:
[https://github.com/paramiko/paramiko/issues/1283](https://github.com/paramiko/paramiko/issues/1283)

------
Nr7
Earlier discussion:
[https://news.ycombinator.com/item?id=18236372](https://news.ycombinator.com/item?id=18236372)
[https://news.ycombinator.com/item?id=18230610](https://news.ycombinator.com/item?id=18230610)

------
writepub
Is this a code error or a protocol error? If a protocol relies on a message
from the client side to allow access, it's a protocol error!

It's unlikely that ssh - a protocol that powers large swaths of software, has
such an error, but always good to hear from the experts that this is indeed a
coding error.

~~~
dbt00
It's an incorrect implementation of the protocol, yes. That message should
only be sent from the server to the client, and the server should not take any
action (besides dropping the connection) when it's received.

------
OliverJones
Move along. This isn't the exploit you're looking for.

(Unless your server uses the relatively uncommon libssh on your server. If you
use openssl you're not vulnerable. Github's not vulnerable either.)

------
stephen82
What a strange coincidence :/

First we had the YouTube outage and a bit later, this issue appeared...

------
anon49124
I never heard of this library before. Most projects seem to use libssh2.
[https://github.com/libssh2/libssh2](https://github.com/libssh2/libssh2)

~~~
netheril96
Well, if there is libssh2, most likely there is libssh.

~~~
justincormack
They are unrelated. I think libssh2 is named that as it implements the v2 ssh
protocol.

