pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Laurenz Albe <laurenz.albe@cybertec.at>
To: ZhangChi <798604270@qq.com>
To: pgsql-bugs <pgsql-bugs@lists.postgresql.org>
Subject: Re: BUG #18936: Trigger enable users to modify the tables which hedoesn't have privilege
Date: Sat, 24 May 2025 07:09:56 +0200
Message-ID: <ca81922f585aeedfb33eeeecb805dfa4a61e072b.camel@cybertec.at> (raw)
In-Reply-To: <tencent_6FB22713DA38A8D08B25F3DDD06B9C792B07@qq.com>
References: <18936-197af1cbbd49156f@postgresql.org>
	<c842110a59d8c273c2edecc3510e2c3a4bca3d3c.camel@cybertec.at>
	<tencent_6FB22713DA38A8D08B25F3DDD06B9C792B07@qq.com>

On Sat, 2025-05-24 at 11:06 +0800, ZhangChi wrote:
> However, it is common in some database servers for an attacker to gain minimal privileges
> on a single table within a target database. For instance, when registering an account on a
> service, the system might grant the user access to a dedicated table. Using the TRIGGER
> mechanism as I showed, such an attacker could then delete or exfiltrate data from other
> tables beyond their authorized access. Notably, this attack doesn't require superuser
> privileges - only access to the two relevant tables.
> 
> Permitting users to create triggers that can affect tables beyond their privilege scope
> appears to be a problematic design choice. Such triggers may be inadvertently executed
> by privileged users without their knowledge, creating potential security vulnerabilities.

The effects of a trigger are limited by the permissions of the executing user or
(in the case of SECURITY DEFINER) the owner of the trigger function.

Therefore, as I said, it is commendable never to do DML as a superuser.

There are cases where superusers perform DML, like restoring a pg_dump.
PostgreSQL takes great care that nothing can go wrong in these cases.

Yours,
Laurenz Albe





view thread (4+ messages)

Message-ID: <ca81922f585aeedfb33eeeecb805dfa4a61e072b.camel@cybertec.at>
Permalink:  ../ca81922f585aeedfb33eeeecb805dfa4a61e072b.camel@cybertec.at/
Also on:    postgresql.org/message-id/ca81922f585aeedfb33eeeecb805dfa4a61e072b.camel@cybertec.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-bugs@postgresql.org
  Cc: laurenz.albe@cybertec.at, 798604270@qq.com, pgsql-bugs@lists.postgresql.org
  Subject: Re: BUG #18936: Trigger enable users to modify the tables which hedoesn't have privilege
  In-Reply-To: <ca81922f585aeedfb33eeeecb805dfa4a61e072b.camel@cybertec.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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