Bugtraq mailing list archives

Re: BUGTRAQ ALERT: Solaris 2.x vulnerability


From: nlawson () statler csc calpoly edu (Nathan Lawson)
Date: Wed, 16 Aug 1995 20:10:25 -0700


On Wed, 16 Aug 1995, Nathan Lawson wrote:

The /tmp/.psXXXXXX is open to a race.  The directory is safe as long as it
isn't world writable.

Mind to expand on this? Who would tiss work. The /tmp directory *does*
have the sticky bit so we cant rm the file and substitute it. Are you talking

Yes.  Basically, Irix uses an insecure method of making a temp file based on
pid, just like any other OS that uses blahXXXXXX.  If you are going to use a
predictable filename, then you'd better open it securely.

Hobbit posted a very good method a while back during some binmail fiasco.
Basically, with a temp file, you are creating a file.  The way he described was
to open the file with O_EXCL so it doesn't follow symlinks.  Then, lstat the
file and make sure it is not a link.  Lastly, stat the file and make sure it
has the same inode as found in the lstat call.

My description is very poor in light of Hobbit's, so please read his to make
sure you understand how to write to files securely.

-Nate



Current thread: