Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 31 Mar 2024 23:09:08 +0200
From: Solar Designer <solar@...nwall.com>
To: oss-security@...ts.openwall.com
Subject: Re: backdoor in upstream xz/liblzma leading to ssh server compromise

On Sat, Mar 30, 2024 at 03:01:31PM -0700, Andres Freund wrote:
> On 2024-03-30 22:46:17 +0100, Axel Beckert wrote:
> > On Sat, Mar 30, 2024 at 12:48:50PM -0700, Andres Freund wrote:
> > > FWIW, RSA_public_decrypt is reachable, regardless of server configuration,
> > > when using certificate based authentication.
> >              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > 
> > Wait, do you really mean SSH keys verified by certificates issued by a
> > (usually internal, SSH-specific) certificate authority (CA) for a key?
> > 
> > See e.g.
> > https://en.wikibooks.org/wiki/OpenSSH/Cookbook/Certificate-based_Authentication
> > what certificate-based authentication in SSH actually means.
> > 
> > From my experience certificate-based SSH authentication (i.e. those
> > algorithms with *-cert-* in their names) is rather rare, while simple
> > public key authentication (where you just put your according pubkey
> > into .ssh/authorized_keys) is very common.
> > 
> > Can you clarify if you really meant that solely certificate based
> > authentication (with certificates issued by a CA) triggers that code
> > path or if you actually meant all sorts of public key based
> > authentication in general?
> 
> I meant CA based auth - but note that, from what I can tell, you don't need to
> have it set up on the server side or anything. You might not even be able to
> disable it. If the client sends a signed key, the signature is loaded and
> verified before approved algorithms are checked.
> 
> This seems suboptimal regardless of the backdoor issue, so I opened an
> enhancement request for openssh: https://bugzilla.mindrot.org/show_bug.cgi?id=3675
> 
> I might be misreading the code around some of the details, but I did
> experimentally verify that an rsa signature is verified without CA auth being
> configured.

keeganryan on GitHub has posted a Python class that may help experiment
with the above, and with passing commands to the backdoor (but of course
we don't currently have the private key to sign them with):

https://gist.github.com/keeganryan/a6c22e1045e67c17e88a606dfdf95ae4

class ModifiedRSAClient:
    """ Connect to a SSH host using a modified RSA public key and signature.

    During public key authentication, an SSH client sends its public key to the SSH host.
    If this public key is a certificate, the signature of the certificate is verified by
    OpenSSH. This class allows for modification of the public key and signature in the
    certificate parsed by OpenSSH.
    """

Also attached in here (the first and only revision of the gist so far).

Alexander

View attachment "modify_ssh_rsa_pubkey.py" of type "text/plain" (4181 bytes)

Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.