]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Make relation-enumerating operations be security-restricted operations.
authorNoah Misch <noah@leadboat.com>
Mon, 9 May 2022 15:35:08 +0000 (08:35 -0700)
committerNoah Misch <noah@leadboat.com>
Mon, 9 May 2022 15:35:13 +0000 (08:35 -0700)
commit48ca2904c11d4293ec0bed1625259b2e4ef550cc
treecd61dbf33bcf9e5f69970f6242a86649fd840a94
parentd8ab73f3ba92b633954870d862234ca20b64753b
Make relation-enumerating operations be security-restricted operations.

When a feature enumerates relations and runs functions associated with
all found relations, the feature's user shall not need to trust every
user having permission to create objects.  BRIN-specific functionality
in autovacuum neglected to account for this, as did pg_amcheck and
CLUSTER.  An attacker having permission to create non-temp objects in at
least one schema could execute arbitrary SQL functions under the
identity of the bootstrap superuser.  CREATE INDEX (not a
relation-enumerating operation) and REINDEX protected themselves too
late.  This change extends to the non-enumerating amcheck interface.
Back-patch to v10 (all supported versions).

Sergey Shinderuk, reviewed (in earlier versions) by Alexander Lakhin.
Reported by Alexander Lakhin.

Security: CVE-2022-1552
contrib/amcheck/expected/check_btree.out
contrib/amcheck/sql/check_btree.sql
contrib/amcheck/verify_nbtree.c
src/backend/access/brin/brin.c
src/backend/catalog/index.c
src/backend/commands/cluster.c
src/backend/commands/indexcmds.c
src/backend/utils/init/miscinit.c
src/test/regress/expected/privileges.out
src/test/regress/sql/privileges.sql