[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20091028202835.GA13012@love.zweije.nl>
Date: Wed, 28 Oct 2009 21:28:35 +0100
From: Vincent Zweije <vzweije@...ije.nl>
To: bugtraq@...urityfocus.com
Subject: Re: /proc filesystem allows bypassing directory permissions on
Linux
On Tue, Oct 27, 2009 at 08:09:57PM +0300, Dan Yefimov wrote:
|| On 27.10.2009 14:04, Vincent Zweije wrote:
|| > After chmodding the directory to 0700, *first*
|| >check the link count, *then* chmod the file to 0666:
|| >
|| > User1 creates file with permissions 0644
|| > User2 opens file for read access on file descriptor 4
|| > User1 chmod's directory to 0700
|| > User1 verifies no hard links to file
||
|| Here's a window, during which User2 is able to create a hardlink
|| and that will remain unnoticed by User1. There's no way to perform
|| link check and conditionally do chmod in an atomic manner.
User2 cannot create a hard link on the file any more now because it
requires search access on the directory, and that has been revoked by
chmod 0700 on the directory.
|| > User1 chmod's file to 0666
|| > User2 can not open the file for read or write access
|| > User2 can not write to file descriptor 4
|| > User2 _can_ write to /proc/$$/fd/4
However, as has been pointed out elsewhere in this thread, openat()
will at this point allow User2 to open the file for writing, provided
that he has a open file descriptor on the directory, opened with O_SEARCH.
This is a valid but different attack from the race above.
Ciao. Vincent.
--
Vincent Zweije <zweije@...all.nl> | "If you're flamed in a group you
<http://www.xs4all.nl/~zweije/> | don't read, does anybody get burnt?"
[Xhost should be taken out and shot] | -- Paul Tomblin on a.s.r.
Download attachment "signature.asc" of type "application/pgp-signature" (191 bytes)
Powered by blists - more mailing lists