How To Immunize USB Flash Drive Against Autorun Viruses

Introduction To Autorun
Autorun is a Windows feature which allows automatic installation of applications from CD/DVD, USB flash drives, external hard disks or any other removable storage media. However, when Microsoft introduced this feature with Windows 95, it opened gates to a horde of malware which could now easily replicate itself using the Autorun.inf file. Autorun.inf is not a virus in itself. It is a file which contains settings for the Autorun feature. When you plug a USB flash drive into an infected computer, the virus copies itself to the pen drive, while creating an autorun.inf file in the process. When this flash drive is plugged into another computer, the virus launches automatically and infects the computer.


Now, of course you could disable autorun on your computer, but what about all the other computers you don’t own. Flash drives are meant for sharing with friends and people in your life. They are continuously passed on, hopping from one computer to another. It’s not like you can go around messing with others belongings.
That’s why immunizing your pen drive(s) becomes essential. Here’s how to do it.

Immunizing USB Flash Drives
1. Open command prompt (cmd.exe).
2. Type your flash drive letter, for example if  it is E:, type ”E:” without quotes and press enter.
3. Type the following commands :

mkdir autorun.inf
attrib +h +r +s +a autorun.inf
cd autorun.inf
mkdir .\con\

4. Press Enter key and close the command prompt.

How Does It Work?
With the mkdir (make directory) command we created a folder named autorun.inf  in the root of pen drive so that virus can not create a file with the same name. “attrib +h +r +s +a autorun.inf” command makes the folder hidden(+h), read only(+r), system folder(+s) and turns it into an archive(+a), so that it is not easily targeted for deletion by virus. With the cd (change directory) command we enter inside the newly created folder autorun.inf. Again with the make directory command, we create a sub-folder named con. ”con” is one of the MS-DOS reserved words and as such a folder with the name ”con” can not be created or deleted without using command prompt. The only other way to delete such a folder is to format the entire drive. Since the sub-folder ”con” can’t be deleted, its parent folder autorun.inf  can not be deleted by virus as well.

Alternatively you can get Bitdefender USB Immunizer or Panda USB Vaccine to do the job for you. Get a list of similar software here.

4 thoughts on “How To Immunize USB Flash Drive Against Autorun Viruses

Leave a comment