Detect Hidden Window in Sumo Logic CSE
Adversaries may use hidden windows to conceal malicious activity from users. On Windows, this is achieved through PowerShell's -WindowStyle Hidden flag or by using the ShowWindow API with SW_HIDE. The CreateProcess API's STARTUPINFO structure also allows processes to be created without a visible window. On macOS, the LSUIElement or LSBackgroundOnly Info.plist keys make applications background-only. Malware families using hidden windows include Astaroth, QuietSieve, StrongPity, and LockBit 2.0.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1564 Hide Artifacts
- Sub-technique
- T1564.003 Hidden Window
- Canonical reference
- https://attack.mitre.org/techniques/T1564/003/
Sumo Detection Query
_sourceCategory=*windows* OR _sourceCategory=*sysmon* OR _sourceCategory=*endpoint*
| where _raw matches /EventCode=1|EventID=4688/
| parse regex field=_raw "(?:CommandLine|ProcessCommandLine|CommandLine)\s*=\s*\"(?<command_line>[^\"]+)\"" nodrop
| parse regex field=_raw "(?:Image|NewProcessName)\s*=\s*\"(?<process_image>[^\"]+)\"" nodrop
| parse regex field=_raw "(?:ParentImage|ParentProcessName)\s*=\s*\"(?<parent_image>[^\"]+)\"" nodrop
| parse regex field=_raw "(?:User|SubjectUserName)\s*=\s*\"(?<username>[^\"]+)\"" nodrop
| parse regex field=_raw "(?:Computer|ComputerName)\s*=\s*\"(?<hostname>[^\"]+)\"" nodrop
| where (
process_image matches /(?i)(powershell|pwsh|cmd|wscript|cscript)\.exe$/
)
| where (
command_line matches /(?i)(-[Ww]indow[Ss]tyle\s+[Hh]idden|-w\s+hidden|-windowstyle\s+h)/
or command_line matches /(?i)\/hh/
or (command_line matches /(?i)(-NonInteractive|-noni|-NonI)/ and command_line matches /(?i)(-WindowStyle|-w )/)
)
| eval ps_hidden = if(command_line matches /(?i)(-WindowStyle Hidden|-w hidden|-windowstyle h)/, 1, 0)
| eval encoded_cmd = if(command_line matches /(?i)(-EncodedCommand|-enc |-e |-ec )/, 1, 0)
| eval download_cradle = if(command_line matches /(?i)(Net\.WebClient|Invoke-WebRequest|DownloadString|IEX)/, 1, 0)
| eval policy_bypass = if(command_line matches /(?i)(-ExecutionPolicy Bypass|-ep bypass)/, 1, 0)
| eval risk_score = ps_hidden + encoded_cmd + download_cradle + policy_bypass
| where ps_hidden = 1
| fields _time, hostname, username, process_image, command_line, parent_image, ps_hidden, encoded_cmd, download_cradle, policy_bypass, risk_score
| sort by _time desc Detects hidden window technique via PowerShell and scripting host processes with -WindowStyle Hidden or /hh arguments. Computes a composite risk score by checking for encoded commands, download cradles, and execution policy bypass co-occurring with the hidden window flag.
Data Sources
Required Tables
False Positives & Tuning
- Scheduled tasks running PowerShell maintenance scripts silently (e.g., disk cleanup, Windows Defender updates, certificate renewal)
- Software deployment systems (PDQ Deploy, Chocolatey, Ninite) using hidden PowerShell to install applications without desktop prompts
- Monitoring agents or backup clients invoking hidden PowerShell for health checks or snapshot operations
Other platforms for T1564.003
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1PowerShell Hidden Window Execution
Expected signal: Sysmon Event ID 1: powershell.exe with -WindowStyle Hidden in command line. Sysmon Event ID 11: file created at Temp path. PowerShell ScriptBlock Log Event ID 4104 with the command content.
- Test 2Hidden Window with Encoded Command
Expected signal: Sysmon Event ID 1: powershell.exe with both -WindowStyle Hidden and -EncodedCommand in command line. PowerShell ScriptBlock Log Event ID 4104 showing decoded content 'whoami'.
- Test 3Hidden Window with Execution Policy Bypass and Download Cradle
Expected signal: Sysmon Event ID 1: powershell.exe with all three flags. Sysmon Event ID 3: network connection attempt to 127.0.0.1:8080. The download will fail (no server) but both process creation and network events fire.
References (4)
Unlock Pro Content
Get the full detection package for T1564.003 including response playbook, investigation guide, and atomic red team tests.