Detection rules › Sigma

Microsoft Defender default action changed to allow any threat (PowerShell)

Status
experimental
Severity
high
Log source
product windows, category ['ps_module', 'ps_classic_script', 'ps_script']
Author
mdecrevoisier
Source
github.com/mdecrevoisier/SIGMA-detection-rules

Detects scenarios where an attacker attempts to change Defender default action to allow any threats

MITRE ATT&CK coverage

Event coverage

Rule body yaml

title: Microsoft Defender default action changed to allow any threat (PowerShell)
description: Detects scenarios where an attacker attempts to change Defender default action to allow any threats
references:
- https://github.com/mdecrevoisier/EVTX-to-MITRE-Attack/tree/master/TA0005-Defense%20Evasion/T1562.001-Impair%20Defenses-Disable%20or%20Modify%20tool
- https://github.com/swagkarna/Defeat-Defender-V1.2
- https://docs.microsoft.com/en-us/powershell/module/defender/set-mppreference?view=windowsserver2019-ps
- https://docs.microsoft.com/en-us/windows/client-management/mdm/defender-csp
- https://powershell.one/wmi/root/microsoft/windows/defender/msft_mppreference
- https://gist.github.com/pe3zx/7c5e0080c3b0869ccba1f1dc2ea0c5e0
- https://thedfirreport.com/2020/11/23/pysa-mespinoza-ransomware/
- https://cloudbrothers.info/en/current-limits-defender-av-tamper-protection/
tags:
- attack.defense_evasion
- attack.t1562.001
author: mdecrevoisier
status: experimental
logsource:
  product: windows
  category:
    - ps_module
    - ps_classic_script
    - ps_script
detection: # Set-MpPreference -UnknownThreatDefaultAction Allow -LowThreatDefaultAction Allow -HighThreatDefaultAction Allow  -ModerateThreatDefaultAction Allow   -SevereThreatDefaultAction Allow
  selection1_powershell_native:
    EventID: 800
    EventData|contains|all:
      - Set-MpPreference
      - Add-MpPreference
    EventData|contains:
      - '6' # MP_THREAT_ACTION_ALLOW
      - 'Allow'
    EventData|contains:
      - HighThreatDefaultAction
      - ModerateThreatDefaultAction
      - LowThreatDefaultAction
      - SevereThreatDefaultAction
      - UnknownThreatDefaultAction 
      - ThreatIDDefaultAction_Actions # used with "Add-MpPreference" for a specific identified threat

  selection2_powershell_modern:
    EventID: 4103
    Payload|contains|all:
      - Set-MpPreference
      - Add-MpPreference
    Payload|contains:
      - '6' # MP_THREAT_ACTION_ALLOW
      - 'Allow'
    Payload|contains:
      - HighThreatDefaultAction
      - ModerateThreatDefaultAction
      - LowThreatDefaultAction
      - SevereThreatDefaultAction
      - UnknownThreatDefaultAction 
      - ThreatIDDefaultAction_Actions # used with "Add-MpPreference" for a specific identified threat

  selection3_powershell_block:
    EventID: 4104
    ScriptBlockText|contains|all:
      - Set-MpPreference
      - Add-MpPreference
    ScriptBlockText|contains:
      - '6' # MP_THREAT_ACTION_ALLOW
      - 'Allow'
    ScriptBlockText|contains:
      - HighThreatDefaultAction
      - ModerateThreatDefaultAction
      - LowThreatDefaultAction
      - SevereThreatDefaultAction
      - UnknownThreatDefaultAction 
      - ThreatIDDefaultAction_Actions # used with "Add-MpPreference" for a specific identified threat

  condition: 1 of selection*
falsepositives:
- None
level: high

Stages and Predicates

Stage 0: condition

1 of selection*

Stage 1: selection1_powershell_native

selection1_powershell_native:
  EventID: 800
  EventData|contains|all:
    - Set-MpPreference
    - Add-MpPreference
  EventData|contains:
    - '6'
    - 'Allow'
  EventData|contains:
    - HighThreatDefaultAction
    - ModerateThreatDefaultAction
    - LowThreatDefaultAction
    - SevereThreatDefaultAction
    - UnknownThreatDefaultAction
    - ThreatIDDefaultAction_Actions

Stage 2: selection2_powershell_modern

selection2_powershell_modern:
  EventID: 4103
  Payload|contains|all:
    - Set-MpPreference
    - Add-MpPreference
  Payload|contains:
    - '6'
    - 'Allow'
  Payload|contains:
    - HighThreatDefaultAction
    - ModerateThreatDefaultAction
    - LowThreatDefaultAction
    - SevereThreatDefaultAction
    - UnknownThreatDefaultAction
    - ThreatIDDefaultAction_Actions

Stage 3: selection3_powershell_block

selection3_powershell_block:
  EventID: 4104
  ScriptBlockText|contains|all:
    - Set-MpPreference
    - Add-MpPreference
  ScriptBlockText|contains:
    - '6'
    - 'Allow'
  ScriptBlockText|contains:
    - HighThreatDefaultAction
    - ModerateThreatDefaultAction
    - LowThreatDefaultAction
    - SevereThreatDefaultAction
    - UnknownThreatDefaultAction
    - ThreatIDDefaultAction_Actions

Indicators

Each row is a field, operator, and value that the rule matches. The corpus column counts how many other rules in the catalog look for the same combination: high numbers point to widely-used, community-vetted indicators. Blank or 1 shows that the indicator is specific to this rule.

FieldKindValues
EventDatamatch
  • Add-MpPreference corpus 4 (sigma 4)
  • HighThreatDefaultAction
  • LowThreatDefaultAction
  • ModerateThreatDefaultAction
  • Set-MpPreference corpus 5 (sigma 5)
  • SevereThreatDefaultAction
  • ThreatIDDefaultAction_Actions
  • UnknownThreatDefaultAction
Payloadmatch
  • Add-MpPreference corpus 2 (sigma 2)
  • HighThreatDefaultAction
  • LowThreatDefaultAction
  • ModerateThreatDefaultAction
  • Set-MpPreference corpus 2 (sigma 2)
  • SevereThreatDefaultAction
  • ThreatIDDefaultAction_Actions
  • UnknownThreatDefaultAction
ScriptBlockTextmatch
  • Add-MpPreference corpus 2 (sigma 2)
  • HighThreatDefaultAction
  • LowThreatDefaultAction
  • ModerateThreatDefaultAction
  • Set-MpPreference corpus 3 (sigma 3)
  • SevereThreatDefaultAction
  • ThreatIDDefaultAction_Actions
  • UnknownThreatDefaultAction