pageinspect some function no need superuser priv

Started by jian he11 months ago5 messageshackers
Beta feature

Hackorum builds and tests every patch posted to the lists, not only commitfest submissions. This is Hackorum's own CI rather than the PostgreSQL project's, and it is still under testing - please report anything that looks wrong.

appliessuccessCI history

You can run a PostgreSQL built from this patch straight from Docker, with no checkout and no build:

docker run --rm -p 5432:5432 ghcr.io/hackorum-dev/postgres-patch:t52452
psql -h localhost -U postgres

Built from patchset v1 (message #1), September 20, 2026 at 09:32 AM.

Every patchset is also pushed to a branch of our PostgreSQL fork, so you can check out the same tree CI built. Without a PostgreSQL checkout:

git clone --branch t52452_1 https://github.com/hackorum-dev/postgres.git

In a checkout you already have, add the fork once:

git remote add hackorum https://github.com/hackorum-dev/postgres.git

then, for this patchset and every later one:

git fetch hackorum t52452_1 && git checkout t52452_1

Patchset v1 (message #1) is on t52452_1

Jump to latest
#1jian he
jian.universality@gmail.com

hi.

just came to my mind.

If you're the table owner, you should be allowed to use get_raw_page (and other
pageinspect module functions)?
We can use RangeVarGetRelidExtended with
RangeVarCallbackOwnsRelation to perform the ownership check.

Attached is a draft POC.
Am I missing anything obvious?

Attachments:

t52452_1
page_inspect_owner_can_query.difftext/x-patch; charset=US-ASCII; name=page_inspect_owner_can_query.diffDownload+11-7
#2Kirill Reshke
reshkekirill@gmail.com
In reply to: jian he (#1)
Re: pageinspect some function no need superuser priv

On Tue, 14 Oct 2025, 18:27 jian he, <jian.universality@gmail.com> wrote:

hi.

just came to my mind.

If you're the table owner, you should be allowed to use get_raw_page (and
other
pageinspect module functions)?
We can use RangeVarGetRelidExtended with
RangeVarCallbackOwnsRelation to perform the ownership check.

Attached is a draft POC.
Am I missing anything obvious?

Hi!
I was also wondering if there is any security vulnerability with that.
I was thinking about page lsn, checkpoint and wal compression as a possible
way to abuse, but did not managed to came up with exploit

Show quoted text
#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: Kirill Reshke (#2)
Re: pageinspect some function no need superuser priv

Kirill Reshke <reshkekirill@gmail.com> writes:

On Tue, 14 Oct 2025, 18:27 jian he, <jian.universality@gmail.com> wrote:

If you're the table owner, you should be allowed to use get_raw_page (and
other pageinspect module functions)?

I was also wondering if there is any security vulnerability with that.
I was thinking about page lsn, checkpoint and wal compression as a possible
way to abuse, but did not managed to came up with exploit

Yeah, I do not think it follows that being table owner should
entitle you to such low-level access. I'm inclined to reject
this proposal.

regards, tom lane

#4Nathan Bossart
nathandbossart@gmail.com
In reply to: Tom Lane (#3)
Re: pageinspect some function no need superuser priv

On Tue, Oct 14, 2025 at 10:29:39AM -0400, Tom Lane wrote:

Yeah, I do not think it follows that being table owner should
entitle you to such low-level access. I'm inclined to reject
this proposal.

-1 here, too. IMHO all of pageinspect should remain superuser-only since
it is meant for development/debugging. The proposal doesn't describe a
use-case for the relaxed privileges, either.

--
nathan

#5Michael Paquier
michael@paquier.xyz
In reply to: Nathan Bossart (#4)
Re: pageinspect some function no need superuser priv

On Tue, Oct 14, 2025 at 10:51:51AM -0500, Nathan Bossart wrote:

On Tue, Oct 14, 2025 at 10:29:39AM -0400, Tom Lane wrote:

Yeah, I do not think it follows that being table owner should
entitle you to such low-level access. I'm inclined to reject
this proposal.

-1 here, too. IMHO all of pageinspect should remain superuser-only since
it is meant for development/debugging. The proposal doesn't describe a
use-case for the relaxed privileges, either.

Same. We've always wanted this module to be superuser-only, with
superuser hardcoded checks and not even execution ACLs.
--
Michael