From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: Vladimir Soldatov <solardatov@gmail.com>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: SCRAM-SHA-256, is it possible to retrieve enough information from PG server (pg_authid etc) to perform authentication as a client
Date: Fri, 02 Aug 2019 23:04:54 +0100
Message-ID: <87pnlntfi3.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <CALn2wrc=OYF57=E-_HZJ_5kU_CicVrUghW=NnJnBETngR80DTw@mail.gmail.com>
References: <CALn2wrc=OYF57=E-_HZJ_5kU_CicVrUghW=NnJnBETngR80DTw@mail.gmail.com>
>>>>> "Vladimir" == Vladimir Soldatov <solardatov@gmail.com> writes:
Vladimir> Hi guys,
Vladimir> I am new to PostgreSQL, so sorry for maybe stupid question. I
Vladimir> am working on some application implementing Frontend/Backend
Vladimir> PG protocol and one of the goals - having only "admin" users
Vladimir> credentials (like postgres user) be able to retrieve enough
Vladimir> information from PG server (for example, from pg_authid
Vladimir> table) to perform authentication for any user created in PG
Vladimir> (without any user interaction, so we don't know the user's
Vladimir> password).
It's an explicit goal of SCRAM to make it impossible to use the server's
stored authentication data to actually authenticate from a client
(without first breaking the preimage resistance of the hash function).
Specifically, the authentication exchange proves to the server that the
client knows key_c, but the server only stores H(key_c); the server can
validate the client message just by applying the hash function, but the
correct value of key_c can't be determined in advance on the server
without a successful preimage attack on H(key_c).
The right way to allow a privileged user to operate as if they were
someone else is to use SET ROLE or SET SESSION AUTHORIZATION rather than
actually trying to log in as the other user.
--
Andrew (irc:RhodiumToad)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: andrew@tao11.riddles.org.uk, solardatov@gmail.com
Subject: Re: SCRAM-SHA-256, is it possible to retrieve enough information from PG server (pg_authid etc) to perform authentication as a client
In-Reply-To: <87pnlntfi3.fsf@news-spur.riddles.org.uk>
References: <CALn2wrc=OYF57=E-_HZJ_5kU_CicVrUghW=NnJnBETngR80DTw@mail.gmail.com> <87pnlntfi3.fsf@news-spur.riddles.org.uk>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox