Saturday, June 1, 2013

How to Recover/Fix USB flash drives

I was trying to hack a USB flash drive encrypted and protected by --- when I learnt a number of things about USB flash drives:
  1. All USB flash drives have few main components
    1. The flash memory chips that store the data
    2. The controller that:
      1. Allows access to the data
      2. Lets any OS understand the kind of device being used
  2. Certain controllers can be manipulated to:
    1. Create partitions
    2. Hide partitions
    3. Decided Disk encoding (EXT3FS, FATX, FAT32, HFS, ZFS, ....you name it...)
    4. Encrypt content
    5. Masquerade (across OSes) as different type of storage devices (e.g. a CD-ROM)
Now all this sounds quite terribly dreary but really helps understand the steps that I followed:


  1. Unplugged all other devices from USB ports
  2. Plugged in the dead device...

    and made sure that it was detected and that the OS had loaded at least the mass storage device drivers.
    At this stage, if I tried to access the device or even format it, all I got was an error that told me that the OS could not read the memory on the device ...
    OS Access error

  3. To figure out the:

    1. The exact controller chip used
    2. The memory chips used
    3. State of the controller and the memory chips
      I downloaded and ran Chip Genius
      (You could download this software from:
      http://www.onlinedown.net/soft/67367.htm
      or
      http://en.kbdown.com/237488.html

      I told me that this device had a Silicon Motion SM3255AB controller
      Chip Genius to identify the controller

  4. Next, I downloaded the  SMI 3255AB controller tool from http://dl.mydigit.net/special/up/smi.html
    (If you have a different controller you'll have to search and get the relevant controller)
  5. Running the tool I could see that the memory was accessible and so I could now try flashing the controller back to a default state.
    SMI Controller Tool - Initial Interface
  6.  
  7. Next I clicked the space bar to run the tool and it ran a pretest and formatted the drive thus...
    SMI Controller Tool - Flashing
    SMI Controller Tool - Flashing Complete

    OS has remounted the device and shows it empty and functional
  8. Now, I wanted to make a few low level changes so I clicked Settings (Password in most SMI controller tools is 320) and here is what you would see... (Click Ok once you are done tweaking and then run the flashing process again. Be careful and aware of what you do since it can do nasty things to the device :) )
References:
This solution would not have been possible without the painstaking recording of procedures and facts by a number of sites. Here are some that made my life easier and got more than one USB driver working:

Offline or Standalone Installers

All the software providers conveniently assume that all of us are always connected to awesomely quick internet connections. When installing or updating machines it is horribly ineffective to download the small installers and then have them download the (usually much larger) actual installers. 

Here is a list of links from where you can download the offline or standalone installers of a number of commonly used software and plugins: