| name | hunting-for-suspicious-scheduled-tasks |
| description | Hunt for adversary persistence and execution via Windows scheduled tasks by analyzing task creation events, suspicious task properties, and unusual execution patterns that indicate T1053.005 abuse. Use when hunting for adversary persistence and execution via windows scheduled tasks. |
| domain | cybersecurity |
| tags | ["threat-hunting","scheduled-tasks","persistence","mitre-t1053-005","windows","endpoint-detection"] |
| subdomain | threat-hunting |
| version | 1.0 |
| author | oyi77 |
| license | Apache-2.0 |
| nist_csf | ["DE.CM-01","DE.AE-02","DE.AE-07","ID.RA-05"] |
Hunting For Suspicious Scheduled Tasks
Overview
Cybersecurity skill for hunting for suspicious scheduled tasks. Follows industry best practices and security standards.
When to Use
Trigger phrases:
-
"hunting for suspicious scheduled tasks"
-
"Hunt for adversary persistence and execution via Windows scheduled tasks by anal"
-
When proactively hunting for persistence mechanisms in Windows environments
-
After detecting schtasks.exe or at.exe usage in process creation logs
-
When investigating malware that survives reboots and user logoffs
-
During incident response to enumerate all persistence on compromised systems
-
When Windows Security Event ID 4698 (Scheduled Task Created) fires for unusual tasks
When NOT to Use
- When you lack proper authorization for testing
- For production systems without change management
- When the task requires legal or compliance expertise beyond technical scope
Prerequisites
- Windows Security Event ID 4698/4699/4702 (Task Created/Deleted/Updated)
- Sysmon Event ID 1 for schtasks.exe process creation with command lines
- Windows Task Scheduler operational log (Microsoft-Windows-TaskScheduler/Operational)
- PowerShell logging for Register-ScheduledTask cmdlet usage
- Access to Task Scheduler XML definitions on endpoints
Workflow
import re
IOC_PATTERNS = {
"ip": r"\b(?:\d{1,3}\.){3}\d{1,3}\b",
"domain": r"\b[a-z0-9-]+\.[a-z]{2,}\b",
"hash_md5": r"\b[a-f0-9]{32}\b",
"hash_sha256": r"\b[a-f0-9]{64}\b",
}
def extract_iocs(text: str) -> dict:
return {k: re.findall(v, text) for k, v in IOC_PATTERNS.items()}