6

Ok, so i have opened usb drives before and i understand that they use generic MCU's to control the NAND flash storage. What I was thinking was if one could reprogram them to say, start an application upon insertion into a USB port, then it could be useful for a multitude of applications (such as copying files automatically). I understand that different MCU's may/may not use completely different ASM code, but there is also the problem of how to even communicate with it (i.e. the protocol and such). Could this be possible? I have heard of things like MP Tools which (in theory) can low-level format and reset the drive to factory default, but not edit any of the code used on it.

  • An fpga for a flash drive would be awfully expensive, and a bit of a waste, are you sure that is what they use? And where did the microcontroller come from? How is that associated with the fpga or the usb drive or the flash? – old_timer Jun 26 '13 at 04:39
  • My bad, i'm not sure whether or not it is an FPGA or a microcontroller (perhaps it is an fpga in some and a microcontroller in others). – Antonio Escalera Jun 26 '13 at 04:51
  • After some research, I believe that it is microcontrollers that are used because, as you stated, an fpga would be a waste. The specific MCU I am looking at to use is this one: http://www.alcormicro.com/en_content/c_product/product_02b.php?CategoryID=3&IndexID=12 which came in a duracell 8gb flash drive. These MCU's are the ones that are in the hacked ebay drives, so clearly someone has figured it out. – Antonio Escalera Jun 26 '13 at 05:07
  • a microcontroller seems overkill as well but I will look at your link, I wouldnt be surprised if it is a one time programmable... – old_timer Jun 26 '13 at 13:15
  • Here is a project for altering USB flash drive firmware (but only compatible with specific Phison USB flash drive chipsets): https://github.com/brandonlw/Psychson – moo Apr 02 '20 at 12:53

2 Answers2

6

What I was thinking was if one could reprogram them to say, start an application upon insertion into a USB port, then it could be useful for a multitude of applications (such as copying files automatically).

You are mistaken. When you reprogram a USB flash microcontroller, you cause a program to run inside the USB flash stick. You do NOT cause any program to run on the computer's main processor. The USB flash stick's processor only interacts with the main computer by responding to USB transactions initiated by the USB host controller in the main computer, which is under the control of the OS.

In effect, your capabilities are limited to changing what kind of USB device it is reported as (mass storage or imaging or network or ...) and changing the content of the data returned when the computer does a read from the USB stick.

Ben Voigt
  • 277,958
  • 43
  • 419
  • 720
0

No. Most controllers used in USB flash drives are not reprogrammable, or some or all of the pins necessary to reprogram them are not exposed.

Opening an application when the drive is inserted is a behavior which is part of Windows; it is triggered by the presence of a file (autorun.ini) on the drive with specific content.

  • 1
    Autorun/autoplay doesn't actually start a program (from the removable media) on any Windows version released in the last 12 years (it merely causes a dialog to appear suggesting that the user may wish to run the program) – Ben Voigt Jun 26 '13 at 05:24
  • I have done those silly autorun things before from USB devices, however if one could find a way to get the CD emulation from those U3 smart drives, that could work with autorun... – Antonio Escalera Jun 26 '13 at 05:35
  • 2
    Actually, most of flash drives *are* reprogrammable with special vendor tools which use custom USB commands from the host. – Igor Skochinsky Jun 26 '13 at 11:20
  • Hmmmm. Any Ideas as to how one can obtain such tools? – Antonio Escalera Jun 26 '13 at 14:36
  • @Igor Would these be the MP Tools? – Antonio Escalera Jun 26 '13 at 21:18
  • @AntonioEscalera: [here's](http://flashboot.ru/files/) one of the biggest collections. Use [this](http://flashboot.ru/files/file/362/) to detect the controller model. – Igor Skochinsky Jun 26 '13 at 21:32
  • These are the MP Tools I had referenced earlier, however they do not allow custom code. Perhaps some reverse engineering is in order. – Antonio Escalera Jun 27 '13 at 00:27
  • Aha! There are some that allow you to make CD emulated partitions/things for the autorun (flaw) in windows. Thanks! – Antonio Escalera Jun 27 '13 at 00:33