Skip to content
WETNav

Defense evasionHigh

Microsoft Defender tampering

Also known as AV disabling, Exclusion abuse

Turning off Defender real-time protection or adding exclusion paths so tools run unscanned. Defender 5001 and 5007 record both.

Signals in the logs

  1. 01Defender5001Real-time protection was disabledAny host

    Real-time protection was disabled.

  2. 02Defender5007Defender configuration changedAny host

    A Defender configuration value changed; an added exclusion appears as the new value.

    New value
    registry path such as HKLM\SOFTWARE\Microsoft\Windows Defender\Exclusions\Paths\<added path>
    Old value
    previous value, often empty for a newly added exclusion
  3. 03Defender5010Scanning for malware is disabledAny host

    Scanning for malware and other potentially unwanted software was disabled.

  4. 04Defender5012Scanning for viruses is disabledAny host

    Scanning for viruses was disabled.

What happens

Microsoft Defender Antivirus is usually the first control an intruder weakens. Set-MpPreference -DisableRealtimeMonitoring $true, the Set-MpPreference -ExclusionPath and -ExclusionProcess parameters, and direct edits to the Defender registry policy keys all let an operator either stop real-time scanning outright or carve out a folder or process that Defender will ignore. Exclusions are the quieter choice because protection stays nominally on. Defender logs these changes in its own operational channel: 5001 marks real-time protection being disabled, and 5007 records a configuration change with the registry value, so an added exclusion appears as the new path or process in the 5007 new value. Because Defender writes these to its operational log rather than the Security log, they often survive a Security log clear.

Logging you need

  • The Microsoft Defender Antivirus operational log is enabled by default where Defender is the active antivirus.
  • These events are absent if a third-party antivirus has disabled Defender, so first confirm Defender is the active product.
  • Correlating the command that made the change needs Security 4688 with command-line auditing, or Sysmon 1, for powershell.exe or reg.exe.

Hunt queries

Starting points. Tune thresholds and exclusions to your environment before alerting on them.

Get-WinEvent -FilterHashtable @{LogName='Microsoft-Windows-Windows Defender/Operational'; Id=5001,5007,5010,5012}

Benign look-alikes

  • Legitimate software installs that register their own folders as Defender exclusions.
  • Administrators disabling real-time protection briefly to install or troubleshoot software.
  • Deployment of an approved enterprise antivirus that turns Defender off (passive mode).

Notes

  • An exclusion added minutes before a tool runs from the excluded path is a strong sequence; pair the 5007 path with later process creation from that path.
  • Set-MpPreference changes may also appear as a registry value set under the Defender policy keys (Sysmon 13), which helps when the Defender log itself was cleared.

References