Application Window Discovery
Adversaries may attempt to get a listing of open application windows. Window listings convey information about how the system is used and help adversaries identify potential data sources and security tooling to evade. Malware families including Attor, njRAT, DarkWatchman, Grandoreiro, InvisiMole, and Lazarus Group tooling use this technique to obtain window titles and correlate them with keylogger output, identify running security products by window name, locate cryptocurrency wallets, and determine sandbox environments. Adversaries typically implement this via native Windows API functions (EnumWindows, GetForegroundWindow, FindWindow, GetWindowText from user32.dll), scripting languages using P/Invoke or COM automation, or automation tools such as AutoHotkey and AutoIt. On Linux and macOS, adversaries may use xdotool, wmctrl, or Quartz/Cocoa APIs to achieve equivalent capability.
let WindowAPIFunctions = dynamic([
"GetForegroundWindow", "EnumWindows", "FindWindow", "GetWindowText",
"GetActiveWindow", "EnumChildWindows", "GetWindowLong", "GetWindowRect",
"FindWindowEx", "GetWindowInfo"
]);
// Vector 1: Script interpreters referencing window enumeration API functions
let ScriptInterpreterEnum = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("powershell.exe", "pwsh.exe", "wscript.exe", "cscript.exe", "mshta.exe", "python.exe", "python3.exe", "ruby.exe", "perl.exe")
| where ProcessCommandLine has_any (WindowAPIFunctions)
or (ProcessCommandLine has_any ("Add-Type", "DllImport") and ProcessCommandLine has "user32" and ProcessCommandLine has_any ("window", "Window", "hwnd", "hWnd"))
or (ProcessCommandLine has "Shell.Application" and ProcessCommandLine has_any ("Windows()", ".Windows "))
| extend DetectionVector = case(
ProcessCommandLine has_any ("Add-Type", "DllImport") and ProcessCommandLine has "user32", "PowerShell P/Invoke Window API",
ProcessCommandLine has "Shell.Application", "COM Shell Window Enumeration",
"Script Window Enumeration API"
);
// Vector 2: Automation tools spawned from unexpected parents (not UI or development environments)
let AutomationToolEnum = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("autoit3.exe", "autohotkey.exe", "ahk2exe.exe", "autoit3_x64.exe")
| where InitiatingProcessFileName !in~ ("explorer.exe", "devenv.exe", "code.exe", "notepad++.exe", "sublime_text.exe", "atom.exe", "cursor.exe")
| extend DetectionVector = "Automation Tool Window Enumeration (Unusual Parent)";
// Vector 3: Known third-party window enumeration utilities
let KnownToolEnum = DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName in~ ("winlister.exe", "wintitles.exe", "windowdetective.exe", "spyxx.exe", "spyxx_amd64.exe", "winspector.exe")
| extend DetectionVector = "Known Window Enumeration Utility";
union ScriptInterpreterEnum, AutomationToolEnum, KnownToolEnum
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine, DetectionVector
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- Legitimate AutoHotkey or AutoIt scripts used by IT support staff for desktop automation and helpdesk tooling
- Screen recording, remote desktop, and accessibility software (e.g., NVDA, JAWS, TeamViewer) that enumerates windows for UI interaction
- Developer tooling such as UI testing frameworks (Selenium WebDriver for Windows, WinAppDriver, TestComplete) that programmatically enumerate windows
- Python automation scripts for legitimate RPA (Robotic Process Automation) deployments using pywin32 or pywinauto
- PowerShell DSC configurations or inventory scripts that query Shell.Application window state
References (10)
- https://attack.mitre.org/techniques/T1010/
- https://web.archive.org/web/20220629230035/https://www.prevailion.com/darkwatchman-new-fileless-techniques/
- https://www.welivesecurity.com/2020/04/28/grandoreiro-how-engorged-can-exe-get/
- https://www.welivesecurity.com/2019/10/10/eset-discovers-attor-a-spy-platform-with-curious-GSM-fingerprinting/
- https://securelist.com/nettraveler-is-running-red-star-apt-attacks-compromise-high-profile-victims/35936/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1010/T1010.md
- https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-enumwindows
- https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-getforegroundwindow
- https://learn.microsoft.com/en-us/defender-endpoint/advanced-hunting-deviceprocessevents-table
- https://www.autohotkey.com/docs/v2/lib/WinGetTitle.htm
Unlock Pro Content
Get the full detection package for T1010 including response playbook, investigation guide, and atomic red team tests.