
Hunting for Suspicious Scheduled Tasks
FreeIdentify and analyze potential persistence threats in Windows.
Free · Opens the source repo
What Hunting for Suspicious Scheduled Tasks does
The Hunting for Suspicious Scheduled Tasks skill is designed to assist security professionals in identifying and analyzing potential adversary persistence mechanisms within Windows environments. By focusing on the analysis of Security Event ID 4698, which indicates task creation events, this skill helps users detect suspicious scheduled tasks that may be employed by attackers to maintain access to compromised systems. The skill operates by examining the properties of scheduled tasks and their execution patterns, specifically targeting the use of tools like schtasks.exe and at.exe.
This skill is particularly useful during incident response scenarios, where it can enumerate all scheduled tasks on compromised hosts, providing insights into how an attacker may be leveraging these tasks for persistence. It also serves as a proactive hunting tool for security teams looking to identify potential threats before they can be exploited. By analyzing task actions, triggers, and properties, users can pinpoint tasks that exhibit abnormal behavior or are likely to be used for malicious purposes.
The workflow includes essential steps such as enumerating scheduled tasks, monitoring task creation events, and correlating task execution with process logs. This systematic approach allows security analysts to build a comprehensive understanding of the scheduled tasks present on a system, identify hidden or disguised tasks, and compare current tasks against known baselines to detect any anomalies. With this skill, users can significantly enhance their threat-hunting capabilities and improve their overall security posture against persistent threats.
When to use it
Use this skill when investigating potential threats in Windows environments, particularly after detecting suspicious task creation or during incident response.
When not to use it
This skill is not suitable for environments that do not utilize Windows or where scheduled tasks are not present.
What you can build with it
Investigating Malware Persistence
Use this skill to analyze scheduled tasks that may be used by malware to maintain persistence across reboots.
Incident Response Scenario
Deploy this skill during an incident response to enumerate all scheduled tasks on a potentially compromised system.
Proactive Threat Hunting
Utilize the skill to hunt for unusual scheduled tasks in a Windows environment before a security incident occurs.
How to install Hunting for Suspicious Scheduled Tasks
View source1. Install with the skills CLI
npx skills add mukul975/anthropic-cybersecurity-skills/hunting-for-suspicious-scheduled-tasks --agent claude-code2. Or install it manually
Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.
Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs
Inside SKILL.md
Written by mukul975Hunting for Suspicious Scheduled Tasks
When to Use
- 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
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
- Enumerate All Scheduled Tasks: Collect complete task inventory from target systems using
schtasks /query /fo CSV /vorGet-ScheduledTaskPowerShell cmdlet. - Monitor Task Creation Events: Track Event ID 4698 for new task creation, correlating with the creating process and user account context.
- Analyze Task Actions: Examine what each task executes. Flag tasks running scripts (PowerShell, cmd, wscript), binaries from user-writable paths (TEMP, AppData, Downloads), or encoded/obfuscated commands.
- Check Task Triggers: Review trigger conditions. Tasks triggered by system startup, user logon, or short intervals (1-5 minutes) warrant investigation.
- Identify Hidden or Disguised Tasks: Hunt for tasks with names mimicking legitimate Windows tasks, tasks with Security Descriptor modifications hiding them from standard enumeration, or tasks stored in non-standard registry locations.
- Correlate with Process Execution: Match scheduled task execution events with process creation logs to confirm what actually runs.
- Baseline and Diff: Compare current task inventory against known-good baselines to identify new, modified, or unexpected tasks.
Detection Queries
Splunk -- Scheduled Task Creation
index=wineventlog EventCode=4698
| spath output=TaskName path=EventData.TaskName
| spath output=TaskContent path=EventData.TaskContent
| where NOT match(TaskName, "(?i)(\\\\Microsoft\\\\|\\\\Windows\\\\)")
| table _time Computer SubjectUserName TaskName TaskContent
Splunk -- Schtasks.exe Suspicious Usage
index=sysmon EventCode=1 Image="*\\schtasks.exe"
| where match(CommandLine, "(?i)/create")
| where match(CommandLine, "(?i)(powershell|cmd|wscript|cscript|mshta|rundll32|regsvr32|http|https|\\\\temp\\\\|\\\\appdata\\\\)")
| table _time Computer User CommandLine ParentImage
KQL -- Microsoft Sentinel
SecurityEvent
| where EventID == 4698
| extend TaskName = tostring(EventData.TaskName)
| extend TaskContent = tostring(EventData.TaskContent)
| where TaskContent has_any ("powershell", "cmd.exe", "wscript", "http://", "https://", "\\Temp\\", "\\AppData\\")
| project TimeGenerated, Computer, Account, TaskName, TaskContent
Common Scenarios
- Cobalt Strike Persistence: Creates scheduled tasks via schtasks.exe to execute PowerShell download cradles at user logon intervals.
- Ransomware Staging: Task created to run encryption payload at a future time, often during off-hours for maximum impact.
- Hidden Task via SD Modification: Attacker modifies Security Descriptor of scheduled task to hide it from normal enumeration while maintaining execution.
- COM Handler Abuse: Task uses COM handler rather than direct executable path, making action inspection more complex.
- Lateral Movement via Tasks: Remote scheduled task creation using
schtasks /create /s REMOTE_HOSTfor execution on other systems.
Output Format
Hunt ID: TH-SCHTASK-[DATE]-[SEQ]
Host: [Hostname]
Task Name: [Full task path]
Action: [Command/Script executed]
Trigger: [Startup/Logon/Timer/Event]
Created By: [User account]
Created From: [Local/Remote]
Creation Time: [Timestamp]
Run As: [Execution account]
Risk Level: [Critical/High/Medium/Low]
Frequently asked questions about Hunting for Suspicious Scheduled Tasks
Similar skills
Asset Criticality Scoring for Vulns
Prioritize vulnerabilities based on asset criticality.
Performing Alert Triage with Elastic SIEM
Streamline alert triage processes in Elastic Security.
Active Directory Vulnerability Assessment
Secure your Active Directory with comprehensive assessments.
Active Directory Investigation
Streamline your Active Directory compromise investigations.
Parsing Artifacts with Eric Zimmerman Tools
Efficiently parse Windows forensic artifacts for analysis.
Operationalizing MISP Threat Feeds
Enhance threat detection with curated MISP feeds.
