How to control USB devices and other removable media using Windows Defender ATP

Applies to: Windows Defender Advanced Threat Protection (Windows Defender ATP)

Microsoft recommends a layered approach to securing removable media, and Windows Defender ATP provides multiple monitoring and control features to help prevent threats in unauthorized peripherals from compromising your devices:

  1. Prevent threats from removable storage introduced by removable storage devices by enabling:

  2. Detect plug and play connected events for peripherals in Windows Defender ATP advanced hunting

    • Identify or investigate suspicious usage activity. Create customized alerts based on these PnP events or any other Windows Defender ATP events with custom detection rules.
  3. Respond to threats from peripherals in real-time based on properties reported by each peripheral:

    • Granular configuration to deny write access to removable disks and approve or deny devices by USB vendor code, product code, device IDs, or a combination.
    • Flexible policy assignment of device installation settings based on an individual or group of Azure Active Directory (Azure AD) users and devices.

These threat reduction measures help prevent malware from coming into your environment. To protect enterprise data from leaving your environment, you can also configure data loss prevention measures. For example, on Windows 10 devices you can configure BitLocker and Windows Information Protection, which will encrypt company data even if it is stored on a personal device, or use the Storage/RemovableDiskDenyWriteAccess CSP to deny write access to removable disks. Additionally, you can classify and protect files on Windows devices (including their mounted USB devices) by using Windows Defender ATP and Azure Information Protection.

Prevent threats from removable storage

Windows Defender ATP can help identify and block malicious files on allowed removable storage peripherals.

Enable Windows Defender Antivirus Scanning

Protecting authorized removable storage with Windows Defender Antivirus requires enabling real-time protection or scheduling scans and configuring removable drives for scans.

  • If real-time protection is enabled, files are scanned before they are accessed and executed. The scanning scope includes all files, including those on mounted removable devices such as USB drives. You can optionally run a PowerShell script to perform a custom scan of a USB drive after it is mounted, so that Windows Defender Antivirus starts scanning all files on a removable device once the removable device is attached. However, we recommend enabling real-time protection for improved scanning performance, especially for large storage devices.
  • If scheduled scans are used, then you need to disable the DisableRemovableDriveScanning setting (enabled by default) to scan the removable device during a full scan. Removable devices are scanned during a quick or custom scan regardless of the DisableRemovableDriveScanning setting.

Note

We recommend enabling real-time monitoring for scanning. In Intune, you can enable real-time monitoring for Windows 10 in Device Restrictions > Configure > Windows Defender Antivirus > Real-time monitoring.

Block untrusted and unsigned processes on USB peripherals

End-users might plug in removable devices that are infected with malware. To prevent infections, a company can block USB files that are unsigned or untrusted. Alternatively, companies can leverage the audit feature of attack surface reduction rules to monitor the activity of untrusted and unsigned processes that execute on a USB peripheral. This can be done by setting Untrusted and unsigned processes that run from USB to either Block or Audit only, respectively. With this rule, admins can prevent or audit unsigned or untrusted executable files from running from USB removable drives, including SD cards. Affected file types include executable files (such as .exe, .dll, or .scr) and script files such as a PowerShell (.ps), VisualBasic (.vbs), or JavaScript (.js) files.

These settings require enabling real-time protection.

  1. Sign in to the Microsoft Azure portal.
  2. Click Intune > Device configuration > Profiles > Create profile.

    Create device configuration profile

  3. Use the following settings:

    • Name: Type a name for the profile
    • Description: Type a description
    • Platform: Windows 10 or later
    • Profile type: Endpoint protection

    Create endpoint protection profile

  4. Click Configure > Windows Defender Exploit Guard > Attack Surface Reduction.

  5. For Unsigned and untrusted processes that run from USB, choose Block.

    Block untrusted processes

  6. Click OK to close Attack Surface Reduction, Windows Defender Exploit Guard, and Endpoint protection.

  7. Click Create to save the profile.

Protect against Direct Memory Access (DMA) attacks

DMA attacks can lead to disclosure of sensitive information residing on a PC, or even injection of malware that allows attackers to bypass the lock screen or control PCs remotely. The following settings help to prevent DMA attacks:

  1. Beginning with Windows 10 version 1803, Microsoft introduced Kernel DMA Protection for Thunderbolt to provide native protection against DMA attacks via Thunderbolt ports. Kernel DMA Protection for Thunderbolt is enabled by system manufacturers and cannot be turned on or off by users.

    Beginning with Windows 10 version 1809, you can adjust the level of Kernel DMA Protection by configuring the DMA Guard CSP. This is an additional control for peripherals that don't support device memory isolation (also known as DMA-remapping). Memory isolation allows the OS to leverage the I/O Memory Management Unit (IOMMU) of a device to block unallowed I/O, or memory access, by the peripheral (memory sandboxing). In other words, the OS assigns a certain memory range to the peripheral. If the peripheral attempts to read/write to memory outside of the assigned range, the OS blocks it.

    Peripherals that support device memory isolation can always connect. Peripherals that don't can be blocked, allowed, or allowed only after the user signs in (default).

  2. On Windows 10 systems that do not suppprt Kernel DMA Protection, you can:

Detect plug and play connected events

You can view plug and play connected events in Windows Defender ATP advanced hunting to identify suspicious usage activity or perform internal investigations. For examples of Windows Defender ATP advanced hunting queries, see the Windows Defender ATP hunting queries GitHub repo. Based on any Windows Defender ATP event, including the plug and play events, you can create custom alerts using the Windows Defender ATP custom detection rule feature.

Respond to threats

Windows Defender ATP can prevent USB peripherals from being used on devices to help prevent external threats. It does this by using the properties reported by USB peripherals to determine whether or not they can be installed and used on the device.

Note

Always test and refine these settings with a pilot group of users and devices first before applying them in production.

The following table describes the ways Windows Defender ATP can help prevent installation and usage of USB peripherals. For more information about controlling USB devices, see the Microsoft Secure blog "WDATP has protections for USB and removable devices".

Control Description
Block installation and usage of removable storage Users can't install or use removable storage
Only allow installation and usage of specifically approved peripherals Users can only install and use approved peripherals that report specific properties in their firmware
Prevent installation of specifically prohibited peripherals Users can't install or use prohibited peripherals that report specific properties in their firmware

Note

Because an unauthorized USB peripheral can have firmware that spoofs its USB properties, we recommend only allowing specifically approved USB peripherals and limiting the users who can access them.

Block installation and usage of removable storage

  1. Sign in to the Microsoft Azure portal.
  2. Click Intune > Device configuration > Profiles > Create profile.

    Create device configuration profile

  3. Use the following settings:

    • Name: Type a name for the profile
    • Description: Type a description
    • Platform: Windows 10 and later
    • Profile type: Device restrictions

    Create profile

  4. Click Configure > General.

  5. For Removable storage and USB connection (mobile only), choose Block. Removable storage includes USB drives, where USB connection (mobile only) excludes USB charging but includes other USB connections on mobile devices only.

    General settings

  6. Click OK to close General settings and Device restrictions.

  7. Click Create to save the profile.

Only allow installation and usage of specifically approved peripherals

Windows Defender ATP allows installation and usage of only specifically approved peripherals by creating a custom profile in Intune and configuring DeviceInstallation policies. For example, this custom profile allows installation and usage of USB devices with hardware IDs "USBSTOR\DiskVendorCo" and "USBSTOR\DiskSanDisk_Cruzer_Glide_3.0".

Custom profile

Peripherals that are allowed to be installed can be specified by their hardware identity. For a list of common identifier structures, see Device Identifier Formats. Test the configuration prior to rolling it out to ensure it blocks and allows the devices expected. Ideally test various instances of the hardware. For example, test multiple USB keys rather than only one.

For a SyncML example that allows installation of specific device IDs, see DeviceInstallation/AllowInstallationOfMatchingDeviceIDs CSP. To allow specific device classes, see DeviceInstallation/AllowInstallationOfMatchingDeviceSetupClasses CSP. Allowing installation of specific devices requires also enabling DeviceInstallation/PreventInstallationOfDevicesNotDescribedByOtherPolicySettings.

Prevent installation of specifically prohibited peripherals

Windows Defender ATP blocks installation and usage of prohibited peripherals by using either of these options: