Sample Header Ad - 728x90

Need a Role that can CREATE USER but not allowed to GRANT Predefined Roles in PostgreSQL <16

1 vote
3 answers
557 views
We are administrating DB in kubernetes to our customers. For each new cluster, we create a new user with CREATE ROLE and CREATE DB roles given to them, so that they can create their own databases and new users with stricter roles. The problem is, with CREATE ROLE permission, the user can GRANT himself pg_execute_server_program role, and then use reverse shell attack and then get shell from our pod and read the environment variables, which is not desired. E.g. we have several secrets in env vars that the customer can take advantage of and then increase their attack range and take over more things. In short, I want to have a user that can create new users, but can't grant himself specific predefined roles. Update: I looked and found that ADMIN_OPTION has been added in PostgreSQL 16 to resolve such issue. My problem is we're using PostgreSQL version 13,14,15 and we can't just force upgrade all clusters.
Asked by imans77 (111 rep)
Feb 4, 2024, 06:11 PM
Last activity: Feb 24, 2024, 06:44 PM