2006-09-12 21:35:32

by David Wagner

[permalink] [raw]
Subject: Re: R: Linux kernel source archive vulnerable

linux-os \(Dick Johnson\) wrote:
>On Tue, 12 Sep 2006, David Wagner wrote:
>> Just because it is a bug in tar doesn't mean that Linux developers have
>> to create their tarfile in a way that tickles the bug. Two wrongs don't
>> make a right.
>
>It's not a tar bug, [...]

You misunderstand my point. I don't care whether it is a tar bug or not.
I'm not claiming it is a tar bug. I'm saying that people on those threads
claimed that this is a tar bug and used that as an excuse to do nothing
about the problem of world-writeable files in the Linux tar archive.
I'm saying that's a lousy excuse. What I'm saying is that, even if we
accept that it is a tar bug, that's not a good excuse for doing nothing
about the problem. Of course, if it is not a tar bug, then that makes
it an even weaker excuse.


2006-09-12 22:56:46

by René Scharfe

[permalink] [raw]
Subject: Re: R: Linux kernel source archive vulnerable

David Wagner schrieb:
> You misunderstand my point. I don't care whether it is a tar bug or
> not. I'm not claiming it is a tar bug. I'm saying that people on
> those threads claimed that this is a tar bug and used that as an
> excuse to do nothing about the problem of world-writeable files in
> the Linux tar archive. I'm saying that's a lousy excuse. What I'm
> saying is that, even if we accept that it is a tar bug, that's not a
> good excuse for doing nothing about the problem. Of course, if it is
> not a tar bug, then that makes it an even weaker excuse.

GNU tar offers two options on how to interpret the security mode bits in
a tar archive when you extract files from it: it either applies your
umask or it doesn't.

If you let it apply your umask and the mode in the archive is 0777 then
the extracted files will get exactly the permission you want them to
have. E.g. you could grant group write rights, all without running chmod.

It may be unfortunate that GNU tar defaults to not apply the umask when
run as root, thereby trusting the permissions in the archive. However,
this is not a bug but rather a feature which made sense back when tar
files were primarily used as backup files and not as transport containers.

So, don't run tar in local backup restore mode if you deal with archives
created by someone else, unless you want to set the permissions exactly
as they are stored in the archive. If you are root then you should know
that GNU tar defaults to the permission preserving mode and how to
switch to umask applying mode.

Ren?