pgsql: In security-restricted operations, block enqueue of at-commit us

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: In security-restricted operations, block enqueue of at-commit us
Date: 2020-11-09 15:35:42
Message-ID: E1kc9Co-0003NB-Nj@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

In security-restricted operations, block enqueue of at-commit user code.

Specifically, this blocks DECLARE ... WITH HOLD and firing of deferred
triggers within index expressions and materialized view queries. 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. One can work around the vulnerability by disabling
autovacuum and not manually running ANALYZE, CLUSTER, REINDEX, CREATE
INDEX, VACUUM FULL, or REFRESH MATERIALIZED VIEW. (Don't restore from
pg_dump, since it runs some of those commands.) Plain VACUUM (without
FULL) is safe, and all commands are fine when a trusted user owns the
target object. Performance may degrade quickly under this workaround,
however. Back-patch to 9.5 (all supported versions).

Reviewed by Robert Haas. Reported by Etienne Stalmans.

Security: CVE-2020-25695

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/0c3185e963d9f9dd0608214f7d732b84aa0888fe

Modified Files
--------------
contrib/postgres_fdw/connection.c | 4 +++
src/backend/access/transam/xact.c | 13 +++++-----
src/backend/commands/portalcmds.c | 5 ++++
src/backend/commands/trigger.c | 12 +++++++++
src/test/regress/expected/privileges.out | 42 ++++++++++++++++++++++++++++++++
src/test/regress/sql/privileges.sql | 34 ++++++++++++++++++++++++++
6 files changed, 104 insertions(+), 6 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Peter Geoghegan 2020-11-09 17:01:03 pgsql: Remove ineffective heapam CHECK_FOR_INTERRUPTS().
Previous Message Peter Eisentraut 2020-11-09 11:53:01 pgsql: Translation updates