Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20171101221420.GA23969@takahe.colorado.edu>
Date: Wed, 1 Nov 2017 16:14:20 -0600
From: Leonid Isaev <leonid.isaev@...a.colorado.edu>
To: oss-security@...ts.openwall.com
Subject: Re: Fw: Security risk of vim swap files

On Wed, Nov 01, 2017 at 03:55:38PM +0100, Jakub Wilk wrote:
> * Leonid Isaev <leonid.isaev@...a.colorado.edu>, 2017-10-31, 20:33:
> > Just to clarify:
> > 1. vim creates a swap file applying user's umask.
> 
> I reproduced Kurt's findings on Debian unstable. Vim chmods the swapfile
> without honouring umask.
> 
> It does seem to keep read permissions of the original file, which is not the
> same thing as honouring umask, and which is a rather dubious behavior,
> especially when editing files belonging to other users.

Hmm, my umask is 0077, and vim creates swap files with permissions 600. But I
never used debian, so dunno...

> 
> > 2. It is totally OK to edit files in /tmp or /dev/shm or /var/tmp.
> 
> No, it's not.

Except when you want to avoid writes to the /home filesystem...

> 
> > The described "attack" when someone plants a /tmp/file.swp before
> > another user edits /tmp/file is not going to work because vim will
> > complain that the swap file already exists.
> 
> Sounds like a successful (albeit mild) DoS attack to me.
> But it's worse than that. vim attempts to read the swapfile before showing
> you the complaint:
> 
> $ mkfifo -m 644 /tmp/.bar.swp
> $ vim /tmp/bar
> [hangs forever]

Yes, I agree there are some inconveniences, but there is no information
disclosure others seem to have pointed out.

Cheers,
-- 
Leonid Isaev

Powered by blists - more mailing lists

Please check out the Open Source Software Security Wiki, which is counterpart to this mailing list.

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.