Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YU2AD-0000LG-AX for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Mar 2015 00:00:17 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YU2AC-0007X7-IC for pgsql-hackers@arkaria.postgresql.org; Sat, 07 Mar 2015 00:00:16 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YU2AB-0007Vx-5r for pgsql-hackers@postgreSQL.org; Sat, 07 Mar 2015 00:00:15 +0000 Received: from tamriel.snowman.net ([2001:4830:167b::11]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YU2A7-0006vp-Aj for pgsql-hackers@postgreSQL.org; Sat, 07 Mar 2015 00:00:14 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id 855415F7A1; Fri, 6 Mar 2015 19:00:10 -0500 (EST) Date: Fri, 6 Mar 2015 19:00:10 -0500 From: Stephen Frost To: Bruce Momjian Cc: Josh Berkus , PostgreSQL-development Subject: Re: MD5 authentication needs help Message-ID: <20150307000010.GA29780@tamriel.snowman.net> References: <20150304020146.GD24063@momjian.us> <54F7B7C9.1090705@agliodbs.com> <20150305021928.GE24491@momjian.us> <20150305161555.GV29780@tamriel.snowman.net> <20150306230442.GB12967@momjian.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="+QCxTbf+V5JaCsx1" Content-Disposition: inline In-Reply-To: <20150306230442.GB12967@momjian.us> X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/3.13.0-45-generic (x86_64) X-Uptime: 18:10:53 up 43 days, 22:59, 15 users, load average: 0.15, 0.26, 0.25 User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org --+QCxTbf+V5JaCsx1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Bruce Momjian (bruce@momjian.us) wrote: > On Thu, Mar 5, 2015 at 11:15:55AM -0500, Stephen Frost wrote: > > * Bruce Momjian (bruce@momjian.us) wrote: > > > On Wed, Mar 4, 2015 at 05:56:25PM -0800, Josh Berkus wrote: > > > > So, are we more worried about attackers getting a copy of pg_authid= , or > > > > sniffing the hash on the wire? > > >=20 > > > Both. Stephen is more worried about pg_authid, but I am more worried > > > about sniffing. > >=20 > > I'm also worried about both, but if the admin is worried about sniffing > > in their environment, they're much more likely to use TLS than to set up > > client side certificates, kerberos, or some other strong auth mechanism, > > simply because TLS is pretty darn easy to get working and distros set it > > up for you by default. >=20 > I think your view might be skewed. I think there many people who care > about password security who don't care to do TLS. I'm not quite sure that I follow what you mean about caring for "password security". I'll try to clarify by suggesting a few things that I think you might mean and will respond to them. Please clarify if I've completely missed what you're getting at here. If the concern is database access due to an attacker who can sniff the network data then the approach which I suggested would make things materially worse for users who do not employ TLS. Once the attacker has sniffed the network for a little while, they'll have one and likely more challenge/responses which they could use to attempt to log in with. As discussed, our existing challenge/response system is vulnerable to network sniffing based replay attacks also. If the concern is database access due to an attacker who can see the on-disk data, then the current situation makes it trivial for the attacker to log in, while the approach I've suggested would require the attacker to reverse hash(salt+auth_token) (where auth_token here is taken to represent what we currently store on disk; even with my suggestion, the attacker would not need to reverse the hash(username+password) to gain database access). If the concern is about getting at the cleartext password, then I don't believe things are materially worse with either approach assuming a network-based sniff attack. Both require that the attacker reverse hash(salt+hash(username+password)) where the salt and password are not known. If the concern is about getting the cleartext password as it resides on disk or in backups, we are not in a good position today. While the password is hash'd, the "salt" used is the username which the attacker may know ahead of the compromise. The approach I am suggesting improves that situation because it would bring it up to the same level of difficulty as that of the network-based sniff attack: the attacker would have to reverse hash(salt+hash(username+password)). > Also, my suggestion to use a counter for the session salt, to reduce > replay from 16k to 4 billion, has not received any comments, and it does > not break the wire protocol. I feel that is an incremental improvement > we should consider. You are correct, that would improve the existing protocol regarding database-access risk due to network-based sniffing attacks. Unfortunately, it would not improve cleartext or database access risk due to disk-based attacks. > I think you are minimizing the downsize of your idea using X challenges > instead of 16k challenges to get in. Again, if my idea is valid, it > would be X challenges vs 4 billion challenges. The reason I have not been as excited by this approach is that we already have a solution for network-based sniffing attacks. As Josh mentioned, there are users out there who even go to extraordinary lengths to thwart network-based sniffing attacks by using stunnel with pg_bouncer. On the flip side, while there are ways to protect backups through encryption, many other vectors exist for disk-based attacks which result in either database access or finding the cleartext password with much less difficulty. Further, this only improves the authentication handling and doesn't improve our risk to other network-based attacks, including connection hijacking, sniffing during password set/reset, data compromise as it's sent across the wire, etc. Encouraging use of TLS addresses all of those risks. I don't recall any complaints about these other network-based attacks and I do believe that's because TLS is available. Combined with the approach I've suggested, we would reduce the risk of disk-based attacks to the extent we're able to without breaking the protocol. For my part, doing this, or going with my suggestion, or doing nothing with md5, really doesn't move us forward very much, which frustrates me greatly. I brought this suggestion to this list because it was suggested to me as one change we could make that would reduce the risk of disk-based attacks while trading that off for a higher risk on the side of network-based attacks while not breaking the existing network protocol. To make it very clear- it is not a solution but rather a poor bandaid. What we really need is a new password based protocol which is based on a future-proof, well designed protocol, such as SCRAM. Thanks, Stephen --+QCxTbf+V5JaCsx1 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJU+j+KAAoJEO1sijiDR2RVOpoQALuVeKGrA6Kj9oeY8OIBqTu2 cCtABRfs568cota1/GiTB1m72uKxK3ACgvGhEFXmHTXtfdXgt9IuCcYDfq5nVQLQ jwhMz9JIdmWfZPioWt2wA9zsxxNfZxb6SvsBndGGjdaWVSFLCBAgK9m/2otDY0NI 269hU5eC0/bwPNg/alN8lNDUJ6DClbNI2HYsoDF3xRCRmqD59m7Zr7Czxy4gbt4I 2I9aiNNjcEzqLrP6lOsR02YnU5ERyKDORAMJ6QhP7uXGXljxbJ9mHoDBCfCr49tw f13cK1f7M6z3qAGNiJMq+wllIOlIf2HtAl1K0ThcqOKhEHCTtXVzPuL6WMlNQzAS lo4GpCvS04Kam38jkWLZnXGuoc/92FfrRxUZGmK8sGbS6PeeYzCDIz2DHjYzQYfB 5QJrL1uk1BvGQqAguLVcpN7i2DsAfPGKBvUvsChbS4tLBrikaqPE4vPV4cW8cehP guNM/0mtz/gzyg9thD5Y7Zjg6ssk9l7f8vh6G2HtX0rnxkOOdSlPmzXyr8K480N7 hSQl0mia7c99ZIUuDbzWfJIcPzp+IMy+/CSNjEeR5T0TITjri4V5Q5OXs5NscBS5 aKn9kbzDNQNoLB/wHc8Qqfl6SxIHwG7lqp48bfrTld/XTGQ3swY7YHMF7Ep29Sdd 6ueDeWREOxV4uGTDnJEu =w1zl -----END PGP SIGNATURE----- --+QCxTbf+V5JaCsx1--