How to Prevent USB Autorun Malware

Tap an item to see how to protect yourself from USB autorun malware.

What Is USB Autorun Malware

A type of infection that exploits a file set to run automatically the moment a USB drive is plugged in, so malware executes without the user opening anything or clicking a link.

Turn Off Autorun for Removable Drives

In your operating system's AutoPlay or AutoRun settings, disable automatic actions for removable drives so nothing launches on its own when a USB device is connected.

Scan Before You Open the Folder

Instead of double-clicking into a USB drive right away, run your antivirus software on it first to check for malicious files.

Never Plug In an Unknown USB Drive

Plugging in a USB drive you found lying around or that someone handed you, out of curiosity, can be risky -- this exact trick has been documented as a real malware-distribution method.

Use a Physical Write-Protect Switch

Some USB drives and card adapters have a physical write-protect (lock) switch. Enabling it prevents files on the drive from being altered even if it's connected to an infected computer.

Eject Safely When You're Done

Use your operating system's "safely remove hardware" option before unplugging. It helps prevent file corruption and keeps the drive in stable condition.

The Danger: Infection Without a Single Click

Ordinary malware usually needs you to open a file or click a link, but autorun-style infections can begin the moment a USB drive is inserted -- that's what makes them worth extra caution. Modern operating systems restrict autorun by default, which has reduced the risk, but it's still worth double-checking your settings.

Be Extra Careful on Shared or Public Computers

A computer used by many people is hard to fully trust, since you have no way of knowing what USB drives have been connected to it before. Handle sensitive files on your own computer, and avoid plugging personal USB drives into public or shared machines whenever possible.

Frequently Asked Questions

Can a Mac or a smartphone get infected by USB autorun malware?

macOS doesn't offer the same kind of automatic-execution feature Windows does, so the risk is comparatively low. Smartphones typically require the user to approve file-transfer permissions when a USB connection is made, which also limits autorun-style infection -- though other types of threats still apply to both.

A strange window popped up when I plugged in a USB drive -- can I just close it?

If you see an unfamiliar program window or an administrator-permission prompt, don't approve it. Cancel immediately and run a full scan with your antivirus software to be safe.