Attackers Can Conceal Microsoft Defender Exclusions From PowerShell Queries

Microsoft Defender Antivirus allows administrators to create exclusions so that specific files, folders, processes, or IP addresses are not scanned.

This is useful for trusted applications but dangerous if misused. Defender supports four main exclusion types: process, path, extension, and IP address.

Path and extension exclusions are especially valuable to attackers because they can disable scanning on entire directories or file types, allowing malicious binaries to run undetected.

Hidden Defender Exclusion Policy

Normally, defenders use PowerShell commands like Get-MpPreference to list configured exclusions. However, threat actors can enable a policy setting that hides these exclusions from such queries.

By setting the registry value HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\HideExclusionsFromLocalAdmins to 1, exclusions remain active but disappear from PowerShell output and the Windows Security interface.

This setting affects not only local administrators but also SYSTEM-level processes that rely on standard APIs to query exclusions. The exclusions can still be seen by directly inspecting the registry, but many security tools and scripts do not do this by default.

Attackers typically create exclusions using PowerShell (Set-MpPreference or Add-MpPreference), WMI, Group Policy, or direct registry edits under HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions.

Once in place, these exclusions bypass real-time protection, scheduled scans, and on-demand scans. Notable malware families such as GootKit, WhisperGate, and Muddled Libra have used path exclusions to protect their payloads.

View of GPO exclusion of C:\temp (Source: huntress)
View of GPO exclusion of C:\temp (Source: huntress)

For example, WhisperGate added an exclusion for the entire C:\ drive, while GootKit excluded specific folders via WMI.

Organizations should treat unexpected Defender exclusions as high-risk indicators, especially on endpoints that do not require them for legitimate software. Key mitigation steps include:

  • Audit exclusions regularly: Use both PowerShell (Get-MpPreference) and direct registry checks under HKLM\SOFTWARE\Microsoft\Windows Defender\Exclusions and HKLM\SOFTWARE\Policies\Microsoft\Windows Defender\Exclusions.
  • Monitor registry changes: Track modifications to exclusion-related registry keys and the HideExclusionsFromLocalAdmins value. Endpoint detection and response (EDR) solutions can alert on these writes.
  • Restrict policy changes: Limit who can modify Defender settings via Group Policy or local policy. Enforce least privilege to reduce the chance of unauthorized exclusions.
  • Investigate suspicious paths: Pay special attention to exclusions on broad locations such as C:\, C:\Temp, C:\Users, or Downloads, which are commonly abused by malware.
  • Use centralized management: Manage exclusions through Intune or Group Policy rather than ad hoc local changes, and maintain an approved list of necessary exclusions.

Security vendors like Huntress now collect telemetry on exclusion-related registry activity and flag suspicious exclusions and the use of the hide setting. This helps defenders catch abuse even when PowerShell queries appear clean.

As attackers refine their techniques, hiding Defender exclusions adds a stealth layer to an already powerful evasion method. Defenders must go beyond surface-level checks and monitor the underlying configuration to maintain visibility.

Join 16,000+ SOC teams using ANY.RUN to streamline threat investigations and reduce manual effort. Explore for your team 

Varshini
Varshini
Varshini is a Cyber Security expert in Threat Analysis, Vulnerability Assessment, and Research. Passionate about staying ahead of emerging Threats and Technologies..

Trending News

Related Stories