postgresql/src/bin
Nathan Bossart 67a2fbb8f9 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
2025-08-11 09:00:00 -05:00
..
initdb Don't put library-supplied -L/-I switches before user-supplied ones. 2025-07-29 15:17:40 -04:00
pg_amcheck Translation updates 2025-08-11 14:38:06 +02:00
pg_archivecleanup Translation updates 2025-07-14 13:54:38 +03:00
pg_basebackup Translation updates 2025-08-11 14:38:06 +02:00
pg_checksums Translation updates 2025-07-14 13:54:38 +03:00
pg_combinebackup Restrict psql meta-commands in plain-text dumps. 2025-08-11 09:00:00 -05:00
pg_config Translation updates 2025-08-11 14:38:06 +02:00
pg_controldata Translation updates 2025-07-14 13:54:38 +03:00
pg_ctl Translation updates 2025-07-14 13:54:38 +03:00
pg_dump Restrict psql meta-commands in plain-text dumps. 2025-08-11 09:00:00 -05:00
pg_resetwal Translation updates 2025-07-14 13:54:38 +03:00
pg_rewind Translation updates 2025-07-14 13:54:38 +03:00
pg_test_fsync Translation updates 2025-08-11 14:38:06 +02:00
pg_test_timing Translation updates 2025-08-11 14:38:06 +02:00
pg_upgrade Restrict psql meta-commands in plain-text dumps. 2025-08-11 09:00:00 -05:00
pg_verifybackup Translation updates 2025-07-14 13:54:38 +03:00
pg_waldump Translation updates 2025-07-14 13:54:38 +03:00
pg_walsummary Translation updates 2025-08-11 14:38:06 +02:00
pgbench Fix assertion failure in pgbench when handling multiple pipeline sync messages. 2025-08-03 10:49:54 +09:00
pgevent Update copyright for 2025 2025-01-01 11:21:55 -05:00
psql Restrict psql meta-commands in plain-text dumps. 2025-08-11 09:00:00 -05:00
scripts Translation updates 2025-07-14 13:54:38 +03:00
Makefile Update copyright for 2025 2025-01-01 11:21:55 -05:00
meson.build Update copyright for 2025 2025-01-01 11:21:55 -05:00