Operator On The Wire
Join
← Back to Knowledge Base
BLUE TEAM / THREAT HUNT / WINDOWS / EVASION

Defender Tampering

This note documents detection patterns related to Defender Tampering within Windows environments.


Direct Indicators

LogEvent IDMeaningForensic ValueNotes
Security4688Process creationCriticalDetects tampering commands and helper binaries.
Sysmon1Process creationCriticalBest lineage source for tampering chains.
Security5007Defender configuration changedCriticalPrimary Defender tamper signal.
Sysmon13Registry value setCriticalDefender registry exclusions and disablement.
PowerShell4104Script block loggingCriticalSet-MpPreference and exclusion commands.
Sysmon11File createMediumPayload appears immediately after protection change.

Indirect Indicators

IndicatorWhat To Look ForForensic ValueNotes
Exclusions addedPath / extension / process exclusionsCriticalCore tampering primitive.
Real-time protection disabledSilent protection dropCriticalHigh-confidence signal.
Defender service untouched but config alteredStealthier tamperCriticalCommon operator method.
Payload appears after exclusionStrong attack sequenceCriticalHigh-confidence correlation.
PowerShell uses Set-MpPreferenceCore tamper methodCriticalVery strong indicator.
Registry edits under Defender keysManual tamperingHighValuable artifact

Common Tools

ToolUsage
PowerShellSet-MpPreference
reg.exeDefender registry changes
MpCmdRun.exeDefender manipulation
custom loadersExclusion staging

Relevant Artifacts

  • Security Event IDs 4688, 5007
  • Sysmon Event IDs 1, 13, 11
  • PowerShell 4104
  • Registry paths:
    • HKLM\SOFTWARE\Microsoft\Windows Defender
  • Exclusion values
  • Prefetch:
    • POWERSHELL.EXE
    • REG.EXE

MITRE ATT&CK References

  • T1562.001 Impair Defenses

Decision Tree

  1. Which tamper method?

    • PowerShell
    • Registry
    • Defender CLI
  2. Which setting changed?

    • Exclusion
    • Realtime protection
    • Monitoring
  3. Payload follows?

    • Drop
    • Injection
    • Loader
  4. Cleanup observed?

    • Re-enable later
    • Temporary exclusion
  5. Expand:

    • AMSI bypass
    • ETW tampering
    • Payload source
  6. Scope:

    • Single host
    • Repeated admin abuse
    • Campaign pattern

Example Detection Templates

KQL

SecurityEvent
| where EventID == 5007
| project TimeGenerated, Computer, EventData
PowerShell
| where EventID == 4104
| where ScriptBlockText has "Set-MpPreference"
| project TimeGenerated, Computer, ScriptBlockText

EQL

process where process.command_line like "*Set-MpPreference*"
sequence by host.name with maxspan=5m
  [ any where event.code == "5007" ]
  [ process where process.name in ("powershell.exe","reg.exe") ]

Sigma

title: Defender Tampering Detection
id: 7b1d4c13-defender-tamper
status: experimental
description: Detects Microsoft Defender tampering activity
references:
  - https://attack.mitre.org/
author: Vergil
date: 2026-03-07
logsource:
  product: windows
  service: powershell
detection:
  selection:
    ScriptBlockText|contains: 'Set-MpPreference'
  condition: selection
fields:
  - ScriptBlockText
falsepositives:
  - Legitimate administration
level: high
tags:
  - attack.defense_evasion

Mitigation & Hardening

Control AreaMitigationEffectivenessNotes
Alert on 5007Primary tamper signalCriticalCore visibility
Preserve 4104Strong PowerShell evidenceCriticalHigh-value
Watch exclusionsLow false positivesCriticalStrong signal
Correlate payload after tamperHigh-confidence chainCriticalPowerful triage
Restrict Defender config rightsReduce abuseHighPrevent tampering