Encrypting an SSD is a process that is sometimes warned should be done with caution. E.g. http://en.gentoo-wiki.com/wiki/DM-Crypt_with_LUKS mentions how the SSD may keep hidden space used for wear leveling where arbitrary data may be stored at any given time, such as overwritten data.

My question is as follows: Is not this attack scenario exclusive to cases where the SSD has previously at some point contained unencrypted sensitive data and only after this has been stored unencrypted, is the entire device encrypted? In other words, if the SSD never contained anything besides encrypted data since it was new, what does it matter what (encrypted) data may or may not reside in this hidden space?

This seems pretty obvious to me can be just discarded if the SSD has always contained encrypted data, however am I missing something?

Assume that GNU/Linux with luks and 256-bit AES is used for any specific example, however are there any other software/SSD combinations in particular that are dangerous? It seems outrageous that the software would at any stage give the SSD unencrypted data.

  • Not sure about this, but I tend to agree. Commented Jan 7, 2013 at 8:28

3 Answers 3


Keep in mind that modern SSDs already encrypt your data at the firmware level, so that a reformat operation can be done simply by discarding the internal key, rather than wiping every sector. This doesn't mean your data is automagically encrypted at all times - the crypto is only used to fix the NAND-wear issue. However, it does mean that a proper firmware-level format operation renders the data on the disk entirely destroyed for all intents and purposes. If you're throwing away an SSD, I highly recommend using this option. Most major OSes recognise and support the appropriate firmware command, but use of it may differ - check the appropriate documentation.

As far as the wear-leveling spare sectors go, in practice you should be safe regardless of whether or not the stored data was encrypted. Due to the internal encryption, orphaned data blocks in wear-leveling areas shouldn't be recoverable, since the IVs and sibling blocks are destroyed / missing. However, this isn't to say that you might not be unlucky - it may well be that a few blocks of file data end up being kept, leading to a case where a small amount of plaintext is recoverable. It's difficult to say.

Ignoring the internal crypto for a moment, another interesting attack is related to old remnant blocks of ciphertext. If you encrypt a piece of data with a particular key and IV, then encrypt a new piece of data with the same key and IV, it may be possible to attack that data using differential cryptanalysis or other attacks. It also demonstrates active modification of certain areas of data, which may or may not be problematic for you depending on your threat scenario.

  • 1
    There might be some confusion here; "secure erase" and formatting are distinct activities. You do not get one by performing the other. By "reformat", you actually mean doing a special SSD-specific operation, not simply "formatting" some filesystems with the OS disk manager. Commented Jan 7, 2013 at 12:35
  • @ThomasPornin Yes, that's what I meant. There are tools to perform the secure delete operation for most major OSes.
    – Polynomial
    Commented Jan 7, 2013 at 12:37

On a Flash block, two operations are possible: convert one bit from 0 to 1, or reset the whole block to 0 (the roles of 0 and 1 can be swapped, of course). Each block sustains only a limited number of resets before failing, hence the "wear-leveling" which tries to spread the "reset" operations. Also, error-correcting codes are used to survive a few erroneous bits.

One possible wear-leveling algorithm (or part of a wider algorithm) is to inspect the rate of bit errors in every block when read; when the rate becomes too high (too close to the upper limit of what the error-correcting code can manage), the block is declared "failed" and the next reset operation on that block will instead be a "remap": another block, from the spare area, will be used thereafter. The consequence is that the data in the "failed" block remains there; it cannot be accessed logically (the SSD controller shows the remapped block, not this one) but it could be read by extracting the Flash chip and accessing it directly.

This means that OS-level strategies for wiping cannot be 100% effective.

Many (but not all) modern SSD implements a "secure erasing" feature, in which all data is encrypting with a random key, and when the machine asks for a secure erase, that key is changed. This is equivalent to destroying the data in all blocks, including the data in the now inaccessible blocks, so it is a very effective whole-disk wipe. Mileage may vary on how such a wipe can be triggered, though (by nature, formatting a partition does not trigger a whole-disk wipe, and altering the partition table does not usually do it either). Moreover, security of this process depends on the quality of the encryption used by the disk, which is not necessarily that great, and in any case very rarely documented (most vendors just say "AES" without any other precision). With OS-level encryption, you can have more control on which happens.

If every single data write which has ever occurred on a disk was using appropriate encryption (with a key which is not on the disk itself, of course), then yes, you can discard the disk without thinking anymore about it. The SSD "secure erase" feature MAY embody this concept, assuming that it does not botch the encryption part (but you can rarely make sure about that).


Encryption internal to SSDs seems to be seen by people as a security mechanism which is nonsense. As an owner, you have little to no access to specifications of what and how encryption is implemented (can be buggy or obsolete), no way to audit if what the manufacturer put is what is on paper (see accusations against Intel's rand), no control over encryption keys (you did not generate them and cannot examine them). If I am wrong on any points, please let me know.

Essentially we are talking about a black box with a sticker on it that says "PROPRIETARY" or "magic happens here". And a second sticker that says "trusted", probably invented by the PR department.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .