Bugtraq mailing list archives

Tired of /tmp? Here's a proposed solution


From: @ (Igor Chudov @ home)
Date: Mon, 26 Aug 1996 21:18:26 -0500


Are you tired of attacks based on files in /tmp?

Well, how about the following solution:

1. Introduce a convention that whenever a program wants a file name
for some temporary file, it should call a library function tmp_mknam

2. This function would accept the file prefix and be implemented in
the following way:

        a) check if directory $TMP exists and belongs to the effective uid
        b) if yes, return $TMP/<prefix><unique id> (maybe using tmpnam)
        c) if no, create a file under /tmp/<prefix><unique id> (maybe
           using tmpnam)

If program writers follow this convention and call tmp_mknam, users will
be able to insure their security from /tmp attacks by creating
directories with right permissions, for example under /tmp. For example,
I could protect myself by the following commands:

$ mkdir /tmp/ichudov
$ chmod 700 /tmp/ichudov
$ export TMP=/tmp/ichudov

This function can be made nit oa separate library of its own.

        - Igor.



Current thread: