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 1pQPn0-0000xP-KJ for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Feb 2023 09:33:55 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pQPmz-0006gX-79 for pgsql-bugs@arkaria.postgresql.org; Fri, 10 Feb 2023 09:33:53 +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 1pQPmy-0006gN-R3 for pgsql-bugs@lists.postgresql.org; Fri, 10 Feb 2023 09:33:52 +0000 Received: from lahtoruutu.iki.fi ([185.185.170.37]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pQPmv-0004rP-Ij for pgsql-bugs@lists.postgresql.org; Fri, 10 Feb 2023 09:33:51 +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 lahtoruutu.iki.fi (Postfix) with ESMTPSA id 26A801B00138; Fri, 10 Feb 2023 11:33:45 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1676021625; 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=oRSpuF5b6LpML7veMwuLA+AgqyW51pkrtyR1QZgt2xU=; b=sY4gqOyhpxDkoPBq94ESyMjebgpBNep2oiZTnPOTufR2gN+Ro9vjrburlObCo0MOpAjY/M qqS4/rTIdwjwGba0MpRjXInzCUQzAQbNMEFeyedvFGD5+vLNUsaGd8+MVjfivV+LKfmZ3V VPiSexvgDHX+tnsORO9R03pSHvlO3gDxABmYUww8CzZndHksDRJuDRHTy2wSIkwxufrutW 5v53DN5ik4Reh0JszJUP9wUdQ0W9TOVWnSvhzgJ3TZ0SZvS8aX5bQkOZgQpYwccN1DsAsF F4pK+I3lGR9giqJdHbnaK/UUXCsOC5zj4zd+fP9XW8W3W3u1q/CMIF+thuDdqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1676021625; 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=oRSpuF5b6LpML7veMwuLA+AgqyW51pkrtyR1QZgt2xU=; b=BPu03otNFfhZ2bX2y4i1kY5VuPhaaLApU2oOrPNFksxAAf+H6j1vGC6D1LvVVlsD/RgadS RTOiKvaxXvs88YxVPuaNZI8IvUxs1Vi7sgjWW7GBKSqizMWu3dJxQKPFNJwdcb2o3T0d8X OOY3kQ7ZYa1jzj2BnDepvqkfTtBhncys2L0vg68wuzN4ws7zwG8jMxcJoo6+MA8oE9JdnX isImWBYhN/oIxkFp0fr5OglsWBnneUIdwonkTKNX1HE11UhylZnn1J5A5eeZvrgaQjKkuI GpW/c8BrZtS+8fxI4FK9q/2k/XlW9z5+/pnXjkvpqwRlSrSCuhmtZI32eTXfTg== ARC-Seal: i=1; s=lahtoruutu; d=iki.fi; t=1676021625; a=rsa-sha256; cv=none; b=Ogu9bU3UdPcxHsmXEqE/y0QD42W+bhKrZ8Xp1jG7pbag1jh9NjGZs6JwNqsby2ZHTHljgI ixTjw+2krZ5ocAjhO0ojkG7l7dUkIQmEUHuc/9YfoJmA99W0W9nBB3hQVu5iWASrjlf7CB 4rS/pluPvoV3CfUV4WfBYgTJ3C39o31L7jY0EuvfANNvc+UB26vWkqvk6wMHltRXKF2jDC 1mZyuJYTvfDhOd0gEs8Qhg7tQtTKmvskAaHu2Em3L2dl4deI+uNxrC68e/STfrGIaBD86K fK1Cs17/46NkQTPQlkWoVlCBCQrNWPDADiOwYWqmMXcAQDoMR1j/HwtuT4WAUw== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi Message-ID: <687f8e73-e511-6994-c2e2-3cc55633fab6@iki.fi> Date: Fri, 10 Feb 2023 11:33:44 +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: Jacob Champion , gunnar.bluth@pro-open.de, pgsql-bugs@lists.postgresql.org References: <17760-b6c61e752ec07060@postgresql.org> <584842ed-e476-6bac-bb36-2aec204e9eef@iki.fi> <07e810b5-ea15-87ac-1745-e765e426062e@iki.fi> <9f193dd6-e1c5-fb20-ea90-0e6d03760be8@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 On 10/02/2023 08:32, Michael Paquier wrote: > On Fri, Feb 10, 2023 at 02:24:12AM +0200, Heikki Linnakangas wrote: >>>> How will this evolve when SCRAM-SHA-512 is implemented? Do you >>>> plan to upgrade the undef-hash in that case to SHA-512? >> >> Yes, that's what I had in mind. Or for SCRAM-SHA-512, we could go >> further and define it as "always use SHA-512", because we wouldn't >> need to worry about backwards compatibility anymore. > > Hmm. There is a risk of breakage here with older versions of libpq > because we'd still need to support both 256 and 512, no? Or do you > mean to drop SCRAM-SHA-256 and do a drop-in replacement with > SCRAM-SHA-512? Doing that in the server may be fine, not in libpq. > As long as you control that with the channel binding name, there > should be enough control I guess. We would still support for SCRAM-SHA-256-PLUS in client and server. But *if* the server supports and advertises SCRAM-SHA-512-PLUS as a supported mechanism, and the client supports and selects it, then with SCRAM-SHA-512-PLUS, we could always use SHA-512 as the hash algorithm for the channel binding. Yeah, a MITM could force a downgrade from SCRAM-SHA-512 to SCRAM-SHA-256, by modifying the list of supported SASL mechanisms that the server sends. Then again, usually the server would not advertise both SCRAM-SHA-256 and SCRAM-SHA-512, because pg_role contains only one password verifier. Unless we change that too. I don't have a solution for these issues right now, but they are not related to channel binding. The point is that if we add a new SASL mechanism, like SCRAM-SHA-512-PLUS, we are free to define how to calculate the certificate hash with that mechanism however we want, without breaking backwards compatibility. > So, using a new channel binding name with > tls-server-end-point-sha-256 is actually the way to violate the RFC, > while tls-server-end-point still tries to stick with it? Correct. > I am not sure if there's much benefit in a second channel binding, > enforcing SHA-256 for undefined signatures could just be better, and > simpler. :) The benefit is that it's more explicit, which helps to reduce the confusion. As new signature algorithms are invented in the future, who knows what OBJ_find_sigid_algs() in different versions of OpenSSL, or other TLS libraries, will do with them. With a new "tls-server-end-point-sha-256" channel binding type, it's clear. > There be a risk of a downgrade attack here, where the client could > feign the server to do a SHA-256 computation where SHA-512 or higher > should be used. Or, if the server certificate has a hash function > but the client feigns in not knowing that, do you mean to go through > a mock authentication in this case and fail? Let's always allow tls-server-end-point-sha-256 in the server. The point of channel binding is to protect the client from a MITM. The client chooses the channel binding type to use, so a MITM cannot force it to downgrade. To be honest, I am not at all worried about losing security by using SHA-256 instead of SHA-512 or whatever else is in the certificate. If you don't trust SHA-256, you wouldn't be comfortable using SCRAM-SHA-256 at all. "tls-server-end-point-sha-256" is simpler than the current rules, so new client implementations that are not worried about backwards-compatibility might not bother with the current rules at all, and only implement "tls-server-end-point-sha-256". - Heikki