SV-233593r617333_rule
V-233593
SRG-APP-000141-DB-000093
CD12-00-009100
CAT II
10
To remove superuser from a role, as the database administrator (shown here as "postgres"), run the following SQL:
$ sudo su - postgres
$ psql -c "ALTER ROLE <role-name> WITH NOSUPERUSER"
To remove extensions from PostgreSQL, as the database administrator (shown here as "postgres"), run the following SQL:
$ sudo su - postgres
$ psql -c "DROP EXTENSION extension_name"
PostgreSQL's Copy command can interact with the underlying OS. Only superuser has access to this command.
First, as the database administrator (shown here as "postgres"), run the following SQL to list all roles and their privileges:
$ sudo su - postgres
$ psql -x -c "\du"
If any role has "superuser" that should not, this is a finding.
It is possible for an extension to contain code that could access external executables via SQL. To list all installed extensions, as the database administrator (shown here as "postgres"), run the following SQL:
$ sudo su - postgres
$ psql -x -c "SELECT * FROM pg_available_extensions WHERE installed_version IS NOT NULL"
If any extensions are installed that are not approved, this is a finding.
V-233593
False
CD12-00-009100
PostgreSQL's Copy command can interact with the underlying OS. Only superuser has access to this command.
First, as the database administrator (shown here as "postgres"), run the following SQL to list all roles and their privileges:
$ sudo su - postgres
$ psql -x -c "\du"
If any role has "superuser" that should not, this is a finding.
It is possible for an extension to contain code that could access external executables via SQL. To list all installed extensions, as the database administrator (shown here as "postgres"), run the following SQL:
$ sudo su - postgres
$ psql -x -c "SELECT * FROM pg_available_extensions WHERE installed_version IS NOT NULL"
If any extensions are installed that are not approved, this is a finding.
M
5254