Donation Goal
Donate Now Goal amount for this year: 799 USD, Received: 100 USD (13%)
Please donate to help support this website. The funds will be used to purchase owned license of LiteSpeed Web Server Enterprise (2-CPU). It provides superior performance in terms of raw speed, scalability and anti-DDoS capabilities.

Create Fake Dummy File on USB Flash Drive to Enable Write Protect and Prevent Modification

Posted By Raymond In Category: Computer

Feb
17
2009

I carry my USB flash drive that contains a lot of portable tools with me all the time but I am afraid of one thing, which is a computer virus such as JambanMu or MaxTrox that is able to infect USB flash drives and bind itself to the executable files in there. So far there are only ways to disable writing to USB flash drive on your computer by editing the registry but if you plug it into a public computer which has virus, your USB flash drive will be writable and can be infected by virus. So is having a pendrive with a built-in write protect switch the only way to prevent the drive from virus infection?

Few days ago I found out about PenProtector which claims to protect all removable disks from additions of new files. PenProtector prevents the writing on pendrive of viruses, trojans, dialers and any other type of executable that would use the removable disk to replicate it self. PenProtector cost €3,90 and I bought a copy to see what it really does. From my observation, PenProtector creates a “block” file to fill up the remaining free space on the USB flash drive. When there is no space left on the removable drive, virus won’t be able to copy itself to to drive or infect any executable files.

PenProtector
Honestly, it is not worth buying PenProtector because there are a few FREE ways to write protect a USB flash drive by creating a fake dummy file to fill up the removable disks free space.


First, you have to know how much free space is left on the USB drive. Plug in the drive, go to My Computer, right click on the drive letter and select Properties. Take note of the “Free space” that is in bytes. My USB drive has 1,300,594,688 free space, so I will need to create a dummy file that has the exact file size.

Removable Drive Free Space
The best and easiest way is to use fsutil, a command line tool included in Windows. Open up command prompt from Start Menu > Accessories and type the following command:

fsutil file createnew F:\IamDummy 1300594688

fsutil file createnew
You will see that your USB flash drive’s LED is blinking meaning the file is being created. Now my pen drive has 0 free space and virus won’t be able to get in. You can change 1300594688 to the size that you want in bytes. F: is the letter of my USB flash drive and IamDummy is the file name. When you want to copy files into the USB removable drive, simply delete the dummy file. When you’re done, create the dummy file again using the fsutil command.

Write Protect USB Removable Drive
If you’re looking for a graphical tool to create dummy fake files, here are a few that I found. Some are slower, and some with NTFS restriction, so you might want to test it out to see which you prefer to use.

1. NOD32 Dummy File Creator
NOD32 Dummy File Creator
NOD32 Dummy File Creator Utility is meant to create dummy files in a specified folder to immunize a system against particular worms. Same concept as DiskHeal which creates autorun.inf file so the virus won’t have the chance to overwrite it. Supports setting file attributes (hidden, system, archive, read-only) to the dummy file on both NTFS and FAT drives.

2. DonationCoder’s Dummy File Creator (DFC)
Dummy File Creator
This tool is able to create dummy files of any arbitrary size filled with a specify hex byte value.

3. Nikko Dummy File Creator
Nikko Dummy File Creator
A simple program which creates files of any size with ease. This program also has a built-in random function, so users can choose to create either compressible or non-compressible files. Can create multiple fake files from batch list file.

Here is another example why you’d want to use these fake dummy file creators. To earn 1 point in RapidShare, we will need to upload a 5MB file for people to download. Let’s say you have a 3MB file and short of 2MB. Instead of searching for it on your hard drive or on the Internet, you can just create one yourself. You can also fool your friends by messing up their hard drive space, test drive transfer speed by moving dummy files, prevent data recovery by filling the free spaces and etc… I’m sure there are more.


Related posts:
  • Looking for a USB Flash Drive with Read Only or Write Protect Switch
  • Protect Windows from USB Flash Drive Viruses with USB Antivirus Mx One
  • How To Check and Test USB Flash Drive
  • How To Make a USB Flash Drive Bootable
  • Logon to Windows Using Your USB Flash Drive
    • shootingspy

      Very Useful Tool
      Thanks Raymond

    • Anton

      Very helpful Raymond.
      This is what I’ve been looking for.

    • koly

      Hi Raymond

      Nice tool. Thanks anyway …..

    • Prabhakar

      I think this will check all the virus from infecting the pen drives, great article…tx.

    • koko

      What if any of those portable programs needs to write on the flash drive?

    • Utkarsh

      Excellent tips Ray! Extremely useful

    • nikhil

      hey its gud but i had a problm my pen driv doesnt hav a write protect switch but it shows always protected what to do restore it…

    • Mark

      Great tool!!

      Thanks

    • http://www.ficforlife.com Hok

      If there any virus yet that it can search for dummies files and delete them?

    • Bolean

      mksparse in another one .

    • 1

      Wouldnt this reduce the lifespan of the drive?
      Also, i doubt it would be too hard to create a virus that deletes this, or other files, first.

    • grage

      nice idea! thnx raymond

    • Sony

      It might be efective but i dont see this as option for me, i cant imagine myself deleting and making dummy files 3+ a day everyday

    • kitni

      raymond, in case i want to move file into the pendrive , then i need to delete the dummy file. my question is, will the virus infects the pendrive at that time? thanks

    • Roy Raay

      Great tip mate, thanks!

    • http://agnipulse.com/ Bharat Balegere

      What if the virus deletes files on the USB ?
      Deleting or formatting is very easy.

    • billy13

      Thanks Ray!

    • Michael C.

      Nice. I like learning new dos commands and great tools too!!!

    • http://comon Sam Ahmed

      Raymond is funny

      what about a virus that deletes usb files ?

      lol

      Sam Ahmed
      Alexandria,Egypt.

    • http://www.raymond.cc/ Raymond

      Clearly some of you don’t know how does a virus infects a USB flash drive.

      If the virus deletes the files in USB drives, it is a destructive one and doesn’t infect the drive.

      But if the virus creates autorun.inf file in USB drives, it will try to do it silently without the user knowing it. It also doesn’t touch any of the files in the USB drives.

      So who is funnier now?

    • yousef

      thx ray…
      but i have a question , if my usb pen is protected from writing and some of my portable tool need to extract some file to run properly !?

    • Merlin_Magii

      I assume that you wouldn’t be able to defragment that flash drive until removing the dummy file first?

    • Sethoris

      @Raymond:
      What about kitnis question: \”raymond, in case i want to move file into the pendrive , then i need to delete the dummy file. my question is, will the virus infects the pendrive at that time? thanks\”

      Regards.

    • Junn

      Utilizing Windows’ native fsutil tool for the purpose is a brilliant idea. I wonder why almost all of us haven’t thought about it. Thanks a lot, Raymond!

    • Iskandar

      that’s rite..

      it’s two different thing Sam Ahmad… =)

    • mohan

      Every time we have to create & delete in USB which is Time consuming!
      But nice app to fool some one!

    • Hong Meng

      great way , thanks for the tip!

    • http://www.ankithere.co.cc akjbond007

      thankssssssssss ray ………..

      u r gr8 again,,,,,,,,,,,,,,,,,,,, :-)

    • Yuin

      Good Info ,thanks Raymond

    • Shibu

      Very useful tool. Thanks for the share, Raymond

    • yadafarin

      very good Idea.
      Can fsutil automatically get remaining space from Flash disk and Is there any batch commands to run this computation?

    • http://madhabspace.blogpsot.com sunkuamar space

      thanks this new information of us and great article

    • Ryan

      Already got one software that do this automatically. just put it at ur usb it will automatically calculate free space and fill it with dummy.

    • jeff parker

      this is very nice! i always thank you raymond!

    • http://khiang.wordpress.com khiang

      great tips, never think it be4 .. :)

    • miguel

      why not just use truecrypt it has a read-only option on mount

    • http://www.sudeep.net.np सुदीप ताम्राकार

      Thanks for the wonderful tips, this is what I am always looking for. thank you.

    • Nagesh

      Great idea and very good tip for carrying secure data. But you may not run potable appilications from your USB.!! Free space is required to create temp files to run portable application from usb drive.

    • Ajay

      Special Thanx for your wonderful service.
      I have been learning a lot from you.
      Keep up the good work.

    • Ace Slick

      Regarding…..’Raymond February 17th, 2009 at 11:52 pm’ My concern is that an antivirus program will automatically delete my “Hack Tools” I use to retrieve information ( RockXP, is often flagged and deleted, there are others). Still your ‘dummy’ file is cleaver.
      Cheers.

    • Martik

      This is one of the best article that I ever seen!

    • Sagar

      I have a very strange request from client. I would be very thankfull if someone could help me out.

      The scenario is: I have a server with some media file assigned to unique id’s and the server is conected to a series of USB flash drives port (20). Now, a user comes down & plugin his/her USB drive. Every USB drive has an .txt file, the .txt file names are nothing but the unique id’s which are already stored on server.

      Once the user plugin he’s/her USB drive, the server should be able to read the .txt file name(unique id) and get all the media files from the server and copy it to USB flash drive. Once its done we shouls close the port.

      Just to let you guys know, no monitor will be there and once we copy the files to USB it should intimate the User.

      I know it sounds strange. Again any help / direction would be truly appreciated.

      Thanks
      Sagar

    • alexovo

      Good tip. It is flawed, however, for large capacity drives (8GB or larger) with more than 4GB of free space. The reason? The FAT32 filesystem only supports files up to a few bytes less than 4GB. So if you have a 32GB flash drive with 20GB free, you would need to create multiple dummy files. Just a little annoying, but still entirely feasable.

    • John

      Good idea, I have the same conern regarding malware, but on top of that I know some AV products consider some of my portable security applications to be a risk and delete them. Unfortunately this doesn’t solve the delete issue

    • raj

      Use ansav anti virus , these USB virus are comming from asia so this ansav is created by asian and will recognize and solve all of yous usb misery

    • http://hackoo.ifrance.com/ Hackoo

      After reading this Article. I have this idea to create a good Trick in Vbscript.
      ‘—————-DummyFileCreator.vbs—————
      ‘Made by Hackoo
      ‘web site http://hackoo.ifrance.com
      Dim WshShell,FSO,Drv,Dtype,Dfree,DfreeMB,Dtot
      Dim Dname,Dpct,Dused,Dserial,Dinfo
      Set WshShell=WScript.CreateObject(“WScript.Shell”)
      Set FSO=CreateObject(“Scripting.FileSystemObject”)
      For each Drv in FSO.Drives
      If Drv.DriveType=0 Then Dtype=”Unknown ”
      If Drv.DriveType=1 Then Dtype=”Removable”
      If Drv.DriveType=2 Then Dtype=”Fixed ”
      If Drv.DriveType=3 Then Dtype=”Network ”
      If Drv.DriveType=4 Then Dtype=”CD-ROM ”
      If Drv.DriveType=5 Then Dtype=”RAM Disk ”
      If Drv.IsReady Then
      If Drv.DriveType=1 Then
      Dfree=Drv.FreeSpace
      DfreeMB=FormatNumber(Drv.FreeSpace/(1024^2),0)&” MB”
      Label=Drv.DriveLetter
      end if
      end if
      Next
      MsgBox “Espace Libre dans Le Flash Disk “&Label&”:\”&” est Environ de ” &DfreeMB,64,”Espace Libre”
      WshShell.run “cmd /c fsutil file createnew “&Label&”:\IamDummy ” &Dfree&”",0,True
      WshShell.Run “cmd /C attrib +h +s “&Label&”:\IamDummy”,0,TRUE
      ‘——————————————————-
      And This Code is used to delete The Fake Dummy File and so let you write into your pendrive.

      ‘—————-NoDummyFile.vbs—————-
      ‘Made by Hackoo
      ‘web site http://hackoo.ifrance.com
      Dim WshShell,FSO,Drv,Dtype,Dfree,DfreeMB,Dtot
      Dim Dname,Dpct,Dused,Dserial,Dinfo,filespec
      Set WshShell=WScript.CreateObject(“WScript.Shell”)
      Set FSO=CreateObject(“Scripting.FileSystemObject”)
      filespec=”IamDummy”
      For each Drv in FSO.Drives
      If Drv.DriveType=0 Then Dtype=”Unknown ”
      If Drv.DriveType=1 Then Dtype=”Removable”
      If Drv.DriveType=2 Then Dtype=”Fixed ”
      If Drv.DriveType=3 Then Dtype=”Network ”
      If Drv.DriveType=4 Then Dtype=”CD-ROM ”
      If Drv.DriveType=5 Then Dtype=”RAM Disk ”
      If Drv.IsReady Then
      If Drv.DriveType=1 Then
      Dfree=Drv.FreeSpace
      DfreeMB=FormatNumber(Drv.FreeSpace/(1024^2),0)&” MB”
      Label=Drv.DriveLetter
      end if
      end if
      Next
      If (fso.FileExists(Label&”:\IamDummy”)) Then
      Set MyFile = fso.GetFile(Label&”:\IamDummy”)
      MyFile.Delete
      End If
      MsgBox “Espace Libre dans Le Flash Disk “&Label&”:\”&” est Environ de ” &DfreeMB,64,”Espace Libre”

    • becool

      I didn’t still try it but thanks Hackoo !
      merci ;-)

    • http://www.fencepost.net Alan

      There are still a few drives manufactured with write protection switches: The Imation Clip and Pivot (not Pivot Plus) drives, older Imation Swivel drives that may still be available, the PQI U339 series, and the Ritek/RiDATA Twister and Slider drives.

      I have a listing of drives with links to the manufacturers at http://www.fencepost.net/2010/03/usb-flash-drives-with-hardware-write-protection/ based on information from c’t magazine, forum searches and too much reading of manufacturer spec sheets.

    • http://www.vinayswastik.com/ Vinay Swastik

      This is the best solution I’ve found out to protect my USB Flash Drive from the useless worms and viruses.

      Thanks for the awesome post.

    • Hackoo

      Hi ! This is an update of my VBscript I added a function to check if your Flash disk is connected on your machine or not. Enjoy it ;)
      ‘——————————-
      ‘http://hackoo.ifrance.com
      ‘© Hackoo ©
      checkUSB
      DummyFileCreator
      ‘—————DummyFileCreator———————-
      Sub DummyFileCreator
      Dim WshShell,FSO,Drv,Dtype,Dfree,DfreeMB,Dtot
      Dim Dname,Dpct,Dused,Dserial,Dinfo
      Set WshShell=WScript.CreateObject(“WScript.Shell”)
      Set FSO=CreateObject(“Scripting.FileSystemObject”)
      For each Drv in FSO.Drives
      ‘If Drv.DriveType=0 Then Dtype=”Unknown ”
      ‘If Drv.DriveType=1 Then Dtype=”Removable”
      ‘If Drv.DriveType=2 Then Dtype=”Fixed ”
      ‘If Drv.DriveType=3 Then Dtype=”Network ”
      ‘If Drv.DriveType=4 Then Dtype=”CD-ROM ”
      ‘If Drv.DriveType=5 Then Dtype=”RAM Disk ”
      If Drv.DriveType=1 Then ‘ Disk Amovible Flash Disk
      If Drv.IsReady Then ‘ Si le Flash Disk est prêt
      Dfree=Drv.FreeSpace
      DfreeMB=FormatNumber(Drv.FreeSpace/(1024^2),0)&” Mo”
      ‘EspaceLibre = Drv.FreeSpace
      GB=round(Dfree/1073741824,2) & ” Go”
      Label=Drv.DriveLetter
      ‘checkUSB
      ‘wscript.sleep 1000
      MsgBox “Espace Libre dans Le Flash Disk “&Label&”:\”&” est Environ de ” &GB& ” soit environ “&DfreeMB,64,”Espace Libre”
      WshShell.run “cmd /c fsutil file createnew “&Label&”:\IamDummy ” &Dfree&”",0,True
      WshShell.Run “cmd /C attrib +h +s “&Label&”:\IamDummy”,0,TRUE
      end if
      end if
      Next
      end Sub
      ‘—————–checkUSB———————–
      Sub checkUSB
      strComputer = “.”
      On Error Resume Next
      Set WshShell = CreateObject(“Wscript.Shell”)
      beep = chr(007)
      Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2″)
      Set colItems = objWMIService.ExecQuery(“Select * from Win32_DiskDrive WHERE InterfaceType=’USB’”,,48)
      intCount = 0
      For Each drive In colItems
      If drive.mediaType “” Then
      intCount = intCount + 1
      End If
      Next
      If intCount > 0 Then
      MsgBox “Votre Flash Disk est bien Connecté !”,64,”Flash Drive Check !”
      else
      WshShell.Run “cmd /c @echo ” & beep, 0
      wscript.sleep 1000
      MsgBox “Votre Flash n’est pas Connecté “,64,”Flash Drive Check !”
      End If
      End Sub
      ‘———–End of DummyFileCreator.vbs————-

      And This Code is used to delete The Fake Dummy File and so let you write into your pendrive.

      ‘—————-NoDummyFile.vbs—————
      ‘http://hackoo.ifrance.com
      ‘© Hackoo ©
      checkUSB
      NoDummyFile
      ‘—————————————————-
      sub NoDummyFile
      Dim WshShell,FSO,Drv,Dtype,Dfree,DfreeMB,Dtot
      Dim Dname,Dpct,Dused,Dserial,Dinfo,filespec
      Set WshShell=WScript.CreateObject(“WScript.Shell”)
      Set FSO=CreateObject(“Scripting.FileSystemObject”)
      filespec=”IamDummy”
      For each Drv in FSO.Drives
      ‘If Drv.DriveType=0 Then Dtype=”Unknown ”
      ‘If Drv.DriveType=1 Then Dtype=”Removable”
      ‘If Drv.DriveType=2 Then Dtype=”Fixed ”
      ‘If Drv.DriveType=3 Then Dtype=”Network ”
      ‘If Drv.DriveType=4 Then Dtype=”CD-ROM ”
      ‘If Drv.DriveType=5 Then Dtype=”RAM Disk ”
      If Drv.IsReady Then
      If Drv.DriveType=1 Then
      Dfree=Drv.FreeSpace
      DfreeMB=FormatNumber(Drv.FreeSpace/(1024^2),0)&” MB”
      Label=Drv.DriveLetter
      If (fso.FileExists(Label&”:\IamDummy”)) Then
      Set MyFile = fso.GetFile(Label&”:\IamDummy”)
      MyFile.Delete
      End If
      MsgBox “Espace Libre dans Le Flash Disk “&Label&”:\”&” est Environ de ” &DfreeMB,64,”Espace Libre”
      end if
      end if
      Next
      end Sub
      ‘—————–checkUSB———————–
      Sub checkUSB
      strComputer = “.”
      On Error Resume Next
      Set WshShell = CreateObject(“Wscript.Shell”)
      beep = chr(007)
      Set objWMIService = GetObject(“winmgmts:\\” & strComputer & “\root\cimv2″)
      Set colItems = objWMIService.ExecQuery(“Select * from Win32_DiskDrive WHERE InterfaceType=’USB’”,,48)
      intCount = 0
      For Each drive In colItems
      If drive.mediaType “” Then
      intCount = intCount + 1
      End If
      Next
      If intCount > 0 Then
      MsgBox “Votre Flash Disk est bien Connecté !”,64,”Flash Drive Check !”
      else
      WshShell.Run “cmd /c @echo ” & beep, 0
      wscript.sleep 1000
      MsgBox “Votre Flash n’est pas Connecté “,64,”Flash Drive Check !”
      End If
      End Sub
      ‘—————-End of NoDummyFile.vbs—————-

    • Lapsy

      Hi all!
      Have to comment on this as it has assisted me in an issue I am trying to solve with USB.
      Had not thought of the virus issue, overlooked it, but this seems like a simple solution. This is only one half of my story though.
      I am like most USB fanatics currently searching for a way to lock a file (either .exe or ISO) to a partition on a USB drive. I do not want the file to be modified, do not want drag & drop options, do not want the file to be copied. Read only if possible & most importantly format proof to prevent accidental wiping of the data (hence the reason I want 2 partitions to keep idiots away from the locked data or overloading the partition with data, which may cause issues.
      I have looked at CDFS partitions however my file could be more than 4 GB which is looking impossible for CDFS to handle due to the CD format allowing 650-700MB.
      I found this post useful as it will let me fill up the remaining space on the partition to stop any extra data transfer onto the partition containing my .exe or ISO.
      I am looking at mass production of USB’s with my data on it for business promo. It seems there are macines which can duplicate USB in the method I require. My main issue is sending the data overseas to E.G – China – The masters of replicas. Would like to keep the data within my own State/Country & create from home if possible.
      There has to be a way to do this. I notice if I use a search engine & type “Add Ready only” or “Write protect USB” the results seem to be the complete opposite & rave on about removal of write protection on USB!?
      I have researched the U3 device, but makes no sense having to go to those lengths just to write protect a file!
      I even have the file already encrypted, its just a matter of making it permanet on the USB partition. Is there anyone out there who can shed light on the missing link to my problem – Write Protecting a file on a standard USB ? Do not suggest Password protect programs such a file lock as they do not do the job I am looking for.
      I did check this site –
      http://blog.usboffice.kr/?p=146

      The USB I am using is Vendor ID = 090c => SMI Chip ( SMI vendor ID can be different than “090c ” ) Same as the instructions indicate. When attempting to partition for a CDFS (although eventually useless I thought due to the 650-700Mb limit, I would try to learn more & have a go)
      Strangely the program worked as stated, except it limited my usb to a 50MB partition. In the diagram it shows 600+Mb.

      Anyone got any ideas? Have also played with hidden partitions which were cool (ROHOS Seemed the best for me) & did have password entry, but seemed useless as I am still able to format the USB. I wouldn’t say its idiot proof! I also have to display the manufactures logo for the software which is a bit of a lead to cracking the security as people know what I have used to lock it.
      Basically want to be able to hand out a USB stick for someone to take away, knowing they wont delete it accidentally. I understand there is always more than one way to skin a cat when it comes to copying something & not always full proof. But has to be a way to secure it as much as possible to the USB.
      Banged head against screen many time & pulled hair out attemting to find the answer to this without forking out cash & sending data overseas to save money.

      Come on!!! Someone out there knows something about something here!!!!
      Reply’s greatly appreciated!
      Thanks for reading & sorry to blabber on so long, had this topic contained for a while & it needs to get out!

    • Terry

      Using fsutil to create a file of a specific size on my pen drive works for me, but I don’t get a command prompt after the file has been created. The only thing I see is a flashing cursor.

      I can’t close the command prompt by clicking the “X” and nothing appears when I type “exit”. I’ve tried ending task on it in Task Manager, but that doesn’t work either and I’m forced to reboot as the only means of closing it.

      Can anybody provide a clue as to why this is happening?

    • Impx

      Nice one bro, sorted my 8gb drive by formatting NTFS so I just had to use one file.

      @Terry, I had the same issue first time I tried, I hit enter a couple times and nothing happened then after about 30sec the commands came through and the command window closed gracefully.

    • http://www.facebook.com/katon.uchiha DJ Katon Amaro

      hahaha..Dude this method completely froze out a flash of mines…well im happy this flash is on borrowed time!

    Copyright © 2005-2012 - Raymond.CC Blog