Re: BUG #17760: SCRAM authentication fails with "modern" (rsassaPss signature) server certificate

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: gunnar(dot)bluth(at)pro-open(dot)de, pgsql-bugs(at)lists(dot)postgresql(dot)org, Jacob Champion <jchampion(at)timescale(dot)com>
Subject: Re: BUG #17760: SCRAM authentication fails with "modern" (rsassaPss signature) server certificate
Date: 2023-02-10 14:02:31
Message-ID: fb3ac2d0-d6ce-67ff-8a4d-1993f148d9b9@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

The new "tls-server-end-point-sha-256" channel binding type now seems
like the best approach to me, but I still wanted to reply to this:

On 09/02/2023 10:24, Michael Paquier wrote:
> But the client has the choice to decide if it wants to use channel
> binding, does it? In this case, it would send the non-PLUS mechanism
> followed by 'n' as gs2-cbind-flag, no?

No, that makes a downgrade attack possible with channel_binding=prefer.
Imagine that you have a server with a typical RSA certificate that
supports channel binding. And a client with channel_binding=prefer.
There is a Man-In-The-Middle between the client and the server. The MITM
works as a proxy, and opens two separate TLS connections: server <->
MITM and MITM <-> client. To the client, it presents a TLS server
certificate that uses 'rsassaPss'. The client connects to the MITM, sees
the rsassaPss certificate, and decides that it cannot do channel binding
because the server doesn't support it. It sends 'n' gs2-cbind-flag, and
the server happily accepts that.

Currently, such a downgrade attack is not possible. If client and server
both support channel binding, it will be used. If a MITM tries to modify
the SASL mechanism list, leaving out SCRAM-SHA-256-PLUS, the client will
use gs2-cbind-flag='y' which notifies the server that the mechanism list
was modified, and the server will fail the authentication. And if the
MITM doesn't change the negotiation, then channel binding will be used,
and the authentication will fail because the client and server will
compute a different server certificate hash.

There is no way for the client to tell the server "I support channel
binding in general, but not with this server certificate".

- Heikki

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message hubert depesz lubaczewski 2023-02-10 14:31:24 Re: WAL segments removed from primary despite the fact that logical replication slot needs it.
Previous Message PG Bug reporting form 2023-02-10 12:56:28 BUG #17786: Assert on indxpath.c