BugTraq
gzip TOCTOU file-permissions vulnerability Apr 04 2005 07:57PM
Imran Ghory (imranghory gmail com) (1 replies)
Re: gzip TOCTOU file-permissions vulnerability Apr 12 2005 11:47AM
Martin Pitt (martin pitt canonical com) (4 replies)
Re: gzip TOCTOU file-permissions vulnerability Apr 14 2005 01:14AM
Derek Martin (code pizzashack org)
Re: gzip TOCTOU file-permissions vulnerability Apr 13 2005 03:40PM
Joey Hess (joeyh debian org) (2 replies)
Re: gzip TOCTOU file-permissions vulnerability Apr 14 2005 06:36AM
Theodor Milkov (zimage icdsoft com)
Re: gzip TOCTOU file-permissions vulnerability Apr 14 2005 12:29AM
psz maths usyd edu au
Joey Hess <joeyh (at) debian (dot) org [email concealed]> wrote:

>> ... really dumb idea to have a group/world-writeable directory
>> without the sticky bit.
>
> It may be really dumb, but it's pretty common practice too. ...
> Just a few examples within the Debian project ...

Kindly add the Debian example:

psz@pisa:/usr/local$ ls -ld .
drwxrwsr-x 10 root staff 4096 Nov 13 2002 .

For Debian this is "mandated by policy":

> The Debian Policy Manual [1] says:
>
> ... /usr/local take precedence over the equivalents in /usr.
> ... should have permissions 2775 and be owned by root.staff.
>
> but it [2] also says:
>
> ... make sure that [it] is secure ...
> Files should be owned by root.root ... mode 644 or 755.
> Directories should be mode 755 or 2775 ... owned by the group that needs
> write access to it.
>
> ...
> References:
>
> [1] http://www.debian.org/doc/debian-policy/ch-opersys.html#s9.1.2
> [2] http://www.debian.org/doc/debian-policy/ch-files.html#s10.9

(please see http://bugs.debian.org/299007 for more details).

> (gzip is not typically ran in any of these directories AFAIK, FWIW).

Typically? Suppose I (as simple user psz) do

cd $HOME; touch xyz; chmod 666 xyz; gzip xyz

and tell my system manager that I have problems with that gzipped file.
While root is running "gunzip ~psz/xyz" I do

rm xyz; ln /etc/passwd xyz

then we end up with /etc/passwd world-writable. (Bzip uses chown also, so
using bzip2/bunzip would get /etc/passwd owned by psz; am not sure about
gzip or cpio.)

Cheers,

Paul Szabo psz (at) maths.usyd.edu (dot) au [email concealed] http://www.maths.usyd.edu.au/u/psz/
School of Mathematics and Statistics University of Sydney Australia

[ reply ]
Re: gzip TOCTOU file-permissions vulnerability Apr 13 2005 03:00PM
Peter J. Holzer (hjp wsr ac at)
Re: gzip TOCTOU file-permissions vulnerability Apr 13 2005 02:49PM
Derek Martin (code pizzashack org)


 

Privacy Statement
Copyright 2010, SecurityFocus