Is it possible to protect a flash drive from viruses? How to protect a flash drive from viruses and erasing information

Is it possible to protect a flash drive from viruses? How to protect a flash drive from viruses and erasing information

Viruses cause significant harm to the system, so you should promptly protect your equipment and flash drive in particular from viruses. One of the system’s vulnerabilities is USB drives, which carry malicious software between devices.

Is the flash drive infected?

Any flash drive that was used on an infected device will also be affected. Most often transmitted in this way Trojans and worms. There are several characteristic characteristics of infection them:

How becomes infectedUSB flash drive? It connects to the system and, along with the files transferred to it, receives malicious software, since it is contained in the files and system code that is involved at the time of copying. As soon as the media is connected to the device and the system launches the infected files, the virus starts working along with them and infects the system of this device. Any flash drive connected to an infected computer contains the body of the virus, which also affects the autorun.inf file, thanks to which it immediately starts working on the new PC.

How to protect a flash drive

You can protect your flash drive from possible malware infection using system tools. The most important thing is to disable automatic media startup to prevent a virus from downloading to your device.

Disable autorun

This can be done in 2 ways. The first includes group policies:


In addition, when connecting a flash drive, you can hold down a keyShift– this will also prevent autostart.

The second method uses the Registry Editor:



After these procedures have been completed, the media will no longer start on its own.

Using the autorun inf file

The virus usually gets onto the media with the autorun.inf startup file, but if it is already created on the media, this will not happen:


Closed access

Sometimes it’s enough to simply block the device’s access to the drive:


All of these are system tools that help block access to the media for malware.

Applications and antiviruses

In addition to system tools, there are also programs that protect USB drives from infection.

Bitdefender USB Immunizer

You can download the free version of the utility from the official website; it does not require installation and is extremely simple. After launching it, all connected removable drives will be visible in the window that opens. Having selected the required one, the user will indicate to the utility the object to be protected. She immediately disablesautorun viruses and blocks their automatic launch.

Panda USB Vaccine

After downloading the program from the official website, you need to install it on your PC. It is more complex than the previous utility and has a wider range of actions:


It's quite simple to use:


The procedure must be repeated with each USB drive.

Ninja Pendisk

After downloading the program, you do not need to install it. It works automatically and is capable of:


After downloading it works independently, checking each disk.

xUSB Defense

You can download the program from the official website, it's free. Installation is quick and simple; the program itself weighs only 1 MB and appears in the notification panel immediately after installation.

The program can:

  • automatically delete or quarantine viruses;
  • do hidden files visible;
  • restore data hidden by the virus.

However, the utility does not distinguish malware from regular programs, so you should rename all their files in advance. In addition, it can automatically delete documents from the media, so in the settings it is better to disable the “ Work with documents».

When working with the utility, just left-click on the icon for the settings window and right-click to open the program menu. Clicking with the left mouse button opens the settings window, right clicking opens the menu.

Surely every computer user has at least once picked up some kind of virus on their flash drive. And, despite the fact that there are both specialized utilities for protecting drives and entire anti-virus complexes, this does not give confidence in absolute protection. Today we will look at a somewhat labor-intensive, but very effective way to protect a flash drive from viruses once and for all.

Let’s make a reservation right away that it is only suitable for flash drives for computers; this method will not protect USB drives for cell phones or digital cameras.

So, first of all. We have already considered this issue, so let's move on to further actions.

Create any folder on the flash drive, call it, for example, Files. From now on, we will store all files only in this folder.

Right click on the flash drive icon in the My Computer window, open the context menu and select Properties - tab Safety. Here we delete all groups and users, leaving only the group All.

If you receive an error message when trying to delete a group, click the button [Additionally] and uncheck the Inherit from parent object permissions applicable to child objects checkbox, adding them to those explicitly specified in this window.

If groups All not in the list, create it by pressing a button [Add] and enter it manually.

An alternative way to add the Everyone group: click the button [Additionally] in the window Choice: Users or Groups and then [Search], in the list we find the item All, select it and click [OK].

For a user group All configure access rights - in the column Allow check the following boxes:
- Reading and execution;
- List of folder contents;
- Reading.
Let us remind you again: we perform these settings for a flash drive.

Now right-click on the folder Files and choose Properties - Security. In the window already familiar to us, we repeat the steps to delete unnecessary groups, if any, and for the group All enable all options in the column Allow.

This is where all the settings actually end. Let us now consider several points related to the use of a flash drive protected by the described method. As already mentioned, all files and folders must be saved and copied only in the created folder. Neither we nor viruses can write anything to the root of a USB drive. There is one drawback: the Send menu, although active, will not allow us to copy files to a flash drive; instead of the expected result, we will receive an error message:

However, any other methods of copying files to a protected flash drive will work (for example Select – Copy – Paste). Only, as already noted, it will not be possible to write data to the root of the disk. And in the folder Files you can perform all the usual actions: create other folders and files, copy, delete, rename, etc.

Viruses, which usually create an autorun.bat file in the root of a USB drive, will no longer be able to write any data to the flash drive after applying the described protection methods. And therefore, our drive will remain completely protected once and for all: we won’t catch the viruses themselves, and we won’t infect the computers of other users.

Along with cloud services, we very often use regular flash cards to store photos and movies. We connect it to other people's computers and laptops, which carries the risk of infection with viruses and other malware. The statistics are inexorable: every 10th computer is a direct threat. The question arises: how to protect a flash drive from viruses without reducing the comfort of its use?

Standard Windows Methods

Most often, a USB drive is infected through a file autorun.inf. This file serves a very specific purpose: automatically launching or installing applications from a flash card to a computer. It is hidden, but is present on any flash drive. As in other areas of life, early protection and prevention are better than time-consuming treatment that does not guarantee a 100% positive result. Therefore, the main task is to make the autorun.inf file invulnerable to attempts to infect it.

It is extremely important: the methods described below will protect the media from malware that uses USB flash as a means of spreading itself (it is they who seek to overwrite the mentioned file in their own way). Viruses, Trojans and other troubles in program installers will not go away: use antiviruses to detect them.

Disabling startup

This is a method of protecting the computer itself from a possibly already infected flash drive, both yours and someone else’s. The easiest way to do this is to follow the steps below. For Windows 7:

  • Press key combination Win+R.
  • In the “Run” window that opens, enter gpedit.msc and click on OK.

  • Click on "Allow" when a message appears asking you to perform an action as an administrator. You may also be required to enter an administrator password.
  • In the Local Group Policy Editor window that appears, expand the “Computer Configuration” list, and then “Administrative Templates”.
  • Select "All parameters".

  • In the list that opens on the right, right-click on the line “Disable autorun”.

  • Click “Change”, make the “Enable” item active, the value “All devices” should be set below.

  • Click "Apply".

Please note: in some versions of Windows (8.8.1), the sequence in steps 4-6 may be slightly different and look like this: “Computer Configuration” – “Administrative Templates” – “Windows Components” – “Autorun Policies” – “Disable Autorun”.

A reboot may be required for the changes to take effect. That's all - now any flash drives connected to the computer will not run on it automatically and will not cause harm without user intervention.

Autorun file protection

Now there is a way to protect the flash drive itself from malware distributed using physical storage media. We are talking about the same autorun.inf.

In the good old days, it was enough to create an empty write-protected file on a USB drive. That is, with read-only rights. Today such measures are not enough. But the essence of the actions is similar. On a flash drive that has been scanned by a good antivirus, after making sure that there are no dangers, create a special file. Open a regular notepad and copy these lines into it:

attrib -S -H -R -A autorun.*
del autorun.*
attrib -S -H -R -A recycler
rd "\\?\%~d0\recycler\" /s /q
attrib -S -H -R -A recycled
rd "\\?\%~d0\recycled\" /s /q
mkdir "\\?\%~d0\AUTORUN.INF\LPT3″
attrib +S +H +R +A %~d0\AUTORUN.INF /s /d
mkdir "\\?\%~d0\RECYCLED\LPT3″
attrib +S +H +R +A %~d0\RECYCLED /s /d
mkdir "\\?\%~d0\RECYCLER\LPT3″
attrib +S +H +R +A %~d0\RECYCLER /s /dattrib -s -h -r autorun.*
del autorun.*
mkdir %~d0AUTORUN.INF
mkdir "?%~d0AUTORUN.INF..."
attrib +s +h %~d0AUTORUN.INF

Save the result to a flash drive, naming the file locker.bat. After the dot there is an extension, it is extremely important and should look exactly like this .bat. Open the flash drive through Explorer and launch the newly created file with a regular double-click. It will run as a small program and create a secure folder called AUTORUN.INF.

What does this give? By inserting a USB Flash Drive into an infected computer, you don’t have to worry about the viruses on it that spread via USB. Such a virus will rush to overwrite the autorun.inf file, but it’s not there! Instead, a folder, and one that is protected.

It is also important: viruses can write themselves to other places on a flash drive by changing other files. Therefore, when inserting it into your computer, check it with an antivirus before opening it.

Radical way

If you have to connect a flash drive to someone else's computer, but only to download files from it, the option of switching the file system to read-only mode is suitable. This is an effective, but, in most cases, inconvenient method, making the “send to a removable disk” option and similar operations inoperative.

In order to apply this method you must:

  • Format the USB drive to the NTFS file system. Please note: all data from the flash drive will be deleted! If the flash drive is already in NTFS, skip this step.

  • Write down all the necessary data and put them in one folder.
  • Open the properties of the flash drive (right-click) and in the “Security” tab, click on the “Change” button.

  • In the “Allow” column, uncheck all the boxes except for the items “List folder contents” and “Reading”.
    Click "OK".

Now no virus can be registered on a flash drive.

Using third party programs

You can also protect your USB drive from malware using programs specially created for this purpose. For example, Panda USB Vaccine. This free utility is designed specifically to protect removable media.

After downloading and launching it, connect the flash drive you want to protect to your computer. Follow 2 simple steps:

  1. In the drop-down menu, install the desired USB drive;
  2. Click on the Vaccinate USB button.

That's all! The flash drive is protected from overwriting the autorun file. Essentially, the program simply disables autorun, but does this by pressing a couple of buttons in a convenient interface.

Conclusion

Unfortunately, you will not be able to 100% protect your flash drive from viruses. The measures described in the article only prevent malware from automatically penetrating first onto a USB drive and then onto your PC. Always keep your antivirus up to date and scan flash drives before opening them in Explorer.

Every storage medium can become a haven for malware. As a result, you may lose valuable data and risk infecting your other devices. Therefore, it is better to get rid of all this as soon as possible. We will look further at how you can check and remove viruses from your drive.

Let's start by looking at the signs of viruses on a removable drive. The main ones are:

  • files appeared with the name "autorun";
  • files with the extension appeared ".tmp";
  • suspicious folders appeared, for example, "TEMP" or "RECYCLER";
  • The flash drive stopped opening;
  • the drive cannot be removed;
  • files have disappeared or turned into shortcuts.

In general, the media becomes slower to be detected by the computer, it takes longer for information to be copied onto it, and sometimes errors may occur. In most cases, it would be a good idea to check the computer to which the flash drive is connected.

To combat malware, it is best to use antivirus software. These can be either powerful combination products or simple, highly targeted utilities. We invite you to familiarize yourself with the best options.

Method 1: Avast! Free Antivirus

Today this antivirus is considered one of the most popular in the world, and for our purposes it is perfect. To use to clean a USB drive, do the following:


You can also scan media through the context menu. To do this, follow a number of simple steps:
Right-click on the flash drive and select "Scan".


By default, Avasta is configured to automatically detect viruses on connected devices. The status of this function can be checked using the following path:

Settings / Components / File system screen settings / Scan on connection

Method 2: ESET NOD32 Smart Security

And this is an option with less load on the system, so it is often installed on laptops and tablets. To scan a removable drive for viruses using , do the following:

You can set up automatic scanning when you connect a flash drive. To do this, follow the path

Settings / Advanced settings / Virus protection / Removable media

Method 3: Kaspersky Free

The free version of this antivirus will help you quickly scan any media. Instructions for using it to complete our task are as follows:


Don't forget to set up automatic scanning. To do this, go to settings and click "Examination". Here you can set the antivirus action when connecting a flash drive to a PC.


For reliable operation of each antivirus, do not forget about virus database updates. They usually happen automatically, but inexperienced users can cancel them or disable them altogether. This is not recommended at all.

Method 4: Malwarebytes

One of the best utilities for detecting viruses on your computer and portable devices. Instructions for use are as follows:


You can go the other way by simply right-clicking on the flash drive in "Computer" and selecting "Scan Malwarebytes".

How do viruses spread through flash drives work?

Since a flash drive is a universal storage medium, absolutely any files can be stored on it, including those that are dangerous. First of all, the main danger is posed by viruses that can launch automatically the moment the media is connected to the computer.

For these purposes, a special file autorun.inf is created. By itself, it does not cause any harm and its main purpose is to automatically launch applications when reading any device on which it is located. You connect a flash drive and if this autorun file is located on it, the computer, following the instructions in it, launches the desired program.

Often viruses do not pose any danger until they are launched. This is why such a dangerous space is used with the autorun file. You connect the infected flash drive and the virus starts, happily infecting the system. And you don’t even need to launch it specifically.

To protect against such malicious programs, special utilities are used, and also, do not forget about the correct system settings, which can significantly increase security when working with removable media.

Disabling autorun

Since most dangerous programs use autorun, by disabling this function we will deactivate most of them.

Open the Start menu and right-click on the “Computer” section. In the context menu you need to select “Management” (done on behalf of the Administrator).

On the left side of the new window, select the “Services” section. And on the right, among the list of services, we find “Shell hardware detection”. Now right-click on this service and click on “Properties”.

In the properties window, opposite the “Startup type” item, select Disabled. After that, click on Stop and apply the settings you made. In order for the changes to take effect, you must restart the computer.

This method is very effective, although it also has a disadvantage. For example, if you launch a disc with a game (program, movie), the installation will not start automatically. To start, you will have to open the disk itself, look for the startup file, and only then perform the installation. On the one hand, this is not such a big difficulty, because the system will be much more secure this way, on the other hand, you will have to do a lot of unnecessary steps if you often install software from disks.

Create your own autorun.inf

I think that many people know that it is impossible to create two files with the same name in the same folder. We will take advantage of this! If you create your own autorun.inf file and set it to read-only, you can prevent someone else's autorun file from getting onto the flash drive. This method is good, but not as effective as the previous one. Many viruses have learned to delete this file and create their own, which is no longer encouraging.

But don’t give up, if the flash drive has a FAT file system, it is possible to create a folder called autorun.inf, which cannot be deleted.

To do this, create a special bat file. To do this, open Notepad (in the Start menu → All Programs → Accessories) and click save as. Save this file to a convenient place, specifying the .bat extension for it and then copy the following program code into the same file:

attrib -s -h -r autorun.*

"\\?\%~d0\autorun.inf\name..\"

attrib +s +h %~d0\autorun.inf

Save the file and make a copy of it to a flash drive. Run it there, on the flash drive. After this, a folder named Autorun.inf will appear, which cannot be deleted.

Of course, this method can protect against infection only from your flash drive, but there is still a danger of infection from any other. Also, this will not work if the flash drive has an NTFS file system. Typically, such flash drives have a capacity of more than four gigabytes.

Software protection of flash drives from viruses

Standard antivirus

This is a good tool to protect your computer from this type of virus. It should be on every PC. Most antivirus programs automatically scan each piece of media as soon as it is connected to your computer. If anything is detected, the antivirus will instantly intercept the malicious file and delete it, and in some cases even cure it. To choose a good antivirus program, use the antivirus rating.

USB Disk Security

A good program that will protect your computer from any threat coming from devices connected via USB (flash drive, external drive, etc.). It's a good idea to use it together with your main antivirus.

Panda USB Vaccine

This is also a good auxiliary program that will help protect your computer from threats located on flash media. It allows you to automatically perform all the steps described above: disable autorun and create a non-deletable autorun.inf. Which actually protects the computer from Trojan programs getting onto it.

views