Skip to contentSkip to conversation

Is erasing hard disk drive mandatory?

dm-crypt Kenny Lake 7 participants 17 messages May 29, 2014 – May 31, 2014

lore
Share & tools
lore

Kenny Lake

author
#0 lore raw

If I want to create an encrypted volume, over a disk drive where there were no sensible data or there was another encrypted volume, can i skip the erasing procedure or will compromise the security of the new encrypted volume?

#1 lore raw

First, I presume this is about wiping the raw volume with cryptographically striong randomness, or wriping the new encrypted volume with anything (e.g. zeros). These two come down to the same effect on the raw volume.

Erasing is not recommended to remove any data that was there before (if you want that, you must erase, but it is a separate thing). Erasing is recommended to make it non-transparent where data was written in the encrypted volume. If you care, then you need to erase.

Arno

Quoted 9 lines · Kenny Lake

If I want to create an encrypted volume, over a disk drive where there were no sensible data or there was another encrypted volume, can i skip the erasing procedure or will compromise the security of the new encrypted volume?

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 4 lines
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: [email protected]
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -  Plato
#16 lore raw
In reply to Kenny Lake

Hey Kenny,

If you do skip over the erase during configuration, you can get the same effect of by causing the filesystem to write to every block --

dd if=/dev/zero of=uselessjunk ; \rm uselessjunk

Of course, you also need to fill up the inode tables, otherwise your disk may tell how many files are on the disk. Make lots of files.

If you're paranoid, or have a need to irritate security experts, use /dev/urandom instead of /dev/zero.

&:-)

Quoted 5 lines · On Thu, 29 May 2014 14:33:23 +0100 (BST) Kenny Lake <[email protected]>…

If I want to create an encrypted volume, over a disk drive where there were no sensible data or there was another encrypted volume, can i skip the erasing procedure or will compromise the security of the new encrypted volume?

Signature · 1 line
Thousands of years to mess up six days' work, and we're STILL not done
#2 lore raw
In reply to Arno Wagner

I've been curious about the random data step for a while. I created an array made up of dm-crypted disks but I didn't do this step. The disks did have some data on them but not necessarily random data. What is the functional purpose of writing random data to the disk prior to encrypting them? Does the encryption process use existing data from the disk as part of it's encryption method? What would happen if dm-crypt was used on a completely blank disk?

Thanks,

Steve

Quoted 36 lines · Arno Wagner

First, I presume this is about wiping the raw volume with cryptographically striong randomness, or wriping the new encrypted volume with anything (e.g. zeros). These two come down to the same effect on the raw volume.

Erasing is not recommended to remove any data that was there before (if you want that, you must erase, but it is a separate thing). Erasing is recommended to make it non-transparent where data was written in the encrypted volume. If you care, then you need to erase.

Arno

Quoted 3 lines · Kenny Lake

If I want to create an encrypted volume, over a disk drive where there were no sensible data or there was another encrypted volume, can i skip the erasing procedure or will compromise the security of the new

encrypted

Quoted 6 lines

volume?

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

--
Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: [email protected]
GnuPG: ID: CB5D9718 FP: 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. - Plato
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 5 lines
________________________________________________________________
 Steve Cousins             Supercomputer Engineer/Administrator
 Advanced Computing Group            University of Maine System
 244 Neville Hall (UMS Data Center)              (207) 561-3574
 Orono ME 04469                      steve.cousins at maine.edu
#3 lore raw

If you put an encrypted volume on a blank disk, anybody getting access to the raw disk can tell where (whcih secotrs) data was written to. That can represent a hidden channel that leaks information.

Arno

Quoted 65 lines · Stephen Cousins

I've been curious about the random data step for a while. I created an array made up of dm-crypted disks but I didn't do this step. The disks did have some data on them but not necessarily random data. What is the functional purpose of writing random data to the disk prior to encrypting them? Does the encryption process use existing data from the disk as part of it's encryption method? What would happen if dm-crypt was used on a completely blank disk?

Thanks,

Steve

Quoted 36 lines · Arno Wagner

First, I presume this is about wiping the raw volume with cryptographically striong randomness, or wriping the new encrypted volume with anything (e.g. zeros). These two come down to the same effect on the raw volume.

Erasing is not recommended to remove any data that was there before (if you want that, you must erase, but it is a separate thing). Erasing is recommended to make it non-transparent where data was written in the encrypted volume. If you care, then you need to erase.

Arno

Quoted 3 lines · Kenny Lake

If I want to create an encrypted volume, over a disk drive where there were no sensible data or there was another encrypted volume, can i skip the erasing procedure or will compromise the security of the new

encrypted

Quoted 6 lines

volume?

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

--
Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: [email protected]
GnuPG: ID: CB5D9718 FP: 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. - Plato
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 10 lines
________________________________________________________________
 Steve Cousins             Supercomputer Engineer/Administrator
 Advanced Computing Group            University of Maine System
 244 Neville Hall (UMS Data Center)              (207) 561-3574
 Orono ME 04469                      steve.cousins at maine.edu

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt
Signature · 4 lines
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: [email protected]
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -  Plato
#4 lore raw

I see. So it has nothing to do with how well the data is encrypted. Just another level of protection as far as the scale of work someone would have to try to crack it if it looked like the whole disk was encrypted vs. just the actual data that had been written.

Thanks,

Steve

Quoted 90 lines · Arno Wagner

If you put an encrypted volume on a blank disk, anybody getting access to the raw disk can tell where (whcih secotrs) data was written to. That can represent a hidden channel that leaks information.

Arno

Quoted 2 lines · Stephen Cousins

I've been curious about the random data step for a while. I created an array made up of dm-crypted disks but I didn't do this step. The disks

did

Quoted 6 lines

have some data on them but not necessarily random data. What is the functional purpose of writing random data to the disk prior to encrypting them? Does the encryption process use existing data from the disk as part of it's encryption method? What would happen if dm-crypt was used on a completely blank disk?

Quoted 22 lines

Thanks,

Steve

Quoted 15 lines · Arno Wagner

First, I presume this is about wiping the raw volume with cryptographically striong randomness, or wriping the new encrypted volume with anything (e.g. zeros). These two come down to the same effect on the raw volume.

Erasing is not recommended to remove any data that was there before (if you want that, you must erase, but it is a separate thing). Erasing is recommended to make it non-transparent where data was written in the encrypted volume. If you care, then you need to erase.

Arno

Quoted 1 line · Kenny Lake

If I want to create an encrypted volume, over a disk drive where

there

Quoted 1 line
Quoted 1 line
Quoted 1 line

were no sensible data or there was another encrypted volume, can i

skip

Quoted 4 lines
Quoted 4 lines
Quoted 1 line

the erasing procedure or will compromise the security of the new

encrypted

Quoted 1 line

volume?

Quoted 8 lines
Quoted 8 lines
Quoted 4 lines

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

--
Arno Wagner, Dr. sc. techn., Dipl. Inform., Email:

[email protected]

Quoted 1 line
Quoted 1 line

GnuPG: ID: CB5D9718 FP: 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D

9718

Quoted 17 lines
Quoted 7 lines

----
A good decision is based on knowledge and not on numbers. - Plato
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

--
________________________________________________________________
Steve Cousins Supercomputer Engineer/Administrator
Advanced Computing Group University of Maine System
244 Neville Hall (UMS Data Center) (207) 561-3574
Orono ME 04469 steve.cousins at maine.edu

Quoted 4 lines

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

--
Arno Wagner, Dr. sc. techn., Dipl. Inform., Email: [email protected]
GnuPG: ID: CB5D9718 FP: 12D6 C03B 1B30 33BB 13CF B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. - Plato
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 5 lines
________________________________________________________________
 Steve Cousins             Supercomputer Engineer/Administrator
 Advanced Computing Group            University of Maine System
 244 Neville Hall (UMS Data Center)              (207) 561-3574
 Orono ME 04469                      steve.cousins at maine.edu
#5 lore raw
Quoted 2 lines · Stephen Cousins

I see. So it has nothing to do with how well the data is encrypted. Just another level of protection..

Maybe. I think the practical effects are negligible. With the first minutes of use of such a disk, temporary files get written to it, files get deleted, new ones get written and old stuff gets overwritten. If the encryption is secure, all that doesn't really matter.

#6 lore raw

Hi Heinz,

I agree. The field, by it's very nature, has varying levels of paranoia (rightly so as we are seeing these days) and this level is more than what I need for my purposes so I can save some time by not having to send random data to all of the drives during the build process.

Steve

Quoted 16 lines · Heinz Diehl
Quoted 2 lines · Stephen Cousins

I see. So it has nothing to do with how well the data is encrypted. Just another level of protection..

Maybe. I think the practical effects are negligible. With the first minutes of use of such a disk, temporary files get written to it, files get deleted, new ones get written and old stuff gets overwritten. If the encryption is secure, all that doesn't really matter.

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 5 lines
________________________________________________________________
 Steve Cousins             Supercomputer Engineer/Administrator
 Advanced Computing Group            University of Maine System
 244 Neville Hall (UMS Data Center)              (207) 561-3574
 Orono ME 04469                      steve.cousins at maine.edu
#7 lore raw
Quoted 9 lines · Stephen Cousins

Hi Heinz,

I agree. The field, by it's very nature, has varying levels of paranoia (rightly so as we are seeing these days) and this level is more than what I need for my purposes so I can save some time by not having to send random data to all of the drives during the build process.

Steve

I tend to do the erase pass because it doesn't have a performance cost on hard drives. On SSD's though, this would prevent TRIM from functioning properly and make the SSD appear as full to the controller which would hurt performance. So I tend to not erase SSDs with random data before encryption. The other thing is if you TRIM NAND cells on your SSD their contents should be unrecoverable as opposed to standard hard-drives.

--
Thomas

#8 lore raw
Quoted 3 lines · Thomas Bastiani

On SSD's though, this would prevent TRIM from functioning properly and make the SSD appear as full to the controller which would hurt performance.

If you e.g. do a "dd if=/dev/urandom of=bigfile" to a SSD drive until the partition is fully overwritten, simply deleting "bigfile" followed by a "fstrim" should restore performance to the same level as is was before. What am I missing?

#9 lore raw
Quoted 11 lines · Heinz Diehl
Quoted 3 lines · Thomas Bastiani

On SSD's though, this would prevent TRIM from functioning properly and make the SSD appear as full to the controller which would hurt performance.

If you e.g. do a "dd if=/dev/urandom of=bigfile" to a SSD drive until the partition is fully overwritten, simply deleting "bigfile" followed by a "fstrim" should restore performance to the same level as is was before. What am I missing?

Your first step is to dd if=/dev/urandom of=/dev/sd<x> or an equivalent operation. This is before you even create an encrypted container and definitely below your file system... It may be that files that you create and then delete will trigger a TRIM operation if dm-crypt (and eventually LVM) are configured to pass TRIM through. But the rest of your "securely erased" drive is still not TRIM-ed.

And also it doesn't make sense to configure dm-crypt to pass TRIM (with --allow-discards) if you've written random data to your drive at creation time because then you introduce another different type of side-channel leak.

Does that make sense?

--
Thomas

#10 lore raw
Quoted 4 lines · Thomas Bastiani

It may be that files that you create and then delete will trigger a TRIM operation if dm-crypt (and
eventually LVM) are configured to pass TRIM through. But the rest of your "securely erased" drive is still not TRIM-ed.

As far as I know, mkfs discards blocks while creating the filesystem. So your device should be "overwritten" at that stage of the process?

(I for myself never do any overwriting of harddisks, I've just asked out of sheer curiosity).

#11 lore raw
Quoted 10 lines · Heinz Diehl
Quoted 4 lines · Thomas Bastiani

It may be that files that you create and then delete will trigger a TRIM operation if dm-crypt (and
eventually LVM) are configured to pass TRIM through. But the rest of your "securely erased" drive is still not TRIM-ed.

As far as I know, mkfs discards blocks while creating the filesystem. So your device should be "overwritten" at that stage of the process?

Oh cool. I had no idea. So then it would make the whole dd operation useless if you pass --allow-discards to cryptsetup.

--
Thomas

#15 lore raw
In reply to Stephen Cousins

It requires psecific attack situations. For example, some application could write data in a specific pattern that would then be visible in the raw container. Or you could determine the size of some files or the type of the filesystem.

Not anything usually critical, but something to keep in mind and when being careful the crypto-wipe step is advisible.

Arno

Quoted 42 lines · Stephen Cousins

Hi Heinz,

I agree. The field, by it's very nature, has varying levels of paranoia (rightly so as we are seeing these days) and this level is more than what I need for my purposes so I can save some time by not having to send random data to all of the drives during the build process.

Steve

Quoted 16 lines · Heinz Diehl
Quoted 2 lines · Stephen Cousins

I see. So it has nothing to do with how well the data is encrypted. Just another level of protection..

Maybe. I think the practical effects are negligible. With the first minutes of use of such a disk, temporary files get written to it, files get deleted, new ones get written and old stuff gets overwritten. If the encryption is secure, all that doesn't really matter.

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 10 lines
________________________________________________________________
 Steve Cousins             Supercomputer Engineer/Administrator
 Advanced Computing Group            University of Maine System
 244 Neville Hall (UMS Data Center)              (207) 561-3574
 Orono ME 04469                      steve.cousins at maine.edu

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt
Signature · 4 lines
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: [email protected]
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -  Plato
#12 lore raw
In reply to Thomas Bastiani

You're all missing a very important point. Have a read of
http://embeddedsw.net/doc/physical_coercion.txt (a reference on
http://en.wikipedia.org/wiki/Deniable_encryption) and think about if you want some random data at the end of your drive that you can't decrypt.

Signature · 1 line
Laurence
Quoted 21 lines · Thomas Bastiani
Quoted 10 lines · Heinz Diehl
Quoted 4 lines · Thomas Bastiani

It may be that files that you create and then delete will trigger a TRIM operation if dm-crypt (and
eventually LVM) are configured to pass TRIM through. But the rest of your "securely erased" drive is still not TRIM-ed.

As far as I know, mkfs discards blocks while creating the filesystem. So your device should be "overwritten" at that stage of the process?

Oh cool. I had no idea. So then it would make the whole dd operation useless if you pass --allow-discards to cryptsetup.

--
Thomas
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

#13 lore raw

If you do this right (zero wipe within the opened encrypted container, as described in FAQ Item 2.19), then you can decrypt this data to zeros.

Unfortunately, given the frequency that people ask about "hidden encrypted voluems" here and are completely unaware of the danger they put themselves in, I thinks educating people about this risk is a lost cause.

Arno

Quoted 39 lines · Laurence Darby

You're all missing a very important point. Have a read of
http://embeddedsw.net/doc/physical_coercion.txt (a reference on
http://en.wikipedia.org/wiki/Deniable_encryption) and think about if you want some random data at the end of your drive that you can't decrypt.

Signature · 1 line
Laurence
Quoted 15 lines · Thomas Bastiani
Quoted 10 lines · Heinz Diehl
Quoted 4 lines · Thomas Bastiani

It may be that files that you create and then delete will trigger a TRIM operation if dm-crypt (and
eventually LVM) are configured to pass TRIM through. But the rest of your "securely erased" drive is still not TRIM-ed.

As far as I know, mkfs discards blocks while creating the filesystem. So your device should be "overwritten" at that stage of the process?

Oh cool. I had no idea. So then it would make the whole dd operation useless if you pass --allow-discards to cryptsetup.

Quoted 6 lines

--
Thomas
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 4 lines
Arno Wagner,     Dr. sc. techn., Dipl. Inform.,    Email: [email protected]
GnuPG: ID: CB5D9718  FP: 12D6 C03B 1B30 33BB 13CF  B774 E35C 5FA1 CB5D 9718
----
A good decision is based on knowledge and not on numbers. -  Plato
#14 lore raw
In reply to Thomas Bastiani
Quoted 5 lines · Thomas Bastiani
Quoted 2 lines

As far as I know, mkfs discards blocks while creating the filesystem. So your device should be "overwritten" at that stage of the process?

Oh cool. I had no idea. So then it would make the whole dd operation useless if you pass --allow-discards to cryptsetup.

I think so. At least mkfs.xfs, mkfs.ext4 and mkfs.btrfs are discarding blocks while creating the fs. Don't know about other fs.