procmail
[Top] [All Lists]

Re: Automatically Deleting Based on Date

1996-07-01 13:14:55
On Mon, 1 Jul 1996, Doug Hughes wrote:
I never meant to imply that find itself will cause problems, but using
find to remove files from cron is dangerous.

But only  under very specific circumstances. The recent noise about it
was about the use of:

        find /tmp ... -exec rm {} \;

and the race condition exists  becaues /tmp is generally mode 1777
allowing anybody to write in the directory. Knowing the algorithm of
find, it is possible to fool find into providing a path to the rm
command that is, in fact, not pointing to the file that find thinks it
is (find is conjoled into following symbolic links even though it
shouldn't). 

My point was that as /tmp is not being used, and presumedly whatever
directory IS being used is not writeable by the world, it is
perfectly safe as the race condition can then only be exploited by the
uid running find.

Doug's point (made in an email conversation) is that he does not
necessarily know what his user's have set their permissions to and so
there is always a possibility of exploiting the race condition. He is
correct but I suspect that the parameters of this particular request
(as I vaguely understand them) are suitable (though I probably still
wouldn't use rm but some script that knew a bit more about the
files it was to delete, probably overkill though).

cheers