Detect AutoHotKey & AutoIT in Splunk
Adversaries may execute commands and perform malicious tasks using AutoIT and AutoHotKey automation scripts. AutoIT and AutoHotkey (AHK) are scripting languages that enable users to automate Windows tasks such as clicking buttons, entering text, and managing programs. Adversaries may use AHK (.ahk) and AutoIT (.au3) scripts to execute malicious code, deploy keyloggers, and deliver phishing payloads. These scripts can be compiled into self-contained executables. Threat actors including DarkGate, Lumma Stealer, APT39, and XLoader have leveraged AutoIT and AutoHotKey for malware delivery and execution.
MITRE ATT&CK
- Tactic
- Execution
- Technique
- T1059 Command and Scripting Interpreter
- Sub-technique
- T1059.010 AutoHotKey & AutoIT
- Canonical reference
- https://attack.mitre.org/techniques/T1059/010/
SPL Detection Query
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
(Image="*\\AutoIt3.exe" OR Image="*\\AutoHotkey.exe" OR Image="*\\AutoHotkeyU64.exe" OR Image="*\\AutoHotkeyU32.exe" OR CommandLine="*.au3*" OR CommandLine="*.ahk*")
| eval IsAutoIT=if(match(Image, "AutoIt3\.exe$") OR match(CommandLine, "\.au3"), 1, 0)
| eval IsAHK=if(match(Image, "AutoHotkey") OR match(CommandLine, "\.ahk"), 1, 0)
| eval ScriptFromTemp=if(match(CommandLine, "(\\Temp\\|\\tmp\\|%TEMP%|AppData)"), 1, 0)
| eval NetworkActivity=if(match(CommandLine, "(URLDownloadToFile|_WinHttpSimpleRequest|Inet)"), 1, 0)
| eval DllCall=if(match(CommandLine, "DllCall\("), 1, 0)
| eval SuspicionScore=ScriptFromTemp*2 + NetworkActivity*2 + DllCall*2
| table _time, host, User, Image, CommandLine, ParentImage, ParentCommandLine, IsAutoIT, IsAHK, ScriptFromTemp, NetworkActivity, DllCall, SuspicionScore
| sort - SuspicionScore, - _time Detects AutoIT and AutoHotKey execution from Sysmon Event ID 1. Evaluates scripts running from temp directories (dropper behavior), network download activity, and DllCall usage (common in malware for API access). Scripts from temp directories and with network/DLL activity scored higher.
Data Sources
Required Sourcetypes
False Positives & Tuning
- IT departments using AutoIT for legitimate desktop automation
- AutoHotKey users with custom keyboard shortcuts
- Software testing teams using AutoIT for GUI test automation
Other platforms for T1059.010
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 1AutoHotKey Script Execution
Expected signal: Sysmon Event ID 1: Process Create for AutoHotkey.exe with .ahk file in CommandLine. Sysmon Event ID 11: File Create for the .ahk script in Temp directory.
- Test 2AutoIT Script Execution
Expected signal: Sysmon Event ID 1: Process Create for AutoIt3.exe with .au3 file in CommandLine. Sysmon Event ID 11: File Create for the .au3 script in Temp directory.
- Test 3AutoIT Compiled Executable Detection
Expected signal: Sysmon Event ID 1: PowerShell process creation. The script scans for compiled AutoIT executables by checking PE metadata.
References (5)
- https://attack.mitre.org/techniques/T1059/010/
- https://www.splunk.com/en_us/blog/security/enter-the-gates-an-analysis-of-the-darkgate-autoit-loader.html
- https://www.autoitscript.com/autoit3/docs/intro/running.htm
- https://www.autohotkey.com/docs/v1/Program.htm
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1059.010/T1059.010.md
Unlock Pro Content
Get the full detection package for T1059.010 including response playbook, investigation guide, and atomic red team tests.