Clearing Windows Event Logs

Identifies attempts to clear or disable Windows event log stores using Windows wevetutil command. This is often done by attackers in an attempt to evade detection or destroy forensic evidence on a system.

Elastic rule (View on GitHub)

  1[metadata]
  2creation_date = "2020/02/18"
  3integration = ["endpoint", "windows", "system"]
  4maturity = "production"
  5min_stack_comments = "New fields added: required_fields, related_integrations, setup"
  6min_stack_version = "8.3.0"
  7updated_date = "2024/03/28"
  8
  9[rule]
 10author = ["Elastic"]
 11description = """
 12Identifies attempts to clear or disable Windows event log stores using Windows wevetutil command. This is often done by
 13attackers in an attempt to evade detection or destroy forensic evidence on a system.
 14"""
 15from = "now-9m"
 16index = ["winlogbeat-*", "logs-endpoint.events.process-*", "logs-windows.*", "endgame-*", "logs-system.security*"]
 17language = "eql"
 18license = "Elastic License v2"
 19name = "Clearing Windows Event Logs"
 20note = """## Triage and analysis
 21
 22### Investigating Clearing Windows Event Logs
 23
 24Windows event logs are a fundamental data source for security monitoring, forensics, and incident response. Adversaries can tamper, clear, and delete this data to break SIEM detections, cover their tracks, and slow down incident response.
 25
 26This rule looks for the execution of the `wevtutil.exe` utility or the `Clear-EventLog` cmdlet to clear event logs.
 27
 28#### Possible investigation steps
 29
 30- Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
 31- Identify the user account that performed the action and whether it should perform this kind of action.
 32- Contact the account owner and confirm whether they are aware of this activity.
 33- Investigate other alerts associated with the user/host during the past 48 hours.
 34  - Verify if any other anti-forensics behaviors were observed.
 35- Investigate the event logs prior to the action for suspicious behaviors that an attacker may be trying to cover up.
 36
 37### False positive analysis
 38
 39- This mechanism can be used legitimately. Analysts can dismiss the alert if the administrator is aware of the activity and there are justifications for this action.
 40- Analyze whether the cleared event log is pertinent to security and general monitoring. Administrators can clear non-relevant event logs using this mechanism. If this activity is expected and noisy in your environment, consider adding exceptions — preferably with a combination of user and command line conditions.
 41
 42### Response and remediation
 43
 44- Initiate the incident response process based on the outcome of the triage.
 45  - This activity is potentially done after the adversary achieves its objectives on the host. Ensure that previous actions, if any, are investigated accordingly with their response playbooks.
 46- Isolate the involved host to prevent further post-compromise behavior.
 47- Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
 48- Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
 49- Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
 50- Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).
 51"""
 52risk_score = 21
 53rule_id = "d331bbe2-6db4-4941-80a5-8270db72eb61"
 54setup = """## Setup
 55
 56If enabling an EQL rule on a non-elastic-agent index (such as beats) for versions <8.2,
 57events will not define `event.ingested` and default fallback for EQL rules was not added until version 8.2.
 58Hence for this rule to work effectively, users will need to add a custom ingest pipeline to populate
 59`event.ingested` to @timestamp.
 60For more details on adding a custom ingest pipeline refer - https://www.elastic.co/guide/en/fleet/current/data-streams-pipeline-tutorial.html
 61"""
 62severity = "low"
 63tags = [
 64    "Domain: Endpoint",
 65    "OS: Windows",
 66    "Use Case: Threat Detection",
 67    "Tactic: Defense Evasion",
 68    "Resources: Investigation Guide",
 69    "Data Source: Elastic Endgame",
 70    "Data Source: Elastic Defend"
 71]
 72timestamp_override = "event.ingested"
 73type = "eql"
 74
 75query = '''
 76process where host.os.type == "windows" and event.type == "start" and
 77(
 78  (
 79    (process.name : "wevtutil.exe" or ?process.pe.original_file_name == "wevtutil.exe") and
 80    process.args : ("/e:false", "cl", "clear-log")
 81  ) or
 82  (
 83    process.name : ("powershell.exe", "pwsh.exe", "powershell_ise.exe") and
 84    process.args : "Clear-EventLog"
 85  )
 86)
 87'''
 88
 89
 90[[rule.threat]]
 91framework = "MITRE ATT&CK"
 92[[rule.threat.technique]]
 93id = "T1070"
 94name = "Indicator Removal"
 95reference = "https://attack.mitre.org/techniques/T1070/"
 96[[rule.threat.technique.subtechnique]]
 97id = "T1070.001"
 98name = "Clear Windows Event Logs"
 99reference = "https://attack.mitre.org/techniques/T1070/001/"
100
101[[rule.threat.technique.subtechnique]]
102id = "T1562.002"
103name = "Disable Windows Event Logging"
104reference = "https://attack.mitre.org/techniques/T1562/002/"
105
106
107[rule.threat.tactic]
108id = "TA0005"
109name = "Defense Evasion"
110reference = "https://attack.mitre.org/tactics/TA0005/"

Triage and analysis

Investigating Clearing Windows Event Logs

Windows event logs are a fundamental data source for security monitoring, forensics, and incident response. Adversaries can tamper, clear, and delete this data to break SIEM detections, cover their tracks, and slow down incident response.

This rule looks for the execution of the wevtutil.exe utility or the Clear-EventLog cmdlet to clear event logs.

Possible investigation steps

  • Investigate the process execution chain (parent process tree) for unknown processes. Examine their executable files for prevalence, whether they are located in expected locations, and if they are signed with valid digital signatures.
  • Identify the user account that performed the action and whether it should perform this kind of action.
  • Contact the account owner and confirm whether they are aware of this activity.
  • Investigate other alerts associated with the user/host during the past 48 hours.
    • Verify if any other anti-forensics behaviors were observed.
  • Investigate the event logs prior to the action for suspicious behaviors that an attacker may be trying to cover up.

False positive analysis

  • This mechanism can be used legitimately. Analysts can dismiss the alert if the administrator is aware of the activity and there are justifications for this action.
  • Analyze whether the cleared event log is pertinent to security and general monitoring. Administrators can clear non-relevant event logs using this mechanism. If this activity is expected and noisy in your environment, consider adding exceptions — preferably with a combination of user and command line conditions.

Response and remediation

  • Initiate the incident response process based on the outcome of the triage.
    • This activity is potentially done after the adversary achieves its objectives on the host. Ensure that previous actions, if any, are investigated accordingly with their response playbooks.
  • Isolate the involved host to prevent further post-compromise behavior.
  • Investigate credential exposure on systems compromised or used by the attacker to ensure all compromised accounts are identified. Reset passwords for these accounts and other potentially compromised credentials, such as email, business systems, and web services.
  • Run a full antimalware scan. This may reveal additional artifacts left in the system, persistence mechanisms, and malware components.
  • Determine the initial vector abused by the attacker and take action to prevent reinfection through the same vector.
  • Using the incident response data, update logging and audit policies to improve the mean time to detect (MTTD) and the mean time to respond (MTTR).

Related rules

to-top