pgsql: Obstruct EXTRACT() field name deparse injection.

From: Noah Misch <noah(at)leadboat(dot)com>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Obstruct EXTRACT() field name deparse injection.
Date: 2026-08-10 13:41:20
Message-ID: E1wtQFk-00000000y1U-2IWV@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Obstruct EXTRACT() field name deparse injection.

The parser accepts any string as an EXTRACT() field name, but
deparsing does not quote and escape it accordingly. To fix, quote
and escape the field name during deparsing as needed. It might be
a good idea to validate the field name during parsing and
deparsing, too, but that is left as a future exercise.

Reported-by: Ben Morris in collaboration with Claude and Anthropic Research
Author: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Reviewed-by: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Reviewed-by: Etsuro Fujita <etsuro(dot)fujita(at)gmail(dot)com>
Security: CVE-2026-15741
Backpatch-through: 14

Branch
------
master

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

Modified Files
--------------
src/backend/utils/adt/ruleutils.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Noah Misch 2026-08-10 13:41:21 pgsql: Replace fixed-size, too-short array with a palloc'd one.
Previous Message Noah Misch 2026-08-10 13:41:19 pgsql: pg_dump: avoid assuming how long pg_proc.protrftypes can be.