pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via l
4+ messages / 1 participants
[nested] [flat]

* pgsql: Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via l
@ 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

Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via locking.

Commands that run extension SQL scripts intentionally depart from a
standard, "Remove from search_path any schemas that permit untrusted
users to create objects."  While CVE-2020-14350 blocked most attacks,
one remained via ALTER SCHEMA extschema RENAME.  A user with
database-level CREATE privilege could execute arbitrary code as the
bootstrap superuser.  Block that attack by having ALTER SCHEMA RENAME,
CREATE EXTENSION, and ALTER EXTENSION UPDATE lock the schema.  This
makes schema rename locking more like that for object types
AlterObjectRename_internal() covers.

Also, make extension-mutating commands take self-exclusive locks.  Make
relevant commands take the same lock on each dependency extension.  This
doesn't stop a known attack against a specific extension, but
overlapping extension mutations are fragile and not useful.

Back-patch to v14 (all supported versions).

Reported-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Greg Burd <greg@burd.me>
Backpatch-through: 14
Security: CVE-2026-6467

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/7f854a31f7528b869713e53fd484afb19731615e

Modified Files
--------------
contrib/ltree/.gitignore                        |   2 +
contrib/ltree/Makefile                          |   2 +
contrib/ltree/expected/schema-rename-attack.out |  80 +++++++++++++
contrib/ltree/meson.build                       |   5 +
contrib/ltree/specs/schema-rename-attack.spec   | 127 ++++++++++++++++++++
src/backend/commands/extension.c                | 149 ++++++++++++++++++------
src/backend/commands/schemacmds.c               |  18 +--
7 files changed, 339 insertions(+), 44 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via l
@ 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

Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via locking.

Commands that run extension SQL scripts intentionally depart from a
standard, "Remove from search_path any schemas that permit untrusted
users to create objects."  While CVE-2020-14350 blocked most attacks,
one remained via ALTER SCHEMA extschema RENAME.  A user with
database-level CREATE privilege could execute arbitrary code as the
bootstrap superuser.  Block that attack by having ALTER SCHEMA RENAME,
CREATE EXTENSION, and ALTER EXTENSION UPDATE lock the schema.  This
makes schema rename locking more like that for object types
AlterObjectRename_internal() covers.

Also, make extension-mutating commands take self-exclusive locks.  Make
relevant commands take the same lock on each dependency extension.  This
doesn't stop a known attack against a specific extension, but
overlapping extension mutations are fragile and not useful.

Back-patch to v14 (all supported versions).

Reported-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Greg Burd <greg@burd.me>
Backpatch-through: 14
Security: CVE-2026-6467

Branch
------
REL_19_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/fae85aa196192a4f9baeb122d5246c580cc89f9b

Modified Files
--------------
contrib/ltree/.gitignore                        |   2 +
contrib/ltree/Makefile                          |   2 +
contrib/ltree/expected/schema-rename-attack.out |  80 +++++++++++++
contrib/ltree/meson.build                       |   5 +
contrib/ltree/specs/schema-rename-attack.spec   | 127 ++++++++++++++++++++
src/backend/commands/extension.c                | 149 ++++++++++++++++++------
src/backend/commands/schemacmds.c               |  18 +--
7 files changed, 339 insertions(+), 44 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via l
@ 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

Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via locking.

Commands that run extension SQL scripts intentionally depart from a
standard, "Remove from search_path any schemas that permit untrusted
users to create objects."  While CVE-2020-14350 blocked most attacks,
one remained via ALTER SCHEMA extschema RENAME.  A user with
database-level CREATE privilege could execute arbitrary code as the
bootstrap superuser.  Block that attack by having ALTER SCHEMA RENAME,
CREATE EXTENSION, and ALTER EXTENSION UPDATE lock the schema.  This
makes schema rename locking more like that for object types
AlterObjectRename_internal() covers.

Also, make extension-mutating commands take self-exclusive locks.  Make
relevant commands take the same lock on each dependency extension.  This
doesn't stop a known attack against a specific extension, but
overlapping extension mutations are fragile and not useful.

Back-patch to v14 (all supported versions).

Reported-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Greg Burd <greg@burd.me>
Backpatch-through: 14
Security: CVE-2026-6467

Branch
------
REL_18_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/68ee5a81610e02be3a5c46063b089b5f5e20f2ec

Modified Files
--------------
contrib/ltree/.gitignore                        |   2 +
contrib/ltree/Makefile                          |   2 +
contrib/ltree/expected/schema-rename-attack.out |  80 +++++++++++++
contrib/ltree/meson.build                       |   5 +
contrib/ltree/specs/schema-rename-attack.spec   | 127 ++++++++++++++++++++
src/backend/commands/extension.c                | 149 ++++++++++++++++++------
src/backend/commands/schemacmds.c               |  18 +--
7 files changed, 339 insertions(+), 44 deletions(-)



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* pgsql: Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via l
@ 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

Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via locking.

Commands that run extension SQL scripts intentionally depart from a
standard, "Remove from search_path any schemas that permit untrusted
users to create objects."  While CVE-2020-14350 blocked most attacks,
one remained via ALTER SCHEMA extschema RENAME.  A user with
database-level CREATE privilege could execute arbitrary code as the
bootstrap superuser.  Block that attack by having ALTER SCHEMA RENAME,
CREATE EXTENSION, and ALTER EXTENSION UPDATE lock the schema.  This
makes schema rename locking more like that for object types
AlterObjectRename_internal() covers.

Also, make extension-mutating commands take self-exclusive locks.  Make
relevant commands take the same lock on each dependency extension.  This
doesn't stop a known attack against a specific extension, but
overlapping extension mutations are fragile and not useful.

Back-patch to v14 (all supported versions).

Reported-by: Noah Misch <noah@leadboat.com>
Reviewed-by: Greg Burd <greg@burd.me>
Backpatch-through: 14
Security: CVE-2026-6467

Branch
------
REL_17_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/79f9793fc44c75d3096ef67677a729ad21a89c2c

Modified Files
--------------
contrib/ltree/.gitignore                        |   2 +
contrib/ltree/Makefile                          |   2 +
contrib/ltree/expected/schema-rename-attack.out |  80 ++++++++++++
contrib/ltree/meson.build                       |   5 +
contrib/ltree/specs/schema-rename-attack.spec   | 127 ++++++++++++++++++
src/backend/commands/extension.c                | 163 ++++++++++++++++++------
src/backend/commands/schemacmds.c               |  20 +--
7 files changed, 355 insertions(+), 44 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: Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via l Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via l Noah Misch <noah@leadboat.com>
2026-11-09 14:21 pgsql: Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via l Noah Misch <noah@leadboat.com>
2026-11-09 14:22 pgsql: Block ALTER SCHEMA RENAME attack on CREATE EXTENSION etc., via l 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