pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bryn Llewellyn <bryn@yugabyte.com>
To: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: Jeremy Smith <jeremy@musicsmith.net>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: What happened to the tip "It is good practice to create a role that has the CREATEDB and CREATEROLE privileges..."
Date: Wed, 19 Apr 2023 20:10:48 -0700
Message-ID: <377FAE64-9D3A-4DFB-99C0-C9A1F245EF2F@yugabyte.com> (raw)
In-Reply-To: <a3e31c8f-4f38-f5d7-777a-4bbd99672426@aklaver.com>
References: <DEFDC682-5BE8-4406-843A-E294C917D6BC@yugabyte.com>
	<CAM8SmLWK62C+jvA-Lg=ba9hsz6XXRN-cR6QHM_CWEbV5QCft-g@mail.gmail.com>
	<67321D1A-9C90-42A5-A0D8-4A1C37EA4568@yugabyte.com>
	<a3e31c8f-4f38-f5d7-777a-4bbd99672426@aklaver.com>

> adrian.klaver@aklaver.com wrote:
> 
>> bryn@yugabyte.com wrote:
>> 
>> Here's the examples that I mentioned. Please confirm that the changes brought by the commit referred to above won't change how it behaves in Version 15.2.
> 
> The commit was over only documentation files
> 
> doc/src/sgml/ref/alter_role.sgml 		
> doc/src/sgml/ref/create_role.sgml 		
> doc/src/sgml/ref/createuser.sgml 		
> doc/src/sgml/user-manag.sgml
> 
> so I don't see how it can change behavior.

The account of the commit that Jeremy Smith referred to, here:

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=1c77873727dfd2e48ab2ece84d1fb1676...

had a reference to an email thread on the pgsql-hackers with subject "fixing CREATEROLE". It was started by Robert Haas and it begins thus:

> https://www.postgresql.org/message-id/CA%2BTgmobGds7oefDjZUY%2Bk_J7p1sS%3DpTq3sZ060qdb%3DoKei1Dkw%40...
> 
> The CREATEROLE permission is in a very bad spot right now. The biggest problem that I know about is that it allows you to trivially access the OS user account under which PostgreSQL is running, which is expected behavior for a superuser but simply wrong behavior for any other user. This is because CREATEROLE conveys powerful capabilities not only to create roles but also to manipulate them in various ways, including granting any non-superuser role in the system to any new or existing user, including themselves.


The thread goes on forever. And it branches too. It's talking about possibly patching the code—precisely to bring about a change in behavior. And I'm asking if the fix(es) under discussion would change the behavior of the code that I showed.

The upshot of it all seems to be that the putative benefit of using a role the has only "createrole" and not "super" is marginal because such a role can grant itself shipped dangerous roles like "pg_execute_server_program" and "pg_write_server_files"
which are trivially exploitable.







view thread (8+ messages)  latest in thread

Message-ID: <377FAE64-9D3A-4DFB-99C0-C9A1F245EF2F@yugabyte.com>
Permalink:  ../377FAE64-9D3A-4DFB-99C0-C9A1F245EF2F@yugabyte.com/
Also on:    postgresql.org/message-id/377FAE64-9D3A-4DFB-99C0-C9A1F245EF2F@yugabyte.com

 · 

reply

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: bryn@yugabyte.com, adrian.klaver@aklaver.com, jeremy@musicsmith.net
  Subject: Re: What happened to the tip "It is good practice to create a role that has the CREATEDB and CREATEROLE privileges..."
  In-Reply-To: <377FAE64-9D3A-4DFB-99C0-C9A1F245EF2F@yugabyte.com>
  References: <DEFDC682-5BE8-4406-843A-E294C917D6BC@yugabyte.com> <CAM8SmLWK62C+jvA-Lg=ba9hsz6XXRN-cR6QHM_CWEbV5QCft-g@mail.gmail.com> <67321D1A-9C90-42A5-A0D8-4A1C37EA4568@yugabyte.com> <a3e31c8f-4f38-f5d7-777a-4bbd99672426@aklaver.com> <377FAE64-9D3A-4DFB-99C0-C9A1F245EF2F@yugabyte.com>

* 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