T1564.012

File/Path Exclusions

Adversaries may attempt to hide their file-based artifacts by writing them to specific folders or file names excluded from antivirus (AV) scanning and other defensive capabilities. AV and other file-based scanners often include exclusions to optimize performance as well as ease installation and legitimate use of applications. These exclusions may be contextual or hardcoded strings referencing specific folders and files assumed to be trusted. Adversaries typically perform a discovery phase first — enumerating existing exclusion paths via registry queries or Get-MpPreference — then stage payloads precisely in those excluded locations to bypass real-time scanning. Turla has been documented placing LunarWeb implant files in AV-excluded directories as part of long-term persistence operations against diplomatic targets.

Microsoft Sentinel / Defender
kusto
let SuspiciousExtensions = dynamic([".exe", ".dll", ".bat", ".ps1", ".vbs", ".hta", ".js", ".cmd", ".scr", ".msi", ".cpl", ".ocx"]);
let DefaultExclusionPaths = dynamic([
    "\\Windows\\Temp\\",
    "\\SoftwareDistribution\\",
    "\\Windows\\SoftwareDistribution\\",
    "\\AppData\\Local\\Temp\\",
    "\\Windows\\WinSxS\\",
    "\\inetpub\\logs\\",
    "\\Windows\\Logs\\",
    "\\ProgramData\\Microsoft\\Windows Defender\\"
]);
let LegitSystemDroppers = dynamic(["svchost.exe", "TrustedInstaller.exe", "wuauclt.exe", "msiexec.exe", "MsMpEng.exe", "WinDefend.exe", "WUDFHost.exe"]);
// Phase 1: Identify devices where exclusion registry keys were queried (adversary discovery)
let ExclusionDiscovery = DeviceRegistryEvents
| where Timestamp > ago(24h)
| where RegistryKey has_any (
    "Windows Defender\\Exclusions\\Paths",
    "Windows Defender\\Exclusions\\Extensions",
    "Windows Defender\\Exclusions\\Processes",
    "Windows Defender\\Exclusions\\TemporaryPaths"
)
| where ActionType in ("RegistryKeyQueried", "RegistryValueRead")
| where InitiatingProcessFileName !in~ (LegitSystemDroppers)
| where InitiatingProcessFileName !in~ ("SecurityHealthService.exe", "SecurityHealthHost.exe")
| summarize DiscoveryTime=min(Timestamp), DiscoveryProcess=any(InitiatingProcessFileName), DiscoveryCmdLine=any(InitiatingProcessCommandLine) by DeviceName;
// Phase 2: Executable/script file creation in known default exclusion paths
DeviceFileEvents
| where Timestamp > ago(24h)
| where ActionType == "FileCreated"
| where FolderPath has_any (DefaultExclusionPaths)
| where FileName has_any (SuspiciousExtensions)
| where InitiatingProcessFileName !in~ (LegitSystemDroppers)
| join kind=leftouter ExclusionDiscovery on DeviceName
| extend PrecededByDiscovery = isnotempty(DiscoveryTime) and (Timestamp - DiscoveryTime) between (0min .. 24h)
| extend ConfidenceLevel = iif(PrecededByDiscovery, "High", "Medium")
| project Timestamp, DeviceName, AccountName, FileName, FolderPath,
         InitiatingProcessFileName, InitiatingProcessCommandLine,
         PrecededByDiscovery, DiscoveryProcess, DiscoveryCmdLine, ConfidenceLevel
| sort by Timestamp desc
high severity medium confidence

Data Sources

File: File Creation Windows Registry: Windows Registry Key Access Microsoft Defender for Endpoint

Required Tables

DeviceFileEvents DeviceRegistryEvents

False Positives

  • Windows Update agent (wuauclt.exe, WUDFHost.exe) legitimately writes executables and packages to SoftwareDistribution during patch download cycles
  • Software installers (msiexec.exe) extracting temporary payload files to %TEMP% or %LOCALAPPDATA%\Temp during installation sequences
  • Security vendors and EDR agents writing their own components to directories they have self-excluded for performance — especially during product updates
  • Developer CI/CD pipelines and build tools that output compiled binaries to %TEMP% directories configured as AV exclusions to speed up builds
  • SCCM or Intune distribution agents staging software packages in excluded directories before deployment execution

Unlock Pro Content

Get the full detection package for T1564.012 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections