Big welcome to Hyperscale (Citus) on Azure Database for PostgreSQL, now in Preview. Learn more.
A few days ago a CVE was announced for Postgres. To say this CVE is a bit overblown is an understatement. The first thing to know is you’re likely completely safe. If you run on a managed service provider you are not going to be affected by this, and if you’re managing your own Postgres database all chances are you are equally as safe. This CVE received a note from Tom Lane on the pgsql-announce mailing list in response to it getting a broad amount of awareness and attention.
But, we thought this might be a good time to talk about a few principles and concepts that underly how Postgres works.
For quick context the CVE states that the
copy program within Postgres when run as super user will allow arbitrary code execution. The
copy program within Postgres is a great tool for bulk loading of data. The utility essentially loads data to/from disk.
Shifting to the Postgres super user… Postgres is an extremely powerful database, well really it is more of a data platform. As super user you can perform all types of powerful operations. Those can include things that touch the underlying system itself, or enabling extensions which allow for low level system access. These types of operations should always be treated with care an caution.
In Tom’s email to the mailing list he states:
We encourage all users of PostgreSQL to follow the best practice that is to never grant superuser access to remote or otherwise untrusted users. This is a standard security operating procedure that is followed in system administration and extends to database administration as well.
If you’re handing out superuser access to your database or connecting to your application with a superuser role, consider changing that immediately.
Superuser essentially has the full power of the system user it is running as. Postgres does not allow running itself as the root user for this very reason. We actually commonly receive the request to grant super user access for customers running on Citus Cloud. Despite it being commonly requested it is not something we support due to the security risks and implications that come with it. Instead we grant you a user with an explicit set of powerful permissions to accomplish what you need but not more. This is standard across most managed service providers as a practice to keep you safe.