Detection rule
Suspicious Windows Trace ETW Session Tamper Via Logman.EXE
Overview
Detects the execution of "logman" utility in order to disable or delete Windows trace sessions
- Rule id
cd1f961e-0b96-436b-b7c6-38da4583ec00- ATT&CK techniques
- T1685 Disable or Modify Tools, T1685.005 Disable or Modify Tools: Clear Windows Event Logs
- Severity
- High
- Confidence
- Low
- Origin
- SigmaHQ (community)
- SigmaHQ status
test- Used in defense packs
- n0n, The Gentlemen, qilin, INC Ransom, Akira, safepay, Play, braincipher, majinahanashi
Validation
- ExperimentalSyntax checked only. Not yet tested on events.
- Test-data validatedMatched positive test events and ignored near-miss events. Not yet run in a production SIEM.
- 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) · cd1f961e-0b96-436b-b7c6-38da4583ec00
title: Suspicious Windows Trace ETW Session Tamper Via Logman.EXE
id: cd1f961e-0b96-436b-b7c6-38da4583ec00
status: test
description: Detects the execution of "logman" utility in order to disable or delete Windows trace sessions
references:
- https://twitter.com/0gtweet/status/1359039665232306183?s=21
- https://ss64.com/nt/logman.html
author: Florian Roth (Nextron Systems)
date: 2021-02-11
modified: 2023-02-21
tags:
- attack.defense-impairment
- attack.t1685
- attack.t1685.005
logsource:
category: process_creation
product: windows
detection:
selection_img:
- Image|endswith: '\logman.exe'
- OriginalFileName: 'Logman.exe'
selection_action:
CommandLine|contains:
- 'stop '
- 'delete '
selection_service:
CommandLine|contains:
- 'Circular Kernel Context Logger'
- 'EventLog-' # Cover multiple traces starting with EventLog-*
- 'SYSMON TRACE'
- 'SysmonDnsEtwSession'
condition: all of selection*
falsepositives:
- Legitimate deactivation by administrative staff
- Installer tools that disable services, e.g. before log collection agent installation
level: highQRadar 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("Process Path") LIKE '%\logman.exe' OR LOWER("Process Name") LIKE '%\logman.exe') OR Filename='Logman.exe') AND (LOWER(Command) LIKE '%stop %' OR LOWER(Command) LIKE '%delete %') AND (LOWER(Command) LIKE '%circular kernel context logger%' OR LOWER(Command) LIKE '%eventlog-%' OR LOWER(Command) LIKE '%sysmon trace%' OR LOWER(Command) LIKE '%sysmondnsetwsession%')QRadar CRE
Design for the QRadar Rule Wizard. It is not importable and has not been tested in QRadar.
- Rule name
OffSet7: Suspicious Windows Trace ETW Session Tamper Via Logman.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:Suspicious Windows Trace ETW Session Tamper Via :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.Process Path / Process Nameends with:\logman.exeFilenameis equal to (case-insensitive):Logman.exe
BB:OffSet7:Suspicious Windows Trace ETW Session Tamper Via :selection_action(match)All test lines must match (AND).Commandcontains:stop,delete
BB:OffSet7:Suspicious Windows Trace ETW Session Tamper Via :selection_service(match)All test lines must match (AND).Commandcontains:Circular Kernel Context Logger,EventLog-,SYSMON TRACE,SysmonDnsEtwSession
Main rule, option A (building blocks)
- 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 - when an event matches the condition built from these building blocks:
(ALL of [BB:OffSet7:Suspicious Windows Trace ETW Session Tamper Via :selection_img, BB:OffSet7:Suspicious Windows Trace ETW Session Tamper Via :selection_action, BB:OffSet7:Suspicious Windows Trace ETW Session Tamper Via :selection_service])
Main rule, option B (AQL filter test)
- when the event matches this AQL filter query:
devicetype=12 AND ((LOWER("Process Path") LIKE '%\logman.exe' OR LOWER("Process Name") LIKE '%\logman.exe') OR Filename='Logman.exe') AND (LOWER(Command) LIKE '%stop %' OR LOWER(Command) LIKE '%delete %') AND (LOWER(Command) LIKE '%circular kernel context logger%' OR LOWER(Command) LIKE '%eventlog-%' OR LOWER(Command) LIKE '%sysmon trace%' OR LOWER(Command) LIKE '%sysmondnsetwsession%')
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.
(Image="*\\logman.exe" OR OriginalFileName="Logman.exe") (CommandLine IN ("*stop *", "*delete *")) (CommandLine IN ("*Circular Kernel Context Logger*", "*EventLog-*", "*SYSMON TRACE*", "*SysmonDnsEtwSession*"))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
[Suspicious Windows Trace ETW Session Tamper Via Logman.EXE]
description = Detects the execution of "logman" utility in order to disable or delete Windows trace sessions
search = (Image="*\\logman.exe" OR OriginalFileName="Logman.exe") (CommandLine IN ("*stop *", "*delete *")) (CommandLine IN ("*Circular Kernel Context Logger*", "*EventLog-*", "*SYSMON TRACE*", "*SysmonDnsEtwSession*"))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 (TargetProcessName endswith "\\logman.exe" or TargetProcessFileOriginalName =~ "Logman.exe") and (TargetProcessCommandLine contains "stop " or TargetProcessCommandLine contains "delete ") and (TargetProcessCommandLine contains "Circular Kernel Context Logger" or TargetProcessCommandLine contains "EventLog-" or TargetProcessCommandLine contains "SYSMON TRACE" or TargetProcessCommandLine contains "SysmonDnsEtwSession")Defender XDR
Microsoft Defender XDR KQLHunting query
Advanced hunting query. A custom detection rule also needs a frequency, impacted entities and actions.
DeviceProcessEvents
| where (FolderPath endswith "\\logman.exe" or ProcessVersionInfoOriginalFileName =~ "Logman.exe") and (ProcessCommandLine contains "stop " or ProcessCommandLine contains "delete ") and (ProcessCommandLine contains "Circular Kernel Context Logger" or ProcessCommandLine contains "EventLog-" or ProcessCommandLine contains "SYSMON TRACE" or ProcessCommandLine contains "SysmonDnsEtwSession")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.executable:*\\logman.exe OR process.pe.original_file_name:Logman.exe) AND (process.command_line:(*stop\ * OR *delete\ *)) AND (process.command_line:(*Circular\ Kernel\ Context\ Logger* OR *EventLog\-* OR *SYSMON\ TRACE* OR *SysmonDnsEtwSession*))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.executable:"*\\logman.exe" or process.pe.original_file_name:"Logman.exe") and (process.command_line like~ ("*stop *", "*delete *")) and (process.command_line like~ ("*Circular Kernel Context Logger*", "*EventLog-*", "*SYSMON TRACE*", "*SysmonDnsEtwSession*"))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 (ends_with(process.executable, "\\logman.exe") or process.pe.original_file_name=="Logman.exe") and (process.command_line like "*stop *" or process.command_line like "*delete *") and (process.command_line like "*Circular Kernel Context Logger*" or process.command_line like "*EventLog-*" or process.command_line like "*SYSMON TRACE*" or process.command_line like "*SysmonDnsEtwSession*")Required telemetry
- Log source
product: windows · category: process_creation- Fields used
CommandLineImageOriginalFileName
False positives
- Legitimate deactivation by administrative staff
- Installer tools that disable services, e.g. before log collection agent installation
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
- Florian Roth (Nextron Systems)
- Source
- SigmaHQ ·
rules/windows/process_creation/proc_creation_win_logman_disable_eventlog.yml - Upstream commit
9688134317a2- Licence
- Detection Rule License (DRL) 1.1
Version history
- Version 1Imported from SigmaHQ
- OffSet7 build · SigmaHQ
9688134317a2