Electronic – Is it possible to read erased flash memory

hard drivenand-flashnon-volatile-memorysdSecurity

In hard disks, a "quick format" does nothing to the actual data on the disk – just clears the FAT (file allocation table), which then appears as a "blank disk" to the user. Therefore, it is fairly easy to ignore the FAT and read that data. Although it is tricky to read specific data, as there are no indicators to where a particular file begins and ends. Some format commands even save a backup of the FAT table, and restoring this backup manifests as the "unformat" feature.

A long-format of a hard disk does reset most of the data, which would seem to eliminate the possibility of reading said data – except for a characteristic inherent to magnetic storage media: hysteresis. When a bit is set or cleared on a hard disk, the process is not 100.00% accurate, as the media exhibits hysteresis. So some small amount of residual magnetism remains from the previous operation, and certain software tools can be used to scan areas of the disk (many times) to read that fraction of a percent of latent magnetization and "recover" this overwritten data.

But how do today's solid-state non-volatile memories fare? Thumb drives, SSD's, NAND Flash? The only relevant information I could find about their security and vulnerability is in this Wikipedia article which states:

In addition, deleted files on SSDs can remain for an indefinite period of time before being overwritten by fresh data; erasure or shred techniques or software that work well on magnetic hard disk drives have no effect on SSDs, compromising security and forensic examination.

Wait, what? These seem to be two completely different statements – the first implying that long-formats are never done and Flash therefore is always susceptible to my first paragraph's vulnerability. This can't be, correct? As I can "long format" a thumb drive or SSD, or instruct a uC to overwrite every block of a NAND Flash. And since wear-leveling places blocks somewhat randomly, I'd assume which blocks get overwritten to be rather random as well. So perhaps not all of a file would be overwritten in time, but some of it seems highly likely.

It also states that erasure or shred techniques do not work on Flash which I find hard to believe. As long as every allocation unit were overwritten, that would make any data completely un-recoverable, correct?

How this applies to EE.SX: Imagine a NAND Flash with several crypto key pairs on it. If the chassis is opened, the device is erased, so nobody can "get" the keys. But is an "erase" enough?

That said, are nonvolatile flash memories susceptible to any type of data recovery technique? Is there any electrical field hysteresis to leverage for recovering overwritten data?

Best Answer

The problem with secure erase is that the device has a translation layer in it. On a disk, writing to cylinder X sector Y will always overwrite the same area. On an SSD, the device firmware maintains a list of blank blocks and writes to the next one available, maintaining a table mapping logical addresses to actual flash blocks. There is usually a bit more flash than the stated capacity as spares, so a complete write may not touch every block. Erasing blocks is slow, so they are not erased immediately, and maybe not erased until space is short.

Drive firmware may offer three possible solutions to this. One is TRIM: tell the drive which blocks do not have filesystem data in, and let it preemptively erase them. One is a specific "secure erase" command, which should actually erase all the blocks (but takes a long time). And one is transparent block-level encryption, where asking the drive to discard the key instantly loses all the data. However, you're hostage to how well this has been implemented and there may be bugs.

I'm not aware of techniques for recovering data from flash cells that have actually been erased. (In fact it may lose bits spontaneously, so error correction is built in).