pgsql: vacuumdb: Fully qualify the catalog query's operators.

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: vacuumdb: Fully qualify the catalog query's operators.
Date: 2026-11-09 14:21:53
Message-ID: E1xQQFt-000000003Sl-3pb1@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

vacuumdb: Fully qualify the catalog query's operators.

vacuumdb runs its catalog query with the session's default
search_path so that --table arguments resolve as they would in
psql, but commit edba754f05 added two constructs whose = is not
schema-qualified: the relkind IN list in the LATERAL and the IS
DISTINCT FROM tests on attstattarget and stxstattarget. This
allows a database owner to shadow the operator with their own and
execute arbitrary code as the user running vacuumdb. To fix,
rewrite the former as OPERATOR(pg_catalog.=) ANY (array[...]) like
the relkind filter in the WHERE clause, and the latter as an IS
NULL test with OPERATOR(pg_catalog.<>).

Reported-by: Noah Misch <noah(at)leadboat(dot)com>
Reported-by: Anthropic OSS program
Author: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Co-authored-by: Anthropic OSS program
Reviewed-by: Bertrand Drouvot <bertranddrouvot(dot)pg(at)gmail(dot)com>
Security: CVE-2026-116313
Backpatch-through: 18

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/623cda5ef837c8fd3b6da14bd7c8e20fdd15d4f0
Author: Nathan Bossart <nathan(at)postgresql(dot)org>

Modified Files
--------------
src/bin/scripts/vacuuming.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-11-09 14:21:54 pgsql: Fix use-after-free in pg_show_all_settings().
Previous Message Noah Misch 2026-11-09 14:21:52 pgsql: Avoid use-after-free hazards in re-entrant use of pltcl.