Обсуждение: pgsql: Empty search_path in Autovacuum and non-psql/pgbench clients.

Поиск
Список
Период
Сортировка

pgsql: Empty search_path in Autovacuum and non-psql/pgbench clients.

От
Noah Misch
Дата:
Empty search_path in Autovacuum and non-psql/pgbench clients.

This makes the client programs behave as documented regardless of the
connect-time search_path and regardless of user-created objects.  Today,
a malicious user with CREATE permission on a search_path schema can take
control of certain of these clients' queries and invoke arbitrary SQL
functions under the client identity, often a superuser.  This is
exploitable in the default configuration, where all users have CREATE
privilege on schema "public".

This changes behavior of user-defined code stored in the database, like
pg_index.indexprs and pg_extension_config_dump().  If they reach code
bearing unqualified names, "does not exist" or "no schema has been
selected to create in" errors might appear.  Users may fix such errors
by schema-qualifying affected names.  After upgrading, consider watching
server logs for these errors.

The --table arguments of src/bin/scripts clients have been lax; for
example, "vacuumdb -Zt pg_am\;CHECKPOINT" performed a checkpoint.  That
now fails, but for now, "vacuumdb -Zt 'pg_am(amname);CHECKPOINT'" still
performs a checkpoint.

Back-patch to 9.3 (all supported versions).

Reviewed by Tom Lane, though this fix strategy was not his first choice.
Reported by Arseniy Sharoglazov.

Security: CVE-2018-1058

Branch
------
REL9_3_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/3db38b0ceffd95be81573c884f4be21f79ca954a

Modified Files
--------------
contrib/oid2name/oid2name.c           |  13 ++++
contrib/pg_upgrade/server.c           |   3 +
contrib/vacuumlo/vacuumlo.c           |   8 +-
src/backend/postmaster/autovacuum.c   |  14 ++++
src/bin/pg_dump/dumputils.c           |  16 ++--
src/bin/pg_dump/pg_backup_db.c        |  11 +++
src/bin/pg_dump/pg_dump.c             |  17 ++++-
src/bin/pg_dump/pg_dumpall.c          |   7 +-
src/bin/scripts/Makefile              |  23 +++---
src/bin/scripts/clusterdb.c           |  12 ++-
src/bin/scripts/common.c              | 137 +++++++++++++++++++++++++++++++---
src/bin/scripts/common.h              |  10 ++-
src/bin/scripts/createdb.c            |   2 +-
src/bin/scripts/createlang.c          |   4 +-
src/bin/scripts/createuser.c          |   2 +-
src/bin/scripts/dropdb.c              |   3 +-
src/bin/scripts/droplang.c            |  10 +--
src/bin/scripts/dropuser.c            |   2 +-
src/bin/scripts/reindexdb.c           |  19 ++---
src/bin/scripts/vacuumdb.c            |   9 ++-
src/include/Makefile                  |   3 +-
src/include/fe_utils/connect.h        |  28 +++++++
src/tools/findoidjoins/findoidjoins.c |   9 +++
23 files changed, 289 insertions(+), 73 deletions(-)