WIPE(1) | User Commands | WIPE(1) |
wipe - securely erase files from magnetic media
wipe [options] path1 path2 ... pathn
This manual page describes version 0.22 of wipe , released November 2010.
Recovery of supposedly erased data from magnetic media is easier than what many people would like to believe. A technique called Magnetic Force Microscopy (MFM) allows any moderately funded opponent to recover the last two or three layers of data written to disk; wipe repeatedly overwrites special patterns to the files to be destroyed, using the fsync() call and/or the O_SYNC bit to force disk access. In normal mode, 34 patterns are used (of which 8 are random). These patterns were recommended in an article from Peter Gutmann (pgut001@cs.auckland.ac.nz) entitled "Secure Deletion of Data from Magnetic and Solid-State Memory". The normal mode takes 35 passes (0-34). A quick mode allows you to use only 4 passes with random patterns, which is of course much less secure.
Journaling filesystems (such as Ext3 or ReiserFS) are now being used by default by most Linux distributions. No secure deletion program that does filesystem-level calls can sanitize files on such filesystems, because sensitive data and metadata can be written to the journal, which cannot be readily accessed. Per-file secure deletion is better implemented in the operating system.
Encrypting a whole partition with cryptoloop, for example, does not help very much either, since there is a single key for all the partition.
Therefore wipe is best used to sanitize a harddisk before giving it to untrusted parties (i.e. sending your laptop for repair, or selling your disk). Wiping size issues have been hopefully fixed (I apologize for the long delay).
Be aware that harddisks are quite intelligent beasts those days. They transparently remap defective blocks. This means that the disk can keep an albeit corrupted (maybe slightly) but inaccessible and unerasable copy of some of your data. Modern disks are said to have about 100% transparent remapping capacity. You can have a look at recent discussions on Slashdot.
I hereby speculate that harddisks can use the spare remapping area to secretly make copies of your data. Rising totalitarianism makes this almost a certitude. It is quite straightforward to implement some simple filtering schemes that would copy potentially interesting data. Better, a harddisk can probably detect that a given file is being wiped, and silently make a copy of it, while wiping the original as instructed.
Recovering such data is probably easily done with secret IDE/SCSI commands. My guess is that there are agreements between harddisk manufacturers and government agencies. Well-funded mafia hackers should then be able to find those secret commands too.
Don't trust your harddisk. Encrypt all your data.
Of course this shifts the trust to the computing system, the CPU, and so on. I guess there are also "traps" in the CPU and, in fact, in every sufficiently advanced mass-marketed chip. Wealthy nations can find those. Therefore these are mainly used for criminal investigation and "control of public dissent".
People should better think of their computing devices as facilities lended by the DHS.
The author, the maintainers or the contributors of this package can NOT be held responsible in any way if wipe destroys something you didn't want it to destroy. Let's make this very clear. I want you to assume that this is a nasty program that will wipe out parts of your files that you didn't want it to wipe. So whatever happens after you launch wipe is your entire responsibility. In particular, no one guarantees that wipe will conform to the specifications given in this manual page.
Similarly, we cannot guarantee that wipe will actually erase data, or that wiped data is not recoverable by advanced means. So if nasties get your secrets because you sold a wiped harddisk to someone you don't know, well, too bad for you.
The best way to sanitize a storage medium is to subject it to temperatures exceeding 1500K. As a cheap alternative, you might use wipe at your own risk. Be aware that it is very difficult to assess whether running wipe on a given file will actually wipe it -- it depends on an awful lot of factors, such as : the type of file system the file resides on (in particular, whether the file system is a journaling one or not), the type of storage medium used, and the least significant bit of the phase of the moon.
Wiping over NFS or over a journalling filesystem (ReiserFS etc.) will most probably not work.
Therefore I strongly recommend to call wipe directly on the corresponding block device with the appropriate options. However THIS IS AN EXTREMELY DANGEROUS THING TO DO. Be sure to be sober. Give the right options. In particular : don't wipe a whole harddisk (eg. wipe -kD /dev/hda is bad) since this will destroy your master boot record. Bad idea. Prefer wiping partitions (eg. wipe -kD /dev/hda2) is good, provided, of course, that you have backed up all necessary data.
With this option which requires an argument you can specify an alternate /dev/random device, or a command who's standard output will be hashed using MD5-hashed. The distinction can be made using the -S option.
This option takes a single-character argument, which specifies how the random device/random seed argument is to be used. The default random device is /dev/random. It can be set using the -R option.
The possible single-character arguments are:
During the random passes, wipe overwrites the target files with a stream of binary data, created by the following choice of algorithms:
In all cases the PRNG is seeded with the data gathered from the random device (see -R and -S options).
20K33 = 20480+33 = 20513
114M32K = 114*1024*1024+32*1024.
Regular files will be wiped with 34 passes and their sizes will then be halved a random number of times. Special files (character and block devices, FIFOs...) will not. All directory entries (files, special files and directories) will be renamed 10 times and then unlinked. Things with inappropriate permissions will be chmod()'ed (option -c). All of this will happen without user confirmation (option -f).
Wipe should work on harddisks and floppy disks; however the internal cache of some harddisks might prevent the necessary writes to be done to the magnetic surface. It would be funny to use it over NFS. Under CFS (Cryptographic File System) the fsync() call has no effect; wipe has not much use under it anyway - use wipe directly on the corresponding encrypted files. Also, under Linux, when using a device mounted thru a loopback device, synchronous I/O does not get propagated cleanly.
For wiping floppy disks, at least under Linux, there is no way, besides obscure floppy-driver specific ioctl's to determine the block size of the disk. In particular, the BLKGETSIZE ioctl is not implemented in the floppy driver. So, for wiping floppies, you must specify the size of the floppy disk using the -l option, as in the last example. This option is normally not needed for other fixed block devices, like IDE and SCSI devices.
File name wiping is implemented since version 0.12. I don't know how efficient it is. It first changes the name of the file to a random- generated name of same length, calls sync (), then changes the name to a random-generated name of maximal length.
File size wiping is implemented by repeatedly truncating the file to half of its size, until it becomes empty; sync () is called between such operations.
Note that it is still not possible to file creation date and permission bits portably. A wipe utility working at the block device level could be written using the ext2fs library.
Wipe was written by Berke Durak (to find my email address, just type echo berke1ouvaton2org|tr 12 @. in a shell).
Wipe is released under the conditions of the GNU General Public License.
/dev/random is used by default to seed the pseudo-random number generators.
WIPE_SEEDPIPE If set, wipe will execute the command specified in it (using popen()), and will hash the command's output with the MD5 message-digest algorithm to get a 128-bit seed for its PRNG. For example, on systems lacking a /dev/random device, this variable might be set in /etc/profile to a shell script which contains various commands such as ls, ps, who, last, etc. and which are run asynchronously in order to get an output as less predictable as possible.
open(2), fsync(2), sync(8), bdflush(2), update(8), random(3)
Sun Nov 7 09:41:23 EST 2010 | Linux |