Inheritance is a security loophole!
Inheritance is a security loophole!
От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
The lack of a permissions check for creating a child table means that
in current sources, any user can inject data of his choosing into
another user's tables. Example:
User A:
regression=> create table foo (f1 text);
CREATE
regression=> insert into foo values ('good data');
INSERT 271570 1
User B:
regression=> create table foohack () inherits (foo);
CREATE
regression=> insert into foohack values ('you have been hacked!');
INSERT 271598 1
Now User A sees:
regression=> select * from foo; f1
-----------------------good datayou have been hacked!
(2 rows)
User A can only avoid this trap by being very careful to specify ONLY
in every query. If he *intends* to use foo as an inheritance tree
master, then that cure doesn't work either.
Just to add insult to injury, user A is now unable to drop table foo.
He'll also get permission failures from commands like "UPDATE foo ..."
I suppose a proper fix would involve adding a new permission type "can
make child tables", but I don't want to mess with that at the moment.
For 7.1, I propose that we only allow creation of child tables to the
owner of the parent table.
Comments?
regards, tom lane
PS: another interesting problem: create a temp table, then create a
non-temp table that inherits from it. Unhappiness ensues when you
end your session. Need to prohibit this combination, I think.
Re: Inheritance is a security loophole!
От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
> I suppose a proper fix would involve adding a new permission type "can > make child tables", but I don't want to mess with that at the moment. > For 7.1, I propose that we only allow creation of child tables to the > owner of the parent table. I see no reason people would be inheriting from other people's tables. Let's disable it. > PS: another interesting problem: create a temp table, then create a > non-temp table that inherits from it. Unhappiness ensues when you > end your session. Need to prohibit this combination, I think. Clear example where mixing features causes strange behavour. Part of the UNION/TEMPORARY/subquery/aggregate/inheritance/rule/view/array mix. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 853-3000 + If your life is a hard drive, | 830 Blythe Avenue + Christ can be your backup. | Drexel Hill, Pennsylvania 19026