bug-tar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-tar] BUG: incorrectly creates hard links in archive


From: Joerg Schilling
Subject: Re: [Bug-tar] BUG: incorrectly creates hard links in archive
Date: Sat, 10 Jul 2004 15:33:18 +0200 (CEST)

>From: Toby Peterson <address@hidden>

>address@hidden ~]$ cat tarbug.sh
>#!/bin/sh

>rm -rf tartest
>rm -f tartest.tar

>mkdir tartest
>mkdir tartest/test1
>mkdir tartest/test2

>echo TEST > tartest/test1/test.txt
>ln tartest/test1/test.txt tartest/test2/test.txt

>tar cf tartest.tar tartest/test1/test.txt tartest/test1/test.txt

>rm -r tartest
>tar tvf tartest.tar
>tar xf tartest.tar
>address@hidden ~]$ sh tarbug.sh
>-rw-r--r-- toby/toby         5 Jul  9 17:30 2004 tartest/test1/test.txt
>-rw-r--r-- toby/toby         0 Jul  9 17:30 2004 tartest/test1/test.txt 
>link to tartest/test1/test.txt
>tar: tartest/test1/test.txt: Cannot hard link to 
>`tartest/test1/test.txt': No such file or directory
>tar: Error exit delayed from previous errors

This is a problem that I dod document quite some time ago...

It allows you to use most tar implementations to be used to remve
arbitrary files! I call it a big security issue for this reason.

star -xp < tartest.tar
star: Blocksize = 5 records.
star: current 'tartest/test1/test.txt' newer.
star: 1 blocks + 0 bytes (total of 2560 bytes = 2.50k).

rm -rf tartest

star -xpU < tartest.tar
star: Blocksize = 5 records.
star: 'tartest/test1/test.txt' from/to identical, skipping ...
star: 1 blocks + 0 bytes (total of 2560 bytes = 2.50k).
star: The following problems occurred during archive processing:
star: Cannot: stat 0, open 0, read/write 0. Size changed 0.
star: Missing links 0, Name too long 0, File too big 0, Not dumped 0.
star: Skipped same file 1.
star: Processed all possible files, despite earlier errors.

The problem is documented in 


        ftp://ftp.berlios.de/pub/star/testscripts/

See files README.create-and-remove  create-and-remove.tar remove.tar



Jörg

-- 
 EMail:address@hidden (home) Jörg Schilling D-13353 Berlin
       address@hidden           (uni)  If you don't have iso-8859-1
       address@hidden   (work) chars I am J"org Schilling
 URL:  http://www.fokus.fraunhofer.de/usr/schilling 
ftp://ftp.berlios.de/pub/schily




reply via email to

[Prev in Thread] Current Thread [Next in Thread]