public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Ferber <aferber@techfak.uni-bielefeld.de>
To: linux-kernel@vger.kernel.org
Cc: Matt Gauthier <elleron@yahoo.com>
Subject: Re: secure erasure of files?
Date: Tue, 12 Feb 2002 16:55:04 +0100	[thread overview]
Message-ID: <20020212165504.A5915@devcon.net> (raw)
In-Reply-To: <Pine.LNX.4.30.0202121409150.18597-100000@mustard.heime.net> <Pine.LNX.4.33.0202121438560.7616-100000@unicef.org.yu>
In-Reply-To: <Pine.LNX.4.33.0202121438560.7616-100000@unicef.org.yu>; from zdavid@unicef.org.yu on Tue, Feb 12, 2002 at 02:41:19PM +0100

On Tue, Feb 12, 2002 at 02:41:19PM +0100, Davidovac Zoran wrote:

(srm maintainer cc'ed)

> there is srm (secure rm) somewhere on the net
> here srm.sourceforge.net
> srm - secure file deletion for posix systems

Broken as designed, it simply /can't/ work reliably (not to mention
the other comments that you can even recover data overwritten multiple
times).

Nothing stops the kernel (or the filesystem for that matter) from
shuffling around disk blocks while you are overwriting the file. You
may end up overwriting other disk blocks than the data you want to
hide lives in if the filesystem decides that your file may fit better
into other blocks, which leaves the original data completely intact.

I don't know if any filesystem currently relocates blocks if you
overwrite a file, but it's certainly possible and allowed (everything
else except the filesystem itself simply must not care where the data
actually ends up on the disk).

In addition to the design breakage, the current implementation of srm
is simply crap. Here is the part actually overwriting the file:

---------- snip ----------
  int i = 0;

  lseek(file, 0, SEEK_SET);
  while (i < file_size - buffsize)
    i += write(file, buffer, buffsize);
  write(file, buffer, file_size - i);
---------- snip ----------

Guess what happens if you try to srm a file longer than INT_MAX bytes?
And what if write() returns an error? Ghee, overwriting the file
backwards from the beginning, until infinity? Impressive...

Ah, and look at rename_unlink(): it tries to "overwrite" the
original filename with random characters. It does this by generating a
new 14 character random filename and rename()ing the file to that name
(keeping it in the same directory). Well, for example on plain stupid
(no pun ;-) ext2fs there are /many/ situations where the new directory
entry ends up in a totally different place than the old one (e.g. a
filename shorter than 14 characters if there is no free space around
the old direntry).

Well, enough for now...

Andreas
-- 
       Andreas Ferber - dev/consulting GmbH - Bielefeld, FRG
     ---------------------------------------------------------
         +49 521 1365800 - af@devcon.net - www.devcon.net

  parent reply	other threads:[~2002-02-12 15:55 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-02-12 13:12 secure erasure of files? Roy Sigurd Karlsbakk
2002-02-12 13:41 ` Davidovac Zoran
2002-02-12 14:03   ` Padraig Brady
2002-02-12 15:55   ` Andreas Ferber [this message]
2002-02-12 19:47     ` Jan Hudec
2002-02-12 20:25       ` Andrew Morton
2002-02-13  0:03         ` Jeff Garzik
2002-02-13  9:33     ` Helge Hafting
2002-02-13 18:27       ` Mike Fedyk
2002-02-13  0:36 ` Tom Vier
2002-02-13  0:45   ` Jeff Garzik
2002-02-20 15:34 ` Bill Davidsen
     [not found] <200202121326.g1CDQct12086@Port.imtp.ilyichevsk.odessa.ua>
2002-02-12 13:33 ` Roy Sigurd Karlsbakk
2002-02-17 21:19   ` Jan-Frode Myklebust
2002-02-19 12:54     ` Jens Schmidt
2002-02-19 14:24       ` Richard B. Johnson
2002-02-21  2:56         ` Petro
2002-02-21  3:20           ` M. Edward Borasky
2002-02-21 17:01             ` Holger Lubitz
2002-02-26  3:39             ` Petro
  -- strict thread matches above, loose matches on Subject: below --
2002-02-12 21:14 Torrey Hoffman
2002-02-19 14:48 Roy Sigurd Karlsbakk
2002-02-19 17:32 ` Rogier Wolff
2002-02-19 17:59   ` Martin J. Bligh
2002-02-19 18:48     ` Rogier Wolff
2002-02-19 20:01       ` Andreas Dilger
2002-02-19 23:13 ` Roy Sigurd Karlsbakk
2002-02-19 16:19 Jesse Pollard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020212165504.A5915@devcon.net \
    --to=aferber@techfak.uni-bielefeld.de \
    --cc=elleron@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox