newLISP Fan Club

Forum => Anything else we might add? => Topic started by: ax0n on February 08, 2007, 12:03:36 PM

Title: Any way to secure-erase a file?
Post by: ax0n on February 08, 2007, 12:03:36 PM
Is there any way to securely erase a file in place with newLISP?  I mean, a way to access the actual blocks on the device to make sure that you are over-writing the location where the file was stored, instead of simply making a new file with the same time?
Title:
Post by: Lutz on February 08, 2007, 12:28:25 PM
this utiity would write random characters into the file before deleting it, the script also checks for the existence of the file.


#!/usr/bin/newlisp

(set 'file (main-args 2))

(if (file? file)
    (set 'size (file-info file 0))
    (exit))

(set 'handle (open file "update"))
(for (i 0 size)
    (write-char handle (rand 255)))
(close handle)

(delete-file file)

(exit)


Lutz
Title:
Post by: nigelbrown on February 08, 2007, 02:25:47 PM
Actually wiping data can be quite complex e.g. see http://www.usenix.org/publications/library/proceedings/sec96/full_papers/gutmann/ . And smart drives with cache and file systems that will sideline old data and write a new block under some conditions are problematical.

It depends on how secure you want to put the effort in to become.

Maybe call a proven utility to do it.

Nigel
Title:
Post by: ax0n on February 08, 2007, 02:32:06 PM
Quote from: "nigelbrown"Actually wiping data can be quite complex e.g. see http://www.usenix.org/publications/library/proceedings/sec96/full_papers/gutmann/ . And smart drives with cache and file systems that will sideline old data and write a new block under some conditions are problematical.

It depends on how secure you want to put the effort in to become.

Maybe call a proven utility to do it.

Nigel


I know the problems, it's kind of why I asked.  Simply writing data to a file before erasing won't always overwrite the physical location on the disk.  Matter of fact, it usually won't overwrite those blocks, it will just write the file out wherever convenient and change the catalog to match.



I have a whole host of "wipe" utilities at my disposal.
Title:
Post by: cormullion on February 08, 2007, 02:51:33 PM
well this is probably over my head, but there's srm on MacOS X:


(exec "srm /Users/me/Desktop/secret.txt")

There's some fun-looking options -

-m, --medium
              overwrite the file with 7 US DoD compliant passes  (0xF6,  0x00,              0xFF, random, 0x00, 0xFF, random)


I just wish I had something secret enough to be worth deleting so completely. :-)
Title:
Post by: ax0n on February 08, 2007, 05:16:13 PM
That's nice, I'm actually using OS X most of the time.  I didn't realize it had that feature.  And actually Wietse Venema (I think it was him) said that absolutely no software could ever recover data that was simply overwritten one time.  Data recovery methods beyond that scale have to occur on an electron microscope.



In the other thread I've been posting in, you can see that I'm dealing with cryptography (simple, but cryptography all the same).  So it's not that I have anything to hide or worth hiding, however, remnants of the files related to the encryption can create a vulnerability if recovered from media.
Title:
Post by: nigelbrown on February 09, 2007, 06:40:47 AM
Quote from: "ax0n" however, remnants of the files related to the encryption can create a vulnerability if recovered from media.


Perhaps you could use newlisp to generate a few thousand decoy files ( a few hundred megs total to flood disk cache) then delete them so that the deleted remnants are buried in the deleted dross. A bit like "Chaffing and Winnowing: Confidentiality without Encryption" http://theory.lcs.mit.edu/~rivest/chaffing.txt .



Nigel
Title:
Post by: newdep on February 09, 2007, 07:09:24 AM
It all depends on your Filesystem type..



In some unix environments you dont want to try and recover lost files

because the OS already took care of reassigning the I-nodes that came free..(I-nodes are the main key here, thats why recovering files on i.e. Linux ext2 ext3 is a hard thing to do..)



So perhaps you dont even need to cover them up after all ;-)