Detect At in Splunk
Adversaries may abuse the at utility to perform task scheduling for initial or recurring execution of malicious code. The at utility exists as an executable within Windows, Linux, and macOS for scheduling tasks at a specified time and date. Although deprecated in favor of schtasks in Windows environments, at can be used to execute programs at system startup or on a scheduled basis for persistence, remote execution as part of lateral movement, and privilege escalation on Linux if allowed to run as superuser via sudo. Adversaries may also leverage the WMI Win32_ScheduledJob class to schedule tasks programmatically.
MITRE ATT&CK
- Technique
- T1053 Scheduled Task/Job
- Sub-technique
- T1053.002 At
- Canonical reference
- https://attack.mitre.org/techniques/T1053/002/
SPL Detection Query
index=wineventlog (sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" OR sourcetype="WinEventLog:Security")
(
(EventCode=1 (Image="*\\at.exe" OR Image="*\\at"))
OR (EventCode=4688 (NewProcessName="*\\at.exe" OR NewProcessName="*\\at"))
OR (EventCode=1 (Image="*\\wmic.exe" CommandLine="*ScheduledJob*"))
OR (EventCode=1 (Image="*\\powershell.exe" OR Image="*\\pwsh.exe") CommandLine="*Win32_ScheduledJob*")
OR (EventCode=4688 (NewProcessName="*\\wmic.exe" CommandLine="*ScheduledJob*"))
)
| eval CommandLine=coalesce(CommandLine, ProcessCommandLine)
| eval Image=coalesce(Image, NewProcessName)
| eval ParentImage=coalesce(ParentImage, ParentProcessName)
| eval User=coalesce(User, SubjectUserName)
| eval host=coalesce(host, ComputerName)
| eval IsSuspiciousPayload=if(
match(lower(CommandLine), "(cmd\.exe|powershell|wscript|cscript|mshta|rundll32|regsvr32|certutil|bitsadmin|\.bat|\.vbs|\.ps1|\.hta)"),
1, 0)
| eval IsInteractive=if(match(lower(CommandLine), "/interactive"), 1, 0)
| eval IsSuspiciousParent=if(
match(lower(ParentImage), "(powershell|wscript|cscript|mshta|python|perl|ruby)"),
1, 0)
| eval IsWMIScheduledJob=if(match(lower(CommandLine), "(win32_scheduledjob|scheduledjob)"), 1, 0)
| eval SuspicionScore=IsSuspiciousPayload + IsInteractive + IsSuspiciousParent + IsWMIScheduledJob
| where SuspicionScore > 0 OR Image LIKE "%\\at.exe"
| table _time, host, User, Image, CommandLine, ParentImage,
IsSuspiciousPayload, IsInteractive, IsSuspiciousParent, IsWMIScheduledJob, SuspicionScore
| sort - _time Detects abuse of the 'at.exe' scheduler utility and WMI Win32_ScheduledJob on Windows using both Sysmon Event ID 1 (Process Create) and Security Event ID 4688 (Process Creation). Evaluates command lines for suspicious payload types, interactive scheduling, suspicious parent processes, and WMI-based job creation. Assigns a suspicion score to help prioritize high-confidence alerts. All at.exe executions are surfaced regardless of score to ensure no scheduling activity is missed.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Legacy enterprise applications that still use at.exe for scheduled maintenance tasks (e.g., older backup software or batch job schedulers)
- IT administrators manually scheduling jobs via at.exe on older Windows Server systems that have not migrated to schtasks
- Security testing tools or vulnerability scanners that enumerate or test scheduled task functionality
- Automated build or CI/CD pipelines that invoke at.exe for timed job coordination on legacy systems
Other platforms for T1053.002
Testing Methodology
Validate this detection against 5 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 1Schedule Command Execution via at.exe (Windows)
Expected signal: Sysmon Event ID 1: Process Create with Image=at.exe, CommandLine containing a time value and 'cmd.exe /c whoami'. Security Event ID 4688 (if command line auditing enabled). Security Event ID 4698 (Scheduled Task Created) capturing the job. When the job fires, Security Event ID 4624 for the SYSTEM logon context and another Sysmon Event ID 1 for cmd.exe spawned by the Task Scheduler service (parent: svchost.exe).
- Test 2Schedule PowerShell Execution via at.exe (Windows)
Expected signal: Sysmon Event ID 1 for at.exe with CommandLine containing 'powershell.exe'. Security Event ID 4698 for scheduled task creation. When fired: Sysmon Event ID 1 for powershell.exe spawned by svchost.exe (Task Scheduler context), Sysmon Event ID 11 for file creation in TEMP.
- Test 3WMI Win32_ScheduledJob Creation via PowerShell (Windows)
Expected signal: Sysmon Event ID 1: powershell.exe with CommandLine containing 'Win32_ScheduledJob' and 'Create'. Microsoft-Windows-WMI-Activity/Operational Event ID 5861. Security Event ID 4698 (Scheduled Task Created) may fire depending on Windows version. When job executes: cmd.exe spawned by svchost.exe (Task Scheduler), Sysmon Event ID 11 for file creation in C:\Windows\Temp.
- Test 4Linux at Command for Deferred Execution
Expected signal: Syslog/auditd: execve syscall for 'at' binary with arguments 'now + 1 minute'. atd daemon log entries in /var/log/syslog or /var/log/cron. When the job fires: execve for 'sh' or 'bash' spawned by atd, then execve for 'id'. Auditd records with key 'at_usage' if rule is configured: -a always,exit -F path=/usr/bin/at -F perm=x -k at_usage.
- Test 5Linux at Privilege Escalation via sudo (GTFObins)
Expected signal: Auditd: syscall execve for sudo with arguments 'at', preceded by sudo authentication event. Syslog: sudo log entry 'USER=root ; COMMAND=/usr/bin/at'. When job fires: sh or bash process spawned by atd running as root. Auditd EUID=0 for the spawned shell process.
References (11)
- https://attack.mitre.org/techniques/T1053/002/
- https://man7.org/linux/man-pages/man1/at.1p.html
- https://gtfobins.github.io/gtfobins/at/
- https://technet.microsoft.com/library/dd315590.aspx
- https://www.cybereason.com/blog/wmi-lateral-movement-win32#blog-subscribe
- https://www.secureworks.com/research/bronze-butler-targets-japanese-businesses
- https://www.fireeye.com/blog/threat-research/2018/03/suspected-chinese-espionage-group-targeting-maritime-and-engineering-industries.html
- https://docs.microsoft.com/en-us/windows/security/threat-protection/auditing/audit-other-object-access-events
- https://social.technet.microsoft.com/Forums/en-US/e5bca729-52e7-4fcb-ba12-3225c564674c/scheduled-tasks-history-retention-settings
- https://www.linkedin.com/pulse/getting-attacker-ip-address-from-malicious-linux-job-craig-rowland/
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1053.002/T1053.002.md
Unlock Pro Content
Get the full detection package for T1053.002 including response playbook, investigation guide, and atomic red team tests.