Re: Proposal: template-ify (binary) extensions

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Markus Wanner <markus(at)bluegap(dot)ch>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, PostgreSQL-development Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Proposal: template-ify (binary) extensions
Date: 2013-07-15 10:19:40
Message-ID: 20130715101940.GA12007@alap2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2013-07-15 12:12:36 +0200, Markus Wanner wrote:
> Granted, the "internalization" of the DSO is somewhat critical to
> implement. Running as a non-root user, Postgres has less power than that
> and can certainly not protect the internalized DSO from modification by
> root. It can, however, store the DSO well protected from other users
> (e.g. in a directory within $PGDATA).

There's heaps of problems with that though. Think noexec mounts or selinux.

> Relying on the external DSO only exactly once can provide additional
> safety.

Not necessarily. Think of a distribution provided upgrade with a
security fix in an extension. On a machine with dozens of clusters. Now
you need to make sure each and every one of them has the new .so.

> Consider an extensions directory that's accidentally
> world-writable. As it stands, an attacker can modify the DSO and gain
> control as soon as a new connection loads it. With my proposal, the
> attacker would have to wait until CREATE EXTENSION. A point in time
> where the newly created extension is more likely to be tested and
> cross-checked.

I think protecting against the case where such directories are writable
is a rather bad argument. If anything screwed up those the postgres
binaries directory itself quite likely has also been changed and such.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Markus Wanner 2013-07-15 10:20:15 Re: Proposal: template-ify (binary) extensions
Previous Message Markus Wanner 2013-07-15 10:12:36 Re: Proposal: template-ify (binary) extensions