Re: pgsql/src/bin/initdb initdb.sh

From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
Cc: <pgsql-committers(at)postgresql(dot)org>
Subject: Re: pgsql/src/bin/initdb initdb.sh
Date: 2001-06-24 11:25:12
Message-ID: Pine.LNX.4.30.0106241315250.900-100000@peter.localdomain
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Bruce Momjian writes:

> This brings up a question. If I have pid 333 and someone creates a file
> world-writable called /tmp/333, and I go and do:
>
> cat file >/tmp/$$
>
> isn't another user now able to modify those temp file contents. Is that
> the insecurity you mentioned Peter, and if so, how do you prevent this?

That is one possibility. Another exploit is with a symlink from /tmp/333
to a file you want to overwrite. This is more fun with root, but it's
still not a good idea here.

To securely create a temp file in shell you need to use mktemp(1), or do
something like (umask 077 && mkdir $TMPDIR/$$) to create a subdirectory.
Needless to say, it's tricky.

--
Peter Eisentraut peter_e(at)gmx(dot)net http://funkturm.homeip.net/~peter

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2001-06-24 21:18:34 Re: [COMMITTERS] pgsql/src/bin/initdb initdb.sh
Previous Message Bruce Momjian - CVS 2001-06-24 02:41:21 pgsql/src backend/parser/parse_coerce.c backen ...

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2001-06-24 11:28:00 Re: Setuid functions
Previous Message Larry Rosenman 2001-06-24 11:05:29 Re: Why would this use 600Meg of VM?