mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Restrict accesses to non-system views and foreign tables during pg_dump.
When pg_dump retrieves the list of database objects and performs the data dump, there was possibility that objects are replaced with others of the same name, such as views, and access them. This vulnerability could result in code execution with superuser privileges during the pg_dump process. This issue can arise when dumping data of sequences, foreign tables (only 13 or later), or tables registered with a WHERE clause in the extension configuration table. To address this, pg_dump now utilizes the newly introduced restrict_nonsystem_relation_kind GUC parameter to restrict the accesses to non-system views and foreign tables during the dump process. This new GUC parameter is added to back branches too, but these changes do not require cluster recreation. Back-patch to all supported branches. Reviewed-by: Noah Misch Security: CVE-2024-7348 Backpatch-through: 12
This commit is contained in:
@ -637,6 +637,17 @@ EXPLAIN (VERBOSE, COSTS OFF) SELECT * FROM ft_empty ORDER BY c1;
|
||||
Remote SQL: SELECT c1, c2 FROM public.loct_empty ORDER BY c1 ASC NULLS LAST
|
||||
(3 rows)
|
||||
|
||||
-- test restriction on non-system foreign tables.
|
||||
SET restrict_nonsystem_relation_kind TO 'foreign-table';
|
||||
SELECT * from ft1 where c1 < 1; -- ERROR
|
||||
ERROR: access to non-system foreign table is restricted
|
||||
INSERT INTO ft1 (c1) VALUES (1); -- ERROR
|
||||
ERROR: access to non-system foreign table is restricted
|
||||
DELETE FROM ft1 WHERE c1 = 1; -- ERROR
|
||||
ERROR: access to non-system foreign table is restricted
|
||||
TRUNCATE ft1; -- ERROR
|
||||
ERROR: access to non-system foreign table is restricted
|
||||
RESET restrict_nonsystem_relation_kind;
|
||||
-- ===================================================================
|
||||
-- WHERE with remotely-executable conditions
|
||||
-- ===================================================================
|
||||
|
Reference in New Issue
Block a user