From: | Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Andreas Pflug <pgadmin(at)pse-consulting(dot)de>, PostgreSQL Patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: logfile subprocess and Fancy File Functions |
Date: | 2004-07-23 22:20:05 |
Message-ID: | 200407232220.i6NMK5S12961@candle.pha.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-patches |
Tom Lane wrote:
> Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us> writes:
> > Tom Lane wrote:
> >> As for the analogy to COPY, the addition of unlink/rename to a hacker's
> >> tool set renders the situation far more dangerous than if he only has
> >> write. Write will not allow him to hack write-protected files, but he
> >> might be able to rename them out of the way and create new trojaned
> >> versions...
>
> > Yes, I realized that later, that rename/unlink is based on the directory
> > permissions, not the file permissions. That is clearly a new capability
> > that could be seen as opening a new door.
>
> > However, file creation via COPY is based on the directory permissions
> > too.
>
> Right, but the point is that a write-protected file in a writable
> directory is not vulnerable to an attacker armed only with write().
> If he can do rename() or delete() then it *is* vulnerable. This is
> quite relevant to Postgres seeing that it's hardly practical to
> make the $PGDATA directory non-writable to the postmaster, while one
> might well think it worthwhile to make pg_hba.conf non-writable.
Yes, I was quoting:
> >> SELECT pg_file_unlink('postgresql.conf.bak');
> >> SELECT pg_file_write('postgresql.conf.tmp', 'listen_addresses=...');
> >> SELECT pg_file_rename('postgresql.conf.tmp', 'postgresql.conf',
> >> 'postgresql.conf.bak');
> >> SELECT pg_reload_conf();
The pg_file_write() doesn't open any new security holes, only rename and
unlink.
--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2004-07-23 22:21:32 | Re: logfile subprocess and Fancy File Functions |
Previous Message | Tom Lane | 2004-07-23 22:19:32 | Re: logfile subprocess and Fancy File Functions |