Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fQvgs-0004IO-Jz for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Jun 2018 14:15:02 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fQvgr-0001Ux-2i for pgsql-bugs@arkaria.postgresql.org; Thu, 07 Jun 2018 14:15:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fQvgq-0001Un-PH for pgsql-bugs@lists.postgresql.org; Thu, 07 Jun 2018 14:15:00 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fQvgn-0004Ep-T1 for pgsql-bugs@postgresql.org; Thu, 07 Jun 2018 14:14:59 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id w57EEsFl018835; Thu, 7 Jun 2018 10:14:54 -0400 From: Tom Lane To: Eyedia Tech cc: pgsql-bugs@postgresql.org Subject: Re: chkpass Major Issue - compares 'contains' and not 'equal' In-reply-to: References: Comments: In-reply-to Eyedia Tech message dated "Thu, 07 Jun 2018 08:41:44 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <18833.1528380894.1@sss.pgh.pa.us> Date: Thu, 07 Jun 2018 10:14:54 -0400 Message-ID: <18834.1528380894@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Eyedia Tech writes: > To replicate use this: > create table "user" (uname text, password chkpass); > insert into "user" values ('user1', 'password') > select * from "user" where uname = 'user1' and password = 'password1' That would depend on the behavior of your local version of crypt(3), but historically, that library function uses only the first eight characters of the password, which explains this example. > This is a major issue. We're not going to treat it as such. It's clearly documented, see https://www.postgresql.org/docs/current/static/chkpass.html FWIW, chkpass is deprecated and has been removed entirely as of PG 11. It has a lot of design problems above and beyond its reliance on a 40-year-old encryption spec. regards, tom lane