Last updated: December 5, 2026 · Reading time: about 11 minutes
How to check if a USB drive is safe: do not open files on it, turn off AutoPlay, scan the whole drive with Windows Security or another antivirus, look for autorun.inf and unexpected executables or shortcuts, and throw away any drive you found in public. A scan is a good filter, but it cannot detect a drive that attacks the machine at the hardware level.

Key takeaways
- A USB drive can carry malware as files, as an autorun instruction, or as malicious firmware inside the controller. Scanning catches the first two only.
- Never plug in a drive you found in a car park, a hotel room or a conference bag. That is a known attack, not a lucky find.
- Scan the whole drive, not one folder, and do it before you copy anything off.
- Turn off AutoPlay and do not double-click anything, including files that look like documents or photos.
- If you have already opened a file, treat the machine as possibly infected and follow the steps for a downloaded file.

Why is a USB drive a risk at all?
A flash drive is a small computer with storage attached. That gives an attacker three places to work: the files, an autorun.inf file that tells Windows what to launch when the drive is inserted, and the firmware in the controller, which can pretend to be a keyboard or hide its real contents. The US Cybersecurity and Infrastructure Security Agency warns about all three in its guidance on using caution with USB drives.
The file case is the common one. A document with macros, a .exe disguised with a PDF icon, a shortcut (.lnk) that runs a script, or a folder that is really an executable. None of them need an exploit; they need you to click.
How to check if a USB drive is safe: the short version
Insert the drive, refuse any prompt that offers to open or run something, scan the entire drive with your antivirus, and inspect the file list before you open a single item. That covers the realistic risks in about five minutes.
- Turn off AutoPlay first. In Windows, Settings → Bluetooth & devices → AutoPlay, and switch it off for removable drives.
- Insert the drive and dismiss every popup. Do not click Open folder to view files from the system prompt.
- Scan it. Open Windows Security, choose Virus & threat protection, Scan options, Custom scan, and select the drive letter.
- Look at the contents without opening files. Switch on hidden items and file extensions in File Explorer’s View menu so an .exe cannot pose as a PDF.
- Copy out only the files you need, then scan those files again on your machine.

What should you look for in the file list?
Red flags are autorun.inf, .lnk shortcuts, .exe, .scr, .bat, .cmd, .js and .vbs files, plus any file whose icon does not match its extension. A drive that came from a friend should contain documents, photos or media, not programs.

- autorun.inf at the root: the drive wants to launch something when inserted. Delete it or do not use the drive.
- Shortcuts that point to powershell or cmd: a classic trick that hides a script behind a friendly name.
- Double extensions such as invoice.pdf.exe: Windows hides the last extension by default, which is why you should show them.
- An empty drive with a single folder: some malware hides everything else and replaces folders with executables.
- Office documents that ask to enable macros: close them. Macros are still the most common document attack.
How do you scan a USB drive on Windows, macOS and Linux?
Use a full custom scan of the drive letter on Windows, an antivirus with real-time protection on macOS, and a read-only mount plus ClamAV on Linux. Each system gives you a different amount of built-in protection.
- Windows: Windows Security → Virus & threat protection → Scan options → Custom scan → select the drive. Microsoft documents this flow in its support article on scanning an item with Windows Security. Defender scans files, not firmware.
- macOS: there is no built-in on-demand scanner for removable drives. Keep Gatekeeper on, do not open unknown files, and use a reputable antivirus if you handle other people’s drives regularly.
- Linux: mount the drive read-only (mount -o ro) and run ClamAV over the mount point. Read-only mounting means nothing on the drive can change while you look at it.
- Any system: if a single file looks suspicious, upload it to a multi-engine scanner such as VirusTotal. Remember that the file is then shared with the vendors on that service, so do not upload private documents.
Can a scan miss something?
Yes. Antivirus software cannot see a malicious firmware, a device that pretends to be a keyboard, or a brand new file that no vendor has seen yet. That is why the advice for a drive you did not buy yourself is simply not to plug it in.
Hardware attacks such as a USB device that sends keystrokes when inserted, or a drive that delivers a high voltage pulse, are not detectable by any scan. If you must inspect an unknown drive, use a computer you can wipe, a virtual machine with USB passthrough, or a dedicated Linux live session with the network off.
What should you do if you already opened a file?
Disconnect the drive, run a full scan of the computer, and change passwords for any account you signed into afterwards. If the file was a document with macros, check for new startup items and browser extensions. Our guide to how to check if your PC is infected lists the signs to look for, and what to do if you clicked a phishing link covers the account side.
How do you make a USB drive safer to use?
Format it after you have taken what you need, keep it out of other people’s machines, and encrypt the contents if it holds private data.
- Format with the file system you actually need. A quick format clears the file table; a full format overwrites more.
- Use BitLocker To Go on Windows or an encrypted container for sensitive files, so a lost drive is not a data breach.
- Keep one drive per purpose. Mixing a work drive with personal files is how malware travels between them.
- Eject properly. Pulling a drive during a write is how files get corrupted and how people lose work.

Is it worth using a drive you found?
No. The value of a free drive is a few dollars, and the cost of an infection is your accounts and your files. Security researchers have dropped infected drives on purpose for years to measure how many people plug them in. If you find one, hand it to reception or building security, or bin it.

Frequently asked questions
Can a USB drive infect my computer just by plugging it in?
Rarely through files, because AutoPlay no longer runs programs automatically on current Windows. It can happen through a malicious device that pretends to be a keyboard, which needs no click at all.
Does Windows Defender scan USB drives automatically?
Real-time protection scans files as they are read, and a custom scan checks the whole drive. Neither looks at the drive’s firmware.
What is autorun.inf and should I delete it?
It is a text file that tells Windows what to run when the drive is inserted. A legitimate drive almost never needs one, so deleting it is safe and stops the launch.
Is it safe to open photos from a found drive?
Photos are usually harmless, but the file may not be a photo. Turn on file extensions, check the size and type, and scan before opening anything.
Can a phone be infected by a USB drive?
Android and iOS are harder targets than desktop systems, but a drive can still carry files that attack a connected computer, and a charging cable from an unknown source can be a risk. Use your own cable and charger.
Does formatting a drive remove malware?
It removes the files, which removes file-based malware. It does not remove malicious firmware. For a drive you do not trust, replace it.
Should I scan a drive I bought new?
Yes, quickly. Counterfeit and repackaged drives exist, and a scan takes a minute. Also test the real capacity with a tool such as h2testw if the price was too good.
Sources and further reading
- CISA: Using Caution with USB Drives.
- Microsoft Support: Scan an item with Windows Security.
- FBI Internet Crime Complaint Center: report a cyber crime.
Summary
Checking if a USB drive is safe comes down to three habits: do not open anything before you scan, scan the whole drive with hidden files and extensions visible, and never plug in a drive you found. If you already opened a file, scan the machine and change the passwords you used afterwards. For the wider picture on removable media and downloads, read how to check if an app is safe and how to spot a phishing email.
Cybersecurity researcher and information security analyst. I help individuals and organizations secure their digital assets, maintain robust privacy, and stay ahead of modern cyber threats through expert, unbiased insights.