Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQTzD-0006as-Ky for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Feb 2023 14:02:48 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQTzA-0000MS-I4 for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Feb 2023 14:02:44 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQTzA-0000MJ-5R for pgsql-bugs@lists.postgresql.org; Fri, 10 Feb 2023 14:02:44 +0000 Received: from meesny.iki.fi ([2001:67c:2b0:1c1::201]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQTz5-0007BU-Co for pgsql-bugs@lists.postgresql.org; Fri, 10 Feb 2023 14:02:42 +0000 Received: from [192.168.1.113] (dsl-hkibng22-54f8db-125.dhcp.inet.fi [84.248.219.125]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by meesny.iki.fi (Postfix) with ESMTPSA id 6A9022006A; Fri, 10 Feb 2023 16:02:32 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1676037752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CBILq5y06vLX1dT2hSdHSAy9JFUQc/HsFycarDKEyZw=; b=s0qJnfkLZ3C6vUy90Gh/6k9nolWYjphB1zKjGDDf54KzKI3lbQvE46nBGfn87xK0EM3uRB kJI88o0YpL4lkeIsmmgR3pAiSyXFRimw8iNOeE5UVrK2mf6zp1rUIA9JEr/RGNzENwuv18 3wcyNPbWvny/JmXi/1+ry8FXCBTQfcs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1676037752; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=CBILq5y06vLX1dT2hSdHSAy9JFUQc/HsFycarDKEyZw=; b=cZIbe+N2SQu+/Ll359IJ6zJ6s4tJSN1EeKWsAixujucPhIjO5yS6nM3qPBgJcRUF0d593V QgIJ/lttIwIq4NiKwc3aglNLhD7jWXufNRHzGjhFSZAlIYhQN8bH0Ql8cL/Tks+q/tTecX Db3xvNWqps140I63Pw0Mm4DyIlICfe0= ARC-Seal: i=1; s=meesny; d=iki.fi; t=1676037752; a=rsa-sha256; cv=none; b=fwKa6Q7eBsy3+jSN5Nl33LjaReJ7/Cu7cSqHACf7W9Hjsh0o+k6XX0VoO09pAxire47HrE qkIJCK8yZ9a276HGXXZqsZqZgmHflYaBJaMcPLLjR2nLw77DVR7kGdn9gKVCv4zHa0BG8Z 8+mTFtLH6HYwZFp3YAUKBUN8mP9vvTk= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: Date: Fri, 10 Feb 2023 16:02:31 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: BUG #17760: SCRAM authentication fails with "modern" (rsassaPss signature) server certificate Content-Language: en-US To: Michael Paquier Cc: gunnar.bluth@pro-open.de, pgsql-bugs@lists.postgresql.org, Jacob Champion References: <17760-b6c61e752ec07060@postgresql.org> <584842ed-e476-6bac-bb36-2aec204e9eef@iki.fi> From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk 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