TL;DR
Yes, a USB drive with an infected Master Boot Record (MBR) or GUID Partition Table (GPT) can harm your operating system if you boot from it or allow the OS to read/execute code from it. Modern systems are better protected but aren’t immune. The risk is higher on older systems or those without secure boot enabled.
Understanding the Risks
Your computer’s MBR (for older BIOS systems) or GPT (for newer UEFI systems) tells the computer how to start up. A malicious infection can replace this with code that takes control of your system before the OS even loads. This is often called a bootkit.
How an Infected USB Can Harm Your System
- Booting from the Drive: If you intentionally or accidentally boot your computer from the infected USB drive, the malicious code in the MBR/GPT will run immediately.
- Auto-Run (Older Systems): Older versions of Windows had an Auto-Run feature that would automatically execute programs on a USB drive when it was inserted. This is largely disabled now but still poses a risk if enabled or exploited through vulnerabilities.
- Malicious Code Execution: Even without booting, some malware can exploit vulnerabilities in the OS to run code when the drive is connected and accessed.
Protecting Your System
- Disable Auto-Run: While largely disabled by default, ensure it’s completely turned off.
- In Windows, open
gpedit.msc(Local Group Policy Editor – available on Pro/Enterprise editions). - Navigate to Computer Configuration > Administrative Templates > Windows Components > AutoPlay Policies.
- Set “Turn off AutoPlay” to Enabled and configure the settings as needed (e.g., disable all drives).
- In Windows, open
- Secure Boot: Enable Secure Boot in your UEFI/BIOS settings. This helps prevent unauthorized code from running during startup.
- Access your BIOS/UEFI setup (usually by pressing Del, F2, F12, or Esc during boot – check your motherboard manual).
- Look for Secure Boot options and enable them. You may need to set a supervisor password first.
- Antivirus/Anti-Malware Software: Keep your antivirus software up-to-date and perform regular scans.
- Be Careful What You Plug In: Only use USB drives from trusted sources. Avoid using unknown or public USB drives.
- Scan Before Opening: Always scan a USB drive with your antivirus software before opening any files on it, even if you trust the source.
- Right-click the USB drive in File Explorer and select “Scan with Microsoft Defender” (or your installed antivirus).
- Virtual Machines: If you need to access a potentially risky USB drive, consider using it within a virtual machine. This isolates the risk from your main operating system.
Checking for Infection
- MBR/GPT Inspection (Advanced): You can use tools like
diskpartin Windows to inspect the MBR/GPT, but this requires technical knowledge. Be extremely careful as incorrect usage can damage your drive.- Open Command Prompt as Administrator.
- Type
diskpartand press Enter. - Type
list diskand press Enter to see a list of disks. - Select the USB drive (e.g.,
select disk 1). - Type
detail diskand press Enter. Look for any unusual information or errors.
- Boot Sector Examination: Tools like Hiren’s BootCD PE include utilities to examine the boot sector of a drive.
Recovery
If you suspect your system is infected:
- Disconnect the USB drive immediately.
- Run a full scan with a reputable antivirus/anti-malware program from a clean boot environment (e.g., using a rescue disk).
- In severe cases, you may need to reinstall your operating system.