When restore is restoring symlinks, it winds up changing
the ownership and the group of the file the symlink points
at, instead of the owner/group of the symlink itself.
Reproduction: reproduction may be somewhat difficult,
because you need to arrange that the symlink will be
later in the dump than the file it points at. On many
systems, doing (as a normal user) something like:
cd /tmp; ln -s / foobar
[root runs dump & restores somewhere]
is likely to work -- but if you do this to test, remember
to fix the ownership of / afterwards!
I consider this a security issue because in multi-user
environments where the operators or system administrators
will restore deleted/lost files for people, a nasty user
can exploit this to change the ownership of important
system files such as /etc/passwd to themselves, eg:
evil$ ln -s /etc/passwd src/important/test-3
[wait for a backup to run]
evil$ rm -rf src/important
evil$ mail -s 'restore request' root
I've lost my $HOME/src/important source tree;
can you restore it from backups?
[wait for restore...]
evil$ vi /etc/passwd # time for root2 to appear
Fix: use lchown() instead of chown() when restoring the
ownership/group of symlinks.
Apparently the author has seen this also; he says in the attached that all
versions (including 0.3, used in RedHat 5.2) are vulnerable, and that 0.4b9
fixes it to use lchown():
Is a new RPM in the works?
lchown does not work on stock Red Hat 5.2 systems, so the "fix" is
upgrading to Red Hat 6.0 (or upgrading glibc kernel and a bunch more).
jbj indicates that this problem is solved in the current release.