]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Reject substituting extension schemas or owners matching ["$'\].
authorNoah Misch <noah@leadboat.com>
Mon, 7 Aug 2023 13:05:56 +0000 (06:05 -0700)
committerNoah Misch <noah@leadboat.com>
Mon, 7 Aug 2023 13:06:01 +0000 (06:06 -0700)
commit919ebb023e74546c6293352556365091c5402366
tree07d294606d3a34b7d389516fd24d242e5e03cf65
parent94abb95e3c9363afa8d35c237833333959dadc43
Reject substituting extension schemas or owners matching ["$'\].

Substituting such values in extension scripts facilitated SQL injection
when @extowner@, @extschema@, or @extschema:...@ appeared inside a
quoting construct (dollar quoting, '', or "").  No bundled extension was
vulnerable.  Vulnerable uses do appear in a documentation example and in
non-bundled extensions.  Hence, the attack prerequisite was an
administrator having installed files of a vulnerable, trusted,
non-bundled extension.  Subject to that prerequisite, this enabled an
attacker having database-level CREATE privilege to execute arbitrary
code as the bootstrap superuser.  By blocking this attack in the core
server, there's no need to modify individual extensions.  Back-patch to
v11 (all supported versions).

Reported by Micah Gate, Valerie Woolard, Tim Carey-Smith, and Christoph
Berg.

Security: CVE-2023-39417
src/backend/commands/extension.c
src/test/modules/test_extensions/Makefile
src/test/modules/test_extensions/expected/test_extensions.out
src/test/modules/test_extensions/sql/test_extensions.sql
src/test/modules/test_extensions/test_ext_extschema--1.0.sql [new file with mode: 0644]
src/test/modules/test_extensions/test_ext_extschema.control [new file with mode: 0644]