Skip to content

Siemphony is in beta and still being built. How a rule earns its badge.

Siemphony’s repertoire

Window enumeration entry points in a PowerShell script block

AN0271 offers two Windows sources and only one of them can carry this behaviour. Enumerating windows through user32 reads the window manager; it does not open a handle on the process that owns the window, so Sysmon process access events are not emitted for EnumWindows or GetWindowText and a process_access rule for this technique would render in every backend and match nothing. This rule therefore takes the PowerShell script block leg, matching the user32 entry points that window enumeration goes through together with the .NET MainWindowTitle property, which is how the same listing is usually obtained without a P/Invoke declaration at all. Those names populate MITRE's AccessedFunction knob and are authored here rather than supplied by MITRE; the UserContext and TimeWindow knobs need session attributes and counting over an interval, neither of which Sigma expresses, so this is a content test on the script text alone. It follows that only enumeration written in PowerShell is visible: a compiled implant calling EnumWindows through the API leaves nothing in this channel, and the rule sees the script that was compiled rather than proof any window was actually listed. EventID 4104 requires PowerShell Script Block Logging, which is off in a default install, so confirm it is enabled before treating an absence of hits as an absence of enumeration. UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0097, not hand-written and not tested by its author. Any lab result is on this rule's own page.Full description

The detection

The 4 SIEM queries below are previews produced by Siemphony’s own translator, not pySigma, and none has been executed against a real backend — review before you deploy.

detection.yml

title: Window enumeration entry points in a PowerShell script blockid: 65378270-076b-45b9-9d5d-d7b7edc5a7d3status: experimentaldescription: |  AN0271 offers two Windows sources and only one of them can carry this  behaviour. Enumerating windows through user32 reads the window manager; it does  not open a handle on the process that owns the window, so Sysmon process access  events are not emitted for EnumWindows or GetWindowText and a process_access  rule for this technique would render in every backend and match nothing. This  rule therefore takes the PowerShell script block leg, matching the user32 entry  points that window enumeration goes through together with the .NET  MainWindowTitle property, which is how the same listing is usually obtained  without a P/Invoke declaration at all. Those names populate MITRE's  AccessedFunction knob and are authored here rather than supplied by MITRE; the  UserContext and TimeWindow knobs need session attributes and counting over an  interval, neither of which Sigma expresses, so this is a content test on the  script text alone. It follows that only enumeration written in PowerShell is  visible: a compiled implant calling EnumWindows through the API leaves nothing  in this channel, and the rule sees the script that was compiled rather than  proof any window was actually listed. EventID 4104 requires PowerShell Script  Block Logging, which is off in a default install, so confirm it is enabled  before treating an absence of hits as an absence of enumeration.  UNVERIFIED AS AUTHORED — derived from MITRE ATT&CK DET0097, not hand-written and not tested by its author. Any lab result is on this rule's own page.references:  - https://attack.mitre.org/techniques/T1010  - https://attack.mitre.org/detectionstrategies/DET0097author: Siemphony pipeline (machine-derived from MITRE ATT&CK v19.2)date: 2026-08-16tags:  - attack.discovery  - attack.t1010logsource:  product: windows  service: powershelldetection:  selection_event:    EventID: 4104  selection_enumeration:    ScriptBlockText|contains:      - 'EnumWindows'      - 'EnumChildWindows'      - 'GetForegroundWindow'      - 'GetWindowText'      - 'GetWindowTextLength'      - 'GetWindowThreadProcessId'      - 'MainWindowTitle'  condition: selection_event and selection_enumerationfalsepositives:  - "Software deployment and patch remediation scripts that check for open application windows before forcing a restart or closing a program, which read MainWindowTitle off Get-Process, ship with management suites and run on a schedule across the whole estate — the dominant benign volume here."  - "PowerShell scripts that build a graphical interface or manage their own console window, since WinForms and WPF helper snippets routinely P/Invoke GetForegroundWindow and GetWindowText from user32.dll to raise, hide or position a window."  - "Robotic process automation and help-desk tooling that drives a desktop application by enumerating its child windows, and desktop inventory agents that report which applications a user currently has open."  - "Administrators pasting a diagnostic one-liner that lists window titles to identify a hung application, which is logged identically to the same one-liner typed by an intruder."level: low

Sentinel · KQL

Run this as a search.

Event| where (EventID == 4104 and (ScriptBlockText contains "EnumWindows" or ScriptBlockText contains "EnumChildWindows" or ScriptBlockText contains "GetForegroundWindow" or ScriptBlockText contains "GetWindowText" or ScriptBlockText contains "GetWindowTextLength" or ScriptBlockText contains "GetWindowThreadProcessId" or ScriptBlockText contains "MainWindowTitle"))

Splunk · SPL

Run this as a search.

index=* (EventID="4104" AND (ScriptBlockText="*EnumWindows*" OR ScriptBlockText="*EnumChildWindows*" OR ScriptBlockText="*GetForegroundWindow*" OR ScriptBlockText="*GetWindowText*" OR ScriptBlockText="*GetWindowTextLength*" OR ScriptBlockText="*GetWindowThreadProcessId*" OR ScriptBlockText="*MainWindowTitle*"))

Elastic · ES|QL

Run this as a search.

FROM logs-*| WHERE (event.code == 4104 AND (TO_LOWER(powershell.file.script_block_text) LIKE "*enumwindows*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*enumchildwindows*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*getforegroundwindow*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*getwindowtext*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*getwindowtextlength*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*getwindowthreadprocessid*" OR TO_LOWER(powershell.file.script_block_text) LIKE "*mainwindowtitle*"))

Wazuh · XML rule

Deploy to your manager — this is a rule, not a search.

<group name="sigma,windows,">  <!-- Rule ids must be unique on your manager; 100000+ is the user range. -->  <rule id="100000" level="5">    <!-- Set <if_sid> to the decoder/base rule for windows so this only evaluates relevant events. -->    <field name="EventID" type="pcre2">(?i)^4104$</field>    <field name="ScriptBlockText" type="pcre2">(?i)(EnumWindows|EnumChildWindows|GetForegroundWindow|GetWindowText|GetWindowTextLength|GetWindowThreadProcessId|MainWindowTitle)</field>    <description>Window enumeration entry points in a PowerShell script block</description>    <mitre>      <id>T1010</id>    </mitre>  </rule></group>

Verdicts · reactions · comments

Community

Verdicts from engineers who actually deployed it, and the conversation around it.

Log in to react
Not yet reported on

Nobody has run this in a real environment and said what happened.

Verdicts from engineers who deployed it

0 cast

No verdicts reported yet. The first one is worth more than the tenth — say what you ran it against.

Log in to report a verdict.

Log in to join the discussion.

No comments yet. Someone who deploys this will have something to say about it.