pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: Reject pseudo-type output parameters in SQL functions. 4+ messages / 1 participants [nested] [flat]
* pgsql: Reject pseudo-type output parameters in SQL functions. @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Reject pseudo-type output parameters in SQL functions. fmgr_sql_validator() rejected unsafe pseudo-type input parameters, but neglected to apply the same rule to output parameters. An SQL function could therefore declare an output column of type "any". This created problems for tupledesc_match(), which checks an SQL function's result rows against its declared output columns using IsBinaryCoercible(). IsBinaryCoercible accepts every type for "any", so rows of an arbitrary row type could be read using a tuple descriptor that does not match their physical layout. This could be abused to disclose server memory contents, and to perform arbitrary code execution. To fix, teach fmgr_sql_validator() to apply its pseudo-type check to parameters of every mode (not just for input parameters). Note that the treatment of record is somewhat arbitrary: record and record[] remain allowed as output column types, while record remains disallowed as an input parameter type. Allowing record in either position is likely safe, but a back-patched security fix is not the place to change existing behavior either way. Reported-by: Peter Geoghegan <pg@bowt.ie> Reported-by: Stephan Lipp <Stephan@Adalogics.com> Author: Peter Geoghegan <pg@bowt.ie> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Security: CVE-2026-18447 Backpatch-through: 14 Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/eb423d5987a70a7afc64d6f74b5ae724f1bd202e Author: Peter Geoghegan <pg@bowt.ie> Modified Files -------------- src/backend/catalog/pg_proc.c | 36 +++++++++++----- src/test/regress/expected/create_function_sql.out | 51 ++++++++++++++++++++++- src/test/regress/sql/create_function_sql.sql | 28 +++++++++++++ 3 files changed, 103 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Reject pseudo-type output parameters in SQL functions. @ 2026-11-09 14:21 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:21 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Reject pseudo-type output parameters in SQL functions. fmgr_sql_validator() rejected unsafe pseudo-type input parameters, but neglected to apply the same rule to output parameters. An SQL function could therefore declare an output column of type "any". This created problems for tupledesc_match(), which checks an SQL function's result rows against its declared output columns using IsBinaryCoercible(). IsBinaryCoercible accepts every type for "any", so rows of an arbitrary row type could be read using a tuple descriptor that does not match their physical layout. This could be abused to disclose server memory contents, and to perform arbitrary code execution. To fix, teach fmgr_sql_validator() to apply its pseudo-type check to parameters of every mode (not just for input parameters). Note that the treatment of record is somewhat arbitrary: record and record[] remain allowed as output column types, while record remains disallowed as an input parameter type. Allowing record in either position is likely safe, but a back-patched security fix is not the place to change existing behavior either way. Reported-by: Peter Geoghegan <pg@bowt.ie> Reported-by: Stephan Lipp <Stephan@Adalogics.com> Author: Peter Geoghegan <pg@bowt.ie> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Security: CVE-2026-18447 Backpatch-through: 14 Branch ------ REL_19_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/c2f70845c48e47d8940377c9179c6eb8bd213354 Author: Peter Geoghegan <pg@bowt.ie> Modified Files -------------- src/backend/catalog/pg_proc.c | 36 +++++++++++----- src/test/regress/expected/create_function_sql.out | 51 ++++++++++++++++++++++- src/test/regress/sql/create_function_sql.sql | 28 +++++++++++++ 3 files changed, 103 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Reject pseudo-type output parameters in SQL functions. @ 2026-11-09 14:22 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Reject pseudo-type output parameters in SQL functions. fmgr_sql_validator() rejected unsafe pseudo-type input parameters, but neglected to apply the same rule to output parameters. An SQL function could therefore declare an output column of type "any". This created problems for tupledesc_match(), which checks an SQL function's result rows against its declared output columns using IsBinaryCoercible(). IsBinaryCoercible accepts every type for "any", so rows of an arbitrary row type could be read using a tuple descriptor that does not match their physical layout. This could be abused to disclose server memory contents, and to perform arbitrary code execution. To fix, teach fmgr_sql_validator() to apply its pseudo-type check to parameters of every mode (not just for input parameters). Note that the treatment of record is somewhat arbitrary: record and record[] remain allowed as output column types, while record remains disallowed as an input parameter type. Allowing record in either position is likely safe, but a back-patched security fix is not the place to change existing behavior either way. Reported-by: Peter Geoghegan <pg@bowt.ie> Reported-by: Stephan Lipp <Stephan@Adalogics.com> Author: Peter Geoghegan <pg@bowt.ie> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Security: CVE-2026-18447 Backpatch-through: 14 Branch ------ REL_18_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/ff961cbbf3af286665209b8039df3565ade198ae Author: Peter Geoghegan <pg@bowt.ie> Modified Files -------------- src/backend/catalog/pg_proc.c | 36 +++++++++++----- src/test/regress/expected/create_function_sql.out | 51 ++++++++++++++++++++++- src/test/regress/sql/create_function_sql.sql | 28 +++++++++++++ 3 files changed, 103 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
* pgsql: Reject pseudo-type output parameters in SQL functions. @ 2026-11-09 14:22 Noah Misch <noah@leadboat.com> 0 siblings, 0 replies; 4+ messages in thread From: Noah Misch @ 2026-11-09 14:22 UTC (permalink / raw) To: pgsql-committers@lists.postgresql.org Reject pseudo-type output parameters in SQL functions. fmgr_sql_validator() rejected unsafe pseudo-type input parameters, but neglected to apply the same rule to output parameters. An SQL function could therefore declare an output column of type "any". This created problems for tupledesc_match(), which checks an SQL function's result rows against its declared output columns using IsBinaryCoercible(). IsBinaryCoercible accepts every type for "any", so rows of an arbitrary row type could be read using a tuple descriptor that does not match their physical layout. This could be abused to disclose server memory contents, and to perform arbitrary code execution. To fix, teach fmgr_sql_validator() to apply its pseudo-type check to parameters of every mode (not just for input parameters). Note that the treatment of record is somewhat arbitrary: record and record[] remain allowed as output column types, while record remains disallowed as an input parameter type. Allowing record in either position is likely safe, but a back-patched security fix is not the place to change existing behavior either way. Reported-by: Peter Geoghegan <pg@bowt.ie> Reported-by: Stephan Lipp <Stephan@Adalogics.com> Author: Peter Geoghegan <pg@bowt.ie> Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us> Security: CVE-2026-18447 Backpatch-through: 14 Branch ------ REL_15_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/046a36e03300b0f239dfb76801d3119568772c5d Author: Peter Geoghegan <pg@bowt.ie> Modified Files -------------- src/backend/catalog/pg_proc.c | 36 +++++++++++----- src/test/regress/expected/create_function_sql.out | 51 ++++++++++++++++++++++- src/test/regress/sql/create_function_sql.sql | 28 +++++++++++++ 3 files changed, 103 insertions(+), 12 deletions(-) ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2026-11-09 14:22 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2026-11-09 14:21 pgsql: Reject pseudo-type output parameters in SQL functions. Noah Misch <noah@leadboat.com> 2026-11-09 14:21 pgsql: Reject pseudo-type output parameters in SQL functions. Noah Misch <noah@leadboat.com> 2026-11-09 14:22 pgsql: Reject pseudo-type output parameters in SQL functions. Noah Misch <noah@leadboat.com> 2026-11-09 14:22 pgsql: Reject pseudo-type output parameters in SQL functions. Noah Misch <noah@leadboat.com>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox