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 <[email protected]> Reported-by: Anthropic OSS program Author: Nathan Bossart <[email protected]> Co-authored-by: Anthropic OSS program Reviewed-by: Bertrand Drouvot <[email protected]> Security: CVE-2026-116313 Backpatch-through: 18 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/e10d38d4715ecb75b274546f0c5917de2fe14829 Author: Nathan Bossart <[email protected]> Modified Files -------------- src/bin/scripts/vacuumdb.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-)
