TL;DR
Yes, a USB drive can infect a hard drive even without an operating system running on the target computer. This is because malware can exploit firmware vulnerabilities or directly write to sectors of the disk. Prevention focuses on disabling auto-run features, keeping BIOS/UEFI updated, and being cautious about using unknown USB drives.
Understanding the Threat
Traditionally, viruses needed an OS (like Windows, macOS, or Linux) to run. However, modern threats can bypass this requirement by targeting lower levels of a computer’s hardware and software:
- Firmware Viruses: These infect the BIOS/UEFI, which is the first software that runs when you power on your computer. They are very difficult to detect and remove.
- Boot Sector Viruses: These replace the boot sector of a hard drive with malicious code. When the computer tries to start up, it executes this code instead of the OS.
- USB Drive as an Attack Vector: A specially crafted USB drive can be programmed to act like a keyboard or network adapter, sending commands directly to the computer even before the OS loads.
How Infection Happens Without an OS
- BIOS/UEFI Exploits: If your BIOS/UEFI has vulnerabilities, a malicious USB drive can exploit them to install malware directly into the firmware. This is rare but extremely dangerous.
- Boot Sector Modification: A USB drive containing boot sector viruses can overwrite the master boot record (MBR) or GUID partition table (GPT) of your hard drive when you attempt to boot from it.
- BadUSB Attacks: These attacks reprogram the firmware of a USB device to emulate other devices, like a keyboard. The malicious USB then injects keystrokes that download and execute malware.
Protecting Your Computer
Here’s how to protect your computer from USB drive infections even without an OS:
1. Disable Auto-Run
Auto-run allows a USB drive to automatically execute programs when it’s connected. Disabling this is crucial.
- Windows: Open the Registry Editor (
regedit) and navigate to
HKEY_LOCAL_MACHINESOFTWAREMicrosoftWindowsCurrentVersionPoliciesExplorer. SetNoDriveTypeAutoRunto 95 (to disable Auto-run on all drives). - Group Policy Editor: If you have Windows Pro, use the Group Policy Editor (
gpedit.msc) and navigate to Computer Configuration > Administrative Templates > Windows Components > Autoplay Policies. Disable autoplay for all drive types.
2. Keep BIOS/UEFI Updated
Manufacturers regularly release updates that patch security vulnerabilities in the BIOS/UEFI.
- Check Your Manufacturer’s Website: Visit your motherboard or computer manufacturer’s website and download the latest BIOS/UEFI update for your model.
- Update Procedure: Follow the manufacturer’s instructions carefully when updating the BIOS/UEFI. Incorrect updates can brick your computer. Usually, this involves putting the update file on a USB drive and booting into the BIOS setup to perform the flash.
3. Secure Boot
Secure Boot is a feature of UEFI that helps prevent malicious software from loading during startup.
- Enable in BIOS/UEFI Settings: Access your BIOS/UEFI settings (usually by pressing Del, F2, or another key during startup) and enable Secure Boot.
4. Be Cautious with Unknown USB Drives
Never plug in a USB drive from an untrusted source.
- Scan Before Use: If you must use an unknown USB drive, scan it thoroughly with a reputable antivirus program before opening any files.
- Avoid Public Computers: Be extra careful when using USB drives on public computers, as they may be compromised.
5. Write-Protect Your USB Drives
Some USB drives have a physical write-protect switch. Enabling this prevents malware from writing to the drive.
What if You Suspect an Infection?
- Disconnect Immediately: Disconnect the suspected infected USB drive immediately.
- Boot From Clean Media: Boot your computer from a clean bootable USB drive or DVD containing antivirus software.
- Scan Your Hard Drive: Scan your hard drive thoroughly for malware.
- BIOS/UEFI Recovery (If Necessary): If you suspect a BIOS/UEFI infection, you may need to reset the BIOS/UEFI to its default settings or contact your computer manufacturer for assistance. This is an advanced procedure and should only be attempted if you are comfortable with it.

