Detection rules › Sigma

Potentially Suspicious EventLog Recon Activity Using Log Query Utilities

Status
test
Severity
medium
Log source
product windows, category process_creation
Author
Nasreddine Bencherchali (Nextron Systems), X__Junior (Nextron Systems)
Source
github.com/SigmaHQ/sigma

Detects execution of different log query utilities and commands to search and dump the content of specific event logs or look for specific event IDs. This technique is used by threat actors in order to extract sensitive information from events logs such as usernames, IP addresses, hostnames, etc.

MITRE ATT&CK coverage

TacticTechniques
Credential AccessT1552 Unsecured Credentials
DiscoveryT1087 Account Discovery

Event coverage

ProviderEventTitle
SysmonEvent ID 1Process creation

Rule body yaml

title: Potentially Suspicious EventLog Recon Activity Using Log Query Utilities
id: beaa66d6-aa1b-4e3c-80f5-e0145369bfaf
related:
    - id: 9cd55b6c-430a-4fa9-96f4-7cadf5229e9f
      type: derived
status: test
description: |
    Detects execution of different log query utilities and commands to search and dump the content of specific event logs or look for specific event IDs.
    This technique is used by threat actors in order to extract sensitive information from events logs such as usernames, IP addresses, hostnames, etc.
references:
    - http://blog.talosintelligence.com/2022/09/lazarus-three-rats.html
    - https://thedfirreport.com/2023/10/30/netsupport-intrusion-results-in-domain-compromise/
    - https://www.cisa.gov/news-events/cybersecurity-advisories/aa23-144a
    - https://www.group-ib.com/blog/apt41-world-tour-2021/
    - https://labs.withsecure.com/content/dam/labs/docs/f-secureLABS-tlp-white-lazarus-threat-intel-report2.pdf
    - https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.diagnostics/get-winevent?view=powershell-7.3
    - https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-eventlog?view=powershell-5.1
    - http://www.solomonson.com/posts/2010-07-09-reading-eventviewer-command-line/
    - https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/wevtutil
    - https://ptsecurity.com/research/pt-esc-threat-intelligence/striking-panda-attacks-apt31-today
    - https://www.cybertriage.com/artifact/terminalservices_remoteconnectionmanager_log/
    - https://ponderthebits.com/2018/02/windows-rdp-related-event-logs-identification-tracking-and-investigation/
author: Nasreddine Bencherchali (Nextron Systems), X__Junior (Nextron Systems)
date: 2022-09-09
modified: 2025-12-02
tags:
    - attack.credential-access
    - attack.discovery
    - attack.t1552
    - attack.t1087
logsource:
    category: process_creation
    product: windows
detection:
    selection_wmi:
        CommandLine|contains|all:
            - 'Select'
            - 'Win32_NTLogEvent'
    selection_wevtutil_img:
        - Image|endswith: '\wevtutil.exe'
        - OriginalFileName: 'wevtutil.exe'
    selection_wevtutil_cli:
        CommandLine|contains:
            - ' qe '
            - ' query-events '
    selection_wmic_img:
        - Image|endswith: '\wmic.exe'
        - OriginalFileName: 'wmic.exe'
    selection_wmic_cli:
        CommandLine|contains: ' ntevent'
    selection_cmdlet:
        CommandLine|contains:
            - 'Get-WinEvent '
            - 'get-eventlog '
    selection_logs_name:
        CommandLine|contains:
            # Note: Add more event log channels that are interesting for attackers
            - 'Microsoft-Windows-PowerShell'
            - 'Microsoft-Windows-Security-Auditing'
            - 'Microsoft-Windows-TerminalServices-LocalSessionManager'
            - 'Microsoft-Windows-TerminalServices-RemoteConnectionManager'
            - 'Microsoft-Windows-Windows Defender'
            - 'PowerShellCore'
            - 'Security'
            - 'Windows PowerShell'
    selection_logs_eid:
        CommandLine|contains:
            # Note: We use the "?" to account for both a single and a double quote
            # Note: Please add additional interesting event IDs
            # Note: As this only focuses on EIDs and we know EIDs are not unique across providers. Rare FPs might occur with legit queries to EIDs from different providers.
            # This covers EID 4624 and 4628 from Security Log
            - '-InstanceId 462?'
            - '.eventid -eq 462?'
            - '.ID -eq 462?'
            - 'EventCode=?462?'
            - 'EventIdentifier=?462?'
            - 'System[EventID=462?]'
            # This covers EID 4778 from Security Log
            - '-InstanceId 4778'
            - '.eventid -eq 4778'
            - '.ID -eq 4778'
            - 'EventCode=?4778?'
            - 'EventIdentifier=?4778?'
            - 'System[EventID=4778]'
            # This covers EID 25 from Microsoft-Windows-TerminalServices-LocalSessionManager/Operational log
            - '-InstanceId 25'
            - '.eventid -eq 25'
            - '.ID -eq 25'
            - 'EventCode=?25?'
            - 'EventIdentifier=?25?'
            - 'System[EventID=25]'
            # This covers EID 1149 from Microsoft-Windows-TerminalServices-RemoteConnectionManager/Operational log
            - '-InstanceId 1149'
            - '.eventid -eq 1149'
            - '.ID -eq 1149'
            - 'EventCode=?1149?'
            - 'EventIdentifier=?1149?'
            - 'System[EventID=1149]'
            # This covers EID 21 from Microsoft-Windows-TerminalServices-LocalSessionManager/Operational log
            - '-InstanceId 21'
            - '.eventid -eq 21'
            - '.ID -eq 21'
            - 'EventCode=?21?'
            - 'EventIdentifier=?21?'
            - 'System[EventID=21]'
            # This covers EID 22 from Microsoft-Windows-TerminalServices-LocalSessionManager/Operational log
            - '-InstanceId 22'
            - '.eventid -eq 22'
            - '.ID -eq 22'
            - 'EventCode=?22?'
            - 'EventIdentifier=?22?'
            - 'System[EventID=22]'
    condition: 1 of selection_logs_* and (selection_wmi or all of selection_wevtutil_* or all of selection_wmic_* or selection_cmdlet)
falsepositives:
    - Legitimate usage of the utility by administrators to query the event log
level: medium
regression_tests_path: regression_data/rules/windows/process_creation/proc_creation_win_susp_eventlog_content_recon/info.yml

Stages and Predicates

Stage 0: condition

1 of selection_logs_* and (selection_wmi or all of selection_wevtutil_* or all of selection_wmic_* or selection_cmdlet)

Stage 1: selection_logs_name

selection_logs_name:
    CommandLine|contains:
        - 'Microsoft-Windows-PowerShell'
        - 'Microsoft-Windows-Security-Auditing'
        - 'Microsoft-Windows-TerminalServices-LocalSessionManager'
        - 'Microsoft-Windows-TerminalServices-RemoteConnectionManager'
        - 'Microsoft-Windows-Windows Defender'
        - 'PowerShellCore'
        - 'Security'
        - 'Windows PowerShell'

Stage 2: selection_logs_eid

selection_logs_eid:
    CommandLine|contains:
        - '-InstanceId 462?'
        - '.eventid -eq 462?'
        - '.ID -eq 462?'
        - 'EventCode=?462?'
        - 'EventIdentifier=?462?'
        - 'System[EventID=462?]'
        - '-InstanceId 4778'
        - '.eventid -eq 4778'
        - '.ID -eq 4778'
        - 'EventCode=?4778?'
        - 'EventIdentifier=?4778?'
        - 'System[EventID=4778]'
        - '-InstanceId 25'
        - '.eventid -eq 25'
        - '.ID -eq 25'
        - 'EventCode=?25?'
        - 'EventIdentifier=?25?'
        - 'System[EventID=25]'
        - '-InstanceId 1149'
        - '.eventid -eq 1149'
        - '.ID -eq 1149'
        - 'EventCode=?1149?'
        - 'EventIdentifier=?1149?'
        - 'System[EventID=1149]'
        - '-InstanceId 21'
        - '.eventid -eq 21'
        - '.ID -eq 21'
        - 'EventCode=?21?'
        - 'EventIdentifier=?21?'
        - 'System[EventID=21]'
        - '-InstanceId 22'
        - '.eventid -eq 22'
        - '.ID -eq 22'
        - 'EventCode=?22?'
        - 'EventIdentifier=?22?'
        - 'System[EventID=22]'

Stage 3: selection_wmi

selection_wmi:
    CommandLine|contains|all:
        - 'Select'
        - 'Win32_NTLogEvent'

Stage 4: selection_wevtutil_img

selection_wevtutil_img:
    - Image|endswith: '\wevtutil.exe'
    - OriginalFileName: 'wevtutil.exe'

Stage 5: selection_wevtutil_cli

selection_wevtutil_cli:
    CommandLine|contains:
        - ' qe '
        - ' query-events '

Stage 6: selection_wmic_img

selection_wmic_img:
    - Image|endswith: '\wmic.exe'
    - OriginalFileName: 'wmic.exe'

Stage 7: selection_wmic_cli

selection_wmic_cli:
    CommandLine|contains: ' ntevent'

Stage 8: selection_cmdlet

selection_cmdlet:
    CommandLine|contains:
        - 'Get-WinEvent '
        - 'get-eventlog '

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
CommandLinematch
  • ntevent corpus 2 (sigma 2)
  • qe corpus 2 (sigma 2)
  • query-events corpus 2 (sigma 2)
  • -InstanceId 1149
  • -InstanceId 21
  • -InstanceId 22
  • -InstanceId 25
  • -InstanceId 462?
  • -InstanceId 4778
  • .ID -eq 1149
  • .ID -eq 21
  • .ID -eq 22
  • .ID -eq 25
  • .ID -eq 462?
  • .ID -eq 4778
  • .eventid -eq 1149
  • .eventid -eq 21
  • .eventid -eq 22
  • .eventid -eq 25
  • .eventid -eq 462?
  • .eventid -eq 4778
  • EventCode=?1149?
  • EventCode=?21?
  • EventCode=?22?
  • EventCode=?25?
  • EventCode=?462?
  • EventCode=?4778?
  • EventIdentifier=?1149?
  • EventIdentifier=?21?
  • EventIdentifier=?22?
  • EventIdentifier=?25?
  • EventIdentifier=?462?
  • EventIdentifier=?4778?
  • Get-WinEvent corpus 2 (sigma 2)
  • Microsoft-Windows-PowerShell
  • Microsoft-Windows-Security-Auditing
  • Microsoft-Windows-TerminalServices-LocalSessionManager
  • Microsoft-Windows-TerminalServices-RemoteConnectionManager
  • Microsoft-Windows-Windows Defender
  • PowerShellCore
  • Security
  • Select corpus 4 (sigma 4)
  • System[EventID=1149]
  • System[EventID=21]
  • System[EventID=22]
  • System[EventID=25]
  • System[EventID=462?]
  • System[EventID=4778]
  • Win32_NTLogEvent corpus 3 (sigma 2, splunk 1)
  • Windows PowerShell
  • get-eventlog corpus 2 (sigma 2)
Imageends_with
  • \wevtutil.exe corpus 9 (sigma 9)
  • \wmic.exe corpus 60 (sigma 60)
OriginalFileNameeq
  • wevtutil.exe corpus 7 (sigma 5, elastic 1, splunk 1)
  • wmic.exe corpus 61 (sigma 36, splunk 18, elastic 7)