T1497.002 Splunk · SPL

Detect User Activity Based Checks in Splunk

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/

SPL Detection Query

Splunk (SPL)
spl
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| eval CommandLine=lower(CommandLine)
| eval MouseActivityCheck=if(match(CommandLine, "(getcursorpos|getlastinputinfo|mouse_event|setcursorpos|getasynckeystate)"), 1, 0)
| eval WindowActivityCheck=if(match(CommandLine, "(getforegroundwindow|getdesktopwindow)"), 1, 0)
| eval FileCountCheck=if(match(CommandLine, "(desktop|recent|downloads|documents)") AND match(CommandLine, "(count|\.count|find /c|measure-object|wc -l)"), 1, 0)
| eval RecentDocsCheck=if(match(CommandLine, "recentdocs"), 1, 0)
| eval BrowserHistoryCheck=if(match(CommandLine, "(history|bookmarks|cookies|places\.sqlite)") AND NOT match(Image, "(?i)(chrome|firefox|msedge|brave|opera)"), 1, 0)
| eval SuspicionScore=MouseActivityCheck*2 + WindowActivityCheck*2 + FileCountCheck + RecentDocsCheck + BrowserHistoryCheck
| where SuspicionScore > 0
| table _time, host, User, Image, CommandLine, ParentImage, ParentCommandLine, MouseActivityCheck, WindowActivityCheck, FileCountCheck, RecentDocsCheck, BrowserHistoryCheck, SuspicionScore
| sort - _time
medium severity low confidence

Detects user activity-based sandbox evasion via Sysmon process creation events. Identifies mouse/input activity checks, foreground window API usage, file count enumeration in user directories, RecentDocs registry queries, and browser history access by non-browser processes. Lower confidence due to overlap with legitimate automation tools.

Data Sources

Process: Process CreationCommand: Command ExecutionSysmon Event ID 1

Required Sourcetypes

XmlWinEventLog:Microsoft-Windows-Sysmon/Operational

False Positives & Tuning

  • Accessibility and automation software tracking mouse position
  • RPA tools monitoring user input state
  • IT scripts counting files for compliance/cleanup
  • Remote desktop and screen sharing software
Download portable Sigma rule (.yml)

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.

  1. 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.

  2. 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.

  3. 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.

Unlock Pro Content

Get the full detection package for T1497.002 including response playbook, investigation guide, and atomic red team tests.

Response PlaybookInvestigation GuideHunting QueriesAtomic Red Team TestsTuning Guidance

Related Detections