git.postgresql.org Git - postgresql.git/commit

git projects / postgresql.git / commit
? search:
summary | shortlog | log | commit | commitdiff | tree
(parent: 9b92f11) | patch
Restrict psql meta-commands in plain-text dumps.
2025年8月11日 14:00:00 +0000 (09:00 -0500)
2025年8月11日 14:00:00 +0000 (09:00 -0500)
commit 575f54d4cee8b141a91b3e5c3d7d65372c0f5219
Restrict psql meta-commands in plain-text dumps.

A malicious server could inject psql meta-commands into plain-text
dump output (i.e., scripts created with pg_dump --format=plain,
pg_dumpall, or pg_restore --file) that are run at restore time on
the machine running psql. To fix, introduce a new "restricted"
mode in psql that blocks all meta-commands (except for \unrestrict
to exit the mode), and teach pg_dump, pg_dumpall, and pg_restore to
use this mode in plain-text dumps.

While at it, encourage users to only restore dumps generated from
trusted servers or to inspect it beforehand, since restoring causes
the destination to execute arbitrary code of the source superusers'
choice. However, the client running the dump and restore needn't
trust the source or destination superusers.

Reported-by: Martin Rakhmanov
Reported-by: Matthieu Denais <litezeraw@gmail.com>
Reported-by: RyotaK <ryotak.mail@gmail.com>
Suggested-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Reviewed-by: Peter Eisentraut <peter@eisentraut.org>
Security: CVE-2025-8714
Backpatch-through: 13
22 files changed:
doc/src/sgml/ref/pg_dump.sgml diff | blob | blame | history
doc/src/sgml/ref/pg_dumpall.sgml diff | blob | blame | history
doc/src/sgml/ref/pg_restore.sgml diff | blob | blame | history
doc/src/sgml/ref/pgupgrade.sgml diff | blob | blame | history
doc/src/sgml/ref/psql-ref.sgml diff | blob | blame | history
src/bin/pg_combinebackup/t/002_compare_backups.pl diff | blob | blame | history
src/bin/pg_dump/dumputils.c diff | blob | blame | history
src/bin/pg_dump/dumputils.h diff | blob | blame | history
src/bin/pg_dump/pg_backup.h diff | blob | blame | history
src/bin/pg_dump/pg_backup_archiver.c diff | blob | blame | history
src/bin/pg_dump/pg_dump.c diff | blob | blame | history
src/bin/pg_dump/pg_dumpall.c diff | blob | blame | history
src/bin/pg_dump/pg_restore.c diff | blob | blame | history
src/bin/pg_dump/t/002_pg_dump.pl diff | blob | blame | history
src/bin/pg_upgrade/t/002_pg_upgrade.pl diff | blob | blame | history
src/bin/psql/command.c diff | blob | blame | history
src/bin/psql/help.c diff | blob | blame | history
src/bin/psql/t/001_basic.pl diff | blob | blame | history
src/bin/psql/tab-complete.c diff | blob | blame | history
src/test/recovery/t/027_stream_regress.pl diff | blob | blame | history
src/test/regress/expected/psql.out diff | blob | blame | history
src/test/regress/sql/psql.sql diff | blob | blame | history
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /