pgsql: Obstruct EXTRACT() field name deparse injection. - Mailing list pgsql-committers

From Noah Misch
Subject pgsql: Obstruct EXTRACT() field name deparse injection.
Date
Msg-id E1wtQFm-00000000y4z-2qoQ@gemulon.postgresql.org
Whole thread
List 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@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Reviewed-by: Etsuro Fujita <etsuro.fujita@gmail.com>
Security: CVE-2026-15741
Backpatch-through: 14

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/a3832a7571013469dc81e35d0fe1c0066e86d893
Author: Nathan Bossart <nathan@postgresql.org>

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


pgsql-committers by date:

Previous
From: Noah Misch
Date:
Subject: pgsql: Guard against overlength time zone abbreviations in to_char().
Next
From: Noah Misch
Date:
Subject: pgsql: Harden tsquery code against overflows.