oss-sec mailing list archives

Re: Fw: Security risk of vim swap files


From: Seth Arnold <seth.arnold () canonical com>
Date: Mon, 6 Nov 2017 15:09:20 -0800

On Sun, Nov 05, 2017 at 07:03:07PM -0700, Kurt Seifried wrote:
Also you're all still ignoring umask =(. Please, when you create a new
file, check the umask and subtract it to make sure you're abiding by the
user's wishes.

Is it not the kernel's responsibility to enforce umask(2) is properly
applied?

My umask(3p) includes:

       The file mode creation mask of the process is used to turn
       off permission bits in the mode argument supplied during
       calls to the following functions:

        *  open(), openat(), creat(), mkdir(), mkdirat(), mkfifo(),
           and mkfifoat()

        *  mknod(), mknodat()

        *  mq_open()

        *  sem_open()

Obviously there's good case to be made that manual chmod(2) calls could
or should be modified by umask(2) values by hand, but probably all those
chmod(2) calls ought to be re-written to set the modes correctly at file
creation time (or mkdir, etc) to avoid race conditions.

Thanks

Attachment: signature.asc
Description:


Current thread: