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

Detection rule

Deletion of Volume Shadow Copies via WMI with PowerShell

HighTest-data validatedSigmaHQ (community)T1490

Overview

Detects deletion of Windows Volume Shadow Copies with PowerShell code and Get-WMIObject. This technique is used by numerous ransomware families such as Sodinokibi/REvil

Rule id
21ff4ca9-f13a-41ad-b828-0077b2af2e40
ATT&CK techniques
T1490 Inhibit System Recovery
Severity
High
Confidence
Low
Origin
SigmaHQ (community)
SigmaHQ status
test
Used in defense packs
n0n, The Gentlemen, qilin, Akira, safepay, Play, everest, 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.

1 of 1 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) · 21ff4ca9-f13a-41ad-b828-0077b2af2e40

Download
title: Deletion of Volume Shadow Copies via WMI with PowerShell
id: 21ff4ca9-f13a-41ad-b828-0077b2af2e40
related:
    - id: e17121b4-ef2a-4418-8a59-12fb1631fa9e
      type: derived
    - id: c1337eb8-921a-4b59-855b-4ba188ddcc42
      type: similar
status: test
description: Detects deletion of Windows Volume Shadow Copies with PowerShell code and Get-WMIObject. This technique is used by numerous ransomware families such as Sodinokibi/REvil
references:
    - https://github.com/redcanaryco/atomic-red-team/blob/f339e7da7d05f6057fdfcdd3742bfcf365fee2a9/atomics/T1490/T1490.md#atomic-test-5---windows---delete-volume-shadow-copies-via-wmi-with-powershell
    - https://www.elastic.co/guide/en/security/current/volume-shadow-copy-deletion-via-powershell.html
author: Tim Rauch, Elastic (idea)
date: 2022-09-20
modified: 2022-12-30
tags:
    - attack.impact
    - attack.t1490
logsource:
    category: process_creation
    product: windows
detection:
    selection_get:
        CommandLine|contains:
            - 'Get-WmiObject'
            - 'gwmi'
            - 'Get-CimInstance'
            - 'gcim'
    selection_shadowcopy:
        CommandLine|contains: 'Win32_ShadowCopy'
    selection_delete:
        CommandLine|contains:
            - '.Delete()'
            - 'Remove-WmiObject'
            - 'rwmi'
            - 'Remove-CimInstance'
            - 'rcim'
    condition: all of selection*
falsepositives:
    - Unknown
level: high

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 (LOWER(Command) LIKE '%get-wmiobject%' OR LOWER(Command) LIKE '%gwmi%' OR LOWER(Command) LIKE '%get-ciminstance%' OR LOWER(Command) LIKE '%gcim%') AND LOWER(Command) LIKE '%win32_shadowcopy%' AND (LOWER(Command) LIKE '%.delete()%' OR LOWER(Command) LIKE '%remove-wmiobject%' OR LOWER(Command) LIKE '%rwmi%' OR LOWER(Command) LIKE '%remove-ciminstance%' OR LOWER(Command) LIKE '%rcim%')

QRadar CRE

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

Rule name
OffSet7: Deletion of Volume Shadow Copies via WMI with PowerShell
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:Deletion of Volume Shadow Copies via WMI with Po:selection_get (match)
    All test lines must match (AND).
    • Command contains: Get-WmiObject, gwmi, Get-CimInstance, gcim
  • BB:OffSet7:Deletion of Volume Shadow Copies via WMI with Po:selection_shadowcopy (match)
    All test lines must match (AND).
    • Command contains: Win32_ShadowCopy
  • BB:OffSet7:Deletion of Volume Shadow Copies via WMI with Po:selection_delete (match)
    All test lines must match (AND).
    • Command contains: .Delete(), Remove-WmiObject, rwmi, Remove-CimInstance, rcim

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:Deletion of Volume Shadow Copies via WMI with Po:selection_get, BB:OffSet7:Deletion of Volume Shadow Copies via WMI with Po:selection_shadowcopy, BB:OffSet7:Deletion of Volume Shadow Copies via WMI with Po:selection_delete])

Main rule, option B (AQL filter test)

  1. when the event matches this AQL filter query: devicetype=12 AND (LOWER(Command) LIKE '%get-wmiobject%' OR LOWER(Command) LIKE '%gwmi%' OR LOWER(Command) LIKE '%get-ciminstance%' OR LOWER(Command) LIKE '%gcim%') AND LOWER(Command) LIKE '%win32_shadowcopy%' AND (LOWER(Command) LIKE '%.delete()%' OR LOWER(Command) LIKE '%remove-wmiobject%' OR LOWER(Command) LIKE '%rwmi%' OR LOWER(Command) LIKE '%remove-ciminstance%' OR LOWER(Command) LIKE '%rcim%')

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.

(CommandLine IN ("*Get-WmiObject*", "*gwmi*", "*Get-CimInstance*", "*gcim*")) CommandLine="*Win32_ShadowCopy*" (CommandLine IN ("*.Delete()*", "*Remove-WmiObject*", "*rwmi*", "*Remove-CimInstance*", "*rcim*"))

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

[Deletion of Volume Shadow Copies via WMI with PowerShell]
description = Detects deletion of Windows Volume Shadow Copies with PowerShell code and Get-WMIObject. This technique is used by numerous ransomware families such as Sodinokibi/REvil
search = (CommandLine IN ("*Get-WmiObject*", "*gwmi*", "*Get-CimInstance*", "*gcim*")) CommandLine="*Win32_ShadowCopy*" (CommandLine IN ("*.Delete()*", "*Remove-WmiObject*", "*rwmi*", "*Remove-CimInstance*", "*rcim*"))

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 (TargetProcessCommandLine contains "Get-WmiObject" or TargetProcessCommandLine contains "gwmi" or TargetProcessCommandLine contains "Get-CimInstance" or TargetProcessCommandLine contains "gcim") and TargetProcessCommandLine contains "Win32_ShadowCopy" and (TargetProcessCommandLine contains ".Delete()" or TargetProcessCommandLine contains "Remove-WmiObject" or TargetProcessCommandLine contains "rwmi" or TargetProcessCommandLine contains "Remove-CimInstance" or TargetProcessCommandLine contains "rcim")

Defender XDR

Microsoft Defender XDR KQLHunting query

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

DeviceProcessEvents
| where (ProcessCommandLine contains "Get-WmiObject" or ProcessCommandLine contains "gwmi" or ProcessCommandLine contains "Get-CimInstance" or ProcessCommandLine contains "gcim") and ProcessCommandLine contains "Win32_ShadowCopy" and (ProcessCommandLine contains ".Delete()" or ProcessCommandLine contains "Remove-WmiObject" or ProcessCommandLine contains "rwmi" or ProcessCommandLine contains "Remove-CimInstance" or ProcessCommandLine contains "rcim")

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.command_line:(*Get\-WmiObject* OR *gwmi* OR *Get\-CimInstance* OR *gcim*)) AND process.command_line:*Win32_ShadowCopy* AND (process.command_line:(*.Delete\(\)* OR *Remove\-WmiObject* OR *rwmi* OR *Remove\-CimInstance* OR *rcim*))

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.command_line like~ ("*Get-WmiObject*", "*gwmi*", "*Get-CimInstance*", "*gcim*")) and process.command_line:"*Win32_ShadowCopy*" and (process.command_line like~ ("*.Delete()*", "*Remove-WmiObject*", "*rwmi*", "*Remove-CimInstance*", "*rcim*"))

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.command_line like "*Get-WmiObject*" or process.command_line like "*gwmi*" or process.command_line like "*Get-CimInstance*" or process.command_line like "*gcim*") and process.command_line like "*Win32_ShadowCopy*" and (process.command_line like "*.Delete()*" or process.command_line like "*Remove-WmiObject*" or process.command_line like "*rwmi*" or process.command_line like "*Remove-CimInstance*" or process.command_line like "*rcim*")

Required telemetry

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

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
Tim Rauch, Elastic (idea)
Source
SigmaHQ · rules/windows/process_creation/proc_creation_win_powershell_shadowcopy_deletion.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