Mailinglist Archive: opensuse (3637 mails)

< Previous Next >
Re: [SLE] mktemp is dangerous warning
  • From: Jeffrey Taylor <jeff.taylor@xxxxxxxx>
  • Date: Thu, 24 May 2001 14:12:42 -0500
  • Message-id: <20010524141242.E24348@xxxxxxxxxxxxxxxxxxxxx>
If I understand all this correctly, mktemp creates temporary files in
an "unsafe" manner. mkstemp creates temporary files in exclusive
mode. The problem is a hostile user can create a link in /tmp with
the expected name of a temporary file that points to something else.
The something else is erased by the temporary file if the user
creating the temporary file has the right permissions (links don't
have permissions). If a hostile user correctly guesses the temp file
name created by root, boom, the file's gone.

This is not a problem if you don't have hostile users, e.i., you are
the only one using your machine. It is a local exploit, the hostile
user has to be logged in to do it, or to create a script to do it for
them.

If you worry, use the source! ;) Change the calls yourself.

Jeffrey

Quoting Togan Muftuoglu <toganm@xxxxxxxxxxxxxxxxxxxxx>:
> Hi,
>
> I have noticed after I upgrade to gcc 2.95.3 (from Philip Thomas's
> directory at ftp.suse.com) I am getting a warning like "use of mktemp is
> dangerous use mkstemp instead. "
>
> Now since I have a D in programming is this something I should worry
> about. An example is xsane-0.77
>
> TIA

--
I don't do Windows and I don't come to work before nine.
-- Johnny Paycheck

< Previous Next >
References