Latest alertCVE-2018-11776 in Apache Struts Confirmed Exploited in the WildRead
Search all news in the platform

Detection rule

Potential Windows Defender Tampering Via Wmic.EXE

HighTest-data validatedSigmaHQ (community)T1047T1685

Overview

Detects potential tampering with Windows Defender settings such as adding exclusion using wmic

Rule id
51cbac1e-eee3-4a90-b1b7-358efb81fa0a
ATT&CK techniques
T1047 Windows Management Instrumentation, T1685 Disable or Modify Tools
Severity
High
Confidence
Low
Origin
SigmaHQ (community)
SigmaHQ status
test
Used in defense packs
n0n, The Gentlemen, qilin, INC Ransom, Akira, safepay, Play, nightspire, braincipher, majinahanashi

Validation

  1. ExperimentalSyntax checked only. Not yet tested on events.
  2. Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
  3. SIEM-validatedRun in a real SIEM, with a recorded result.

2 of 2 positive test events matched; 1 of 1 near-miss events were correctly ignored. Community rule reused unmodified from SigmaHQ. OffSet7 converted it and tested it on synthetic events.

Detection logic and queries

Queries are shown exactly as generated. Test them in your environment before you deploy them.

Sigma

Sigma (YAML) · 51cbac1e-eee3-4a90-b1b7-358efb81fa0a

Download
title: Potential Windows Defender Tampering Via Wmic.EXE
id: 51cbac1e-eee3-4a90-b1b7-358efb81fa0a
status: test
description: Detects potential tampering with Windows Defender settings such as adding exclusion using wmic
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/5c1e6f1b4fafd01c8d1ece85f510160fc1275fbf/atomics/T1562.001/T1562.001.md
    - https://www.bleepingcomputer.com/news/security/gootkit-malware-bypasses-windows-defender-by-setting-path-exclusions/
    - https://www.bleepingcomputer.com/news/security/iobit-forums-hacked-to-spread-ransomware-to-its-members/
author: frack113
date: 2022-12-11
modified: 2023-02-14
tags:
    - attack.execution
    - attack.defense-impairment
    - attack.t1047
    - attack.t1685
logsource:
    product: windows
    category: process_creation
detection:
    selection_img:
        - OriginalFileName: 'wmic.exe'
        - Image|endswith: '\WMIC.exe'
    selection_cli:
        CommandLine|contains: '/Namespace:\\\\root\\Microsoft\\Windows\\Defender'
    condition: all of selection_*
falsepositives:
    - Unknown
level: high
simulation:
    - type: atomic-red-team
      name: WMIC Tamper with Windows Defender Evade Scanning Folder
      technique: T1562.001
      atomic_guid: 59d386fc-3a4b-41b8-850d-9e3eee24dfe4
regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_wmic_namespace_defender/info.yml

QRadar AQL

IBM QRadar AQL (hunting query)Hunting query

Hunting search for the Log Activity tab or the API. It is not a QRadar rule.

AQL search for the Log Activity tab or the API. It is NOT a deployable QRadar rule: real-time detection in QRadar is a CRE (Custom Rule Engine) rule, for which this build only writes a design specification (qradar_cre).

SELECT * FROM events WHERE devicetype=12 AND (Filename='wmic.exe' OR (LOWER("Process Path") LIKE '%\wmic.exe' OR LOWER("Process Name") LIKE '%\wmic.exe')) AND LOWER(Command) LIKE '%/namespace:\\root\microsoft\windows\defender%'

QRadar CRE

Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.

Rule name
OffSet7: Potential Windows Defender Tampering Via Wmic.EXE
Rule type
Event rule (Local)
Log source types
Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1

Building blocks

  • BB:OffSet7:Potential Windows Defender Tampering Via Wmic EX:selection_img (match)
    Any of the groups matches (OR): build one BB per group and a parent BB "when an event matches any of" them.
    • Filename is equal to (case-insensitive): wmic.exe
    • Process Path / Process Name ends with: \WMIC.exe
  • BB:OffSet7:Potential Windows Defender Tampering Via Wmic EX:selection_cli (match)
    All test lines must match (AND).
    • Command contains: /Namespace:\\\\root\\Microsoft\\Windows\\Defender

Main rule, option A (building blocks)

  1. when the event(s) were detected by one or more of these log source types: Microsoft Windows Security Event Log DSM: Security 4688 (with command-line auditing) or Sysmon EID 1
  2. when an event matches the condition built from these building blocks: (ALL of [BB:OffSet7:Potential Windows Defender Tampering Via Wmic EX:selection_img, BB:OffSet7:Potential Windows Defender Tampering Via Wmic EX:selection_cli])

Main rule, option B (AQL filter test)

  1. when the event matches this AQL filter query: devicetype=12 AND (Filename='wmic.exe' OR (LOWER("Process Path") LIKE '%\wmic.exe' OR LOWER("Process Name") LIKE '%\wmic.exe')) AND LOWER(Command) LIKE '%/namespace:\\root\microsoft\windows\defender%'

Rule response

  • Severity 7, credibility 6, relevance 7
  • Ensure the detected event is part of an offense; index offense on Log Source (host) and annotate with the rule title and OffSet7 rule id
  • Respond no more than once per 30 minutes per Log Source (tune per environment)

Limitations

  • QRadar AQL LIKE / CRE string tests are case-sensitive unless the property is lower-cased; the AQL option uses LOWER() where the backend applied it.

Splunk

Splunk SPLSearch

Search for Splunk with Windows/Sysmon field names. A scheduled search or ES correlation search also needs a schedule, time range, throttling and an adaptive response, set in your environment.

(OriginalFileName="wmic.exe" OR Image="*\\WMIC.exe") CommandLine="*/Namespace:\\\\root\\Microsoft\\Windows\\Defender*"

Splunk savedsearches.conf stanzaScheduled search template

Template stanza. Review schedule, alert actions and index/sourcetype for your environment before enabling.

[default]
dispatch.earliest_time = -30d
dispatch.latest_time = now

[Potential Windows Defender Tampering Via Wmic.EXE]
description = Detects potential tampering with Windows Defender settings such as adding exclusion using wmic
search = (OriginalFileName="wmic.exe" OR Image="*\\WMIC.exe") CommandLine="*/Namespace:\\\\root\\Microsoft\\Windows\\Defender*"

Microsoft Sentinel

Microsoft Sentinel KQL (ASIM)Hunting query

Hunting query over ASIM-normalized tables. An analytics rule also needs a schedule, entity mapping and alert grouping.

imProcessCreate
| where (TargetProcessFileOriginalName =~ "wmic.exe" or TargetProcessName endswith "\\WMIC.exe") and TargetProcessCommandLine contains "/Namespace:\\\\root\\Microsoft\\Windows\\Defender"

Defender XDR

Microsoft Defender XDR KQLHunting query

Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.

DeviceProcessEvents
| where (ProcessVersionInfoOriginalFileName =~ "wmic.exe" or FolderPath endswith "\\WMIC.exe") and ProcessCommandLine contains "/Namespace:\\\\root\\Microsoft\\Windows\\Defender"

Elastic

Elastic Lucene (ECS)Hunting query

Lucene query over ECS fields (Winlogbeat/Elastic Agent Windows mappings). A detection rule also needs an index pattern, schedule and actions.

(process.pe.original_file_name:wmic.exe OR process.executable:*\\WMIC.exe) AND process.command_line:*\/Namespace\:\\\\root\\Microsoft\\Windows\\Defender*

Elastic EQL (ECS)Hunting query

EQL query over ECS fields. Usable in an Elastic Security EQL rule after review; index pattern and schedule are set per environment.

any where (process.pe.original_file_name:"wmic.exe" or process.executable:"*\\WMIC.exe") and process.command_line:"*/Namespace:\\\\root\\Microsoft\\Windows\\Defender*"

Elastic ES|QL (ECS)Hunting query

ES|QL query over ECS fields; the FROM clause uses * and must be narrowed to your indices.

from * metadata _id, _index, _version | where (process.pe.original_file_name=="wmic.exe" or ends_with(process.executable, "\\WMIC.exe")) and process.command_line like "*/Namespace:\\\\\\\\root\\\\Microsoft\\\\Windows\\\\Defender*"

Required telemetry

Log source
product: windows · category: process_creation
Fields used
CommandLine Image OriginalFileName

False positives

  • Unknown

Investigation and response

No OffSet7 investigation guidance has been written for this rule yet. Start from the false positives above and the ATT&CK technique pages.

References

Author and attribution

Author
frack113
Source
SigmaHQ · rules/windows/process_creation/proc_creation_win_wmic_namespace_defender.yml
Upstream commit
9688134317a2
Licence
Detection Rule License (DRL) 1.1

Version history

  1. Version 1Imported from SigmaHQ
  2. OffSet7 build · SigmaHQ 9688134317a2

Related rules