oss-sec mailing list archives
Re: Fw: Security risk of vim swap files
From: Leonid Isaev <leonid.isaev () jila colorado edu>
Date: Wed, 1 Nov 2017 16:14:20 -0600
On Wed, Nov 01, 2017 at 03:55:38PM +0100, Jakub Wilk wrote:
* Leonid Isaev <leonid.isaev () jila 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
Current thread:
- Re: Fw: Security risk of vim swap files, (continued)
- Re: Fw: Security risk of vim swap files Simon McVittie (Nov 01)
- Re: Fw: Security risk of vim swap files Tim (Nov 01)
- Re: Fw: Security risk of vim swap files Jeffrey Walton (Nov 01)
- Re: Fw: Security risk of vim swap files Kurt Seifried (Nov 01)
- Re: Fw: Security risk of vim swap files Jakub Wilk (Nov 01)
- Re: Fw: Security risk of vim swap files Solar Designer (Nov 01)
- Re: Security risk of vim swap files Ian Zimmerman (Nov 06)
- Re: Security risk of vim swap files Solar Designer (Nov 06)
- Re: Security risk of vim swap files Jakub Wilk (Nov 06)
- Re: Fw: Security risk of vim swap files Jakub Wilk (Nov 01)
- Re: Fw: Security risk of vim swap files Leonid Isaev (Nov 01)
- Re: Fw: Security risk of vim swap files Jan Pokorný (Nov 01)
- Re: Re: Fw: Security risk of vim swap files Michael Orlitzky (Nov 01)
- Re: Re: Fw: Security risk of vim swap files Florent Rougon (Nov 01)
- Re: Re: Fw: Security risk of vim swap files Kurt Seifried (Nov 02)
- Re: Re: Fw: Security risk of vim swap files Jakub Wilk (Nov 03)
- Re: Re: Fw: Security risk of vim swap files Scott Court (Nov 03)