Detect User Activity Based Checks in CrowdStrike LogScale
Adversaries may employ various user activity checks to detect and avoid virtualization and analysis environments. This includes checking mouse movement speed/frequency, click patterns, browser history and bookmarks, number of files on the desktop or in common directories, recently opened documents, and presence of user-created files. Some malware requires specific user interaction before activating, such as waiting for a document to close, a user to double-click an embedded image, or waiting for mouse button presses. Darkhotel checks mouse cursor position repeatedly, Okrum requires three left-clicks before executing, and FIN7 used embedded images requiring double-clicks to activate.
MITRE ATT&CK
- Tactic
- Defense Evasion Discovery
- Technique
- T1497 Virtualization/Sandbox Evasion
- Sub-technique
- T1497.002 User Activity Based Checks
- Canonical reference
- https://attack.mitre.org/techniques/T1497/002/
LogScale Detection Query
#event_simpleName = ProcessRollup2
| CommandLine = /(?i)(getcursorpos|getlastinputinfo|mouse_event|setcursorpos|getasynckeystate|getforegroundwindow|getdesktopwindow|recentdocs)/
or (
FileName = /(?i)^(cmd\.exe|powershell\.exe)$/
and CommandLine = /(?i)(desktop|recent|downloads|documents)/
and CommandLine = /(?i)(count|\.count|find\/c|measure-object)/
)
or (
CommandLine = /(?i)(history|bookmarks|cookies|places\.sqlite)/
and not FileName = /(?i)^(chrome\.exe|firefox\.exe|msedge\.exe|brave\.exe|opera\.exe)$/
)
| mouse_check := if(CommandLine = /(?i)(getcursorpos|getlastinputinfo|mouse_event|setcursorpos|getasynckeystate)/, 1, 0)
| window_check := if(CommandLine = /(?i)(getforegroundwindow|getdesktopwindow)/, 1, 0)
| file_count_check := if(
CommandLine = /(?i)(desktop|recent|downloads|documents)/
and CommandLine = /(?i)(count|\.count|find\/c|measure-object)/,
1, 0
)
| recentdocs_check := if(CommandLine = /(?i)recentdocs/, 1, 0)
| browser_history_check := if(
CommandLine = /(?i)(history|bookmarks|cookies|places\.sqlite)/
and not FileName = /(?i)^(chrome\.exe|firefox\.exe|msedge\.exe|brave\.exe|opera\.exe)$/,
1, 0
)
| suspicion_score := (mouse_check * 2) + (window_check * 2) + file_count_check + recentdocs_check + browser_history_check
| suspicion_score > 0
| table([timestamp, ComputerName, UserName, FileName, CommandLine, ParentBaseFileName, ParentCommandLine, mouse_check, window_check, file_count_check, recentdocs_check, browser_history_check, suspicion_score])
| sort(timestamp, order=desc) CrowdStrike LogScale (Falcon) detection for T1497.002 using ProcessRollup2 telemetry. Applies a top-level filter matching any process command line that references mouse or window Win32 API strings, RecentDocs, user directory file counts via cmd/PowerShell, or browser data paths from non-browser executables. Downstream eval fields compute per-category flags and a composite suspicion score (mouse/window checks weighted 2x) to aid analyst triage. Requires Falcon sensor with full command line capture enabled.
Data Sources
Required Tables
False Positives & Tuning
- Authorised red team or penetration testing engagements where post-exploitation frameworks (Cobalt Strike, Metasploit) execute user-simulation modules that invoke mouse activity APIs
- Enterprise endpoint management or RMM agents running PowerShell inventory scripts that enumerate file counts in Desktop or Downloads folders for asset management telemetry
- Password managers or SSO desktop clients (1Password, LastPass, Okta Verify) that read browser cookie or history paths during credential auto-fill or profile discovery operations
Other platforms for T1497.002
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 1Check desktop file count for sandbox detection
Expected signal: Sysmon Event ID 1: Process Create for cmd.exe with 'dir /b' + Desktop path, piped to find.exe. Two process events generated.
- Test 2Check RecentDocs registry for user activity
Expected signal: Sysmon Event ID 1: Process Create for reg.exe with RecentDocs query. Sysmon Event ID 13: Registry key access event for the RecentDocs path.
- Test 3PowerShell mouse position check for sandbox detection
Expected signal: Sysmon Event ID 1: PowerShell process with GetCursorPos in command line. PowerShell ScriptBlock Log Event ID 4104 with the full P/Invoke code and mouse check logic.
References (6)
- https://attack.mitre.org/techniques/T1497/002/
- https://www.fireeye.com/blog/threat-research/2017/04/fin7-phishing-lnk.html
- https://unit42.paloaltonetworks.com/unit42-sofacy-continues-global-attacks-wheels-new-cannon-trojan/
- https://www.sans.org/reading-room/whitepapers/forensics/detecting-malware-sandbox-evasion-techniques-36667
- https://drive.google.com/file/d/1t0jn3xr4ff2fR30oQAUn_RsWSnMpOAQc/edit
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1497.002/T1497.002.md
Unlock Pro Content
Get the full detection package for T1497.002 including response playbook, investigation guide, and atomic red team tests.