T06 · System Persistence
- Location
references/resources.md:103- Finding
Persistent Execution Through a Windows Scheduled Task
- Content
View full analysis
Vulnerability Details
File Location:
references/resources.md, lines 103-110
Vulnerability Type: System persistence through scheduled task registration
Risk Level: HighVulnerable Code
powershell # 创建每日任务 $action = New-ScheduledTaskAction -Execute "python.exe" -Argument "script.py" $trigger = New-ScheduledTaskTrigger -Daily -At "8:00AM" Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "DailyTask"Technical Analysis
The documented commands register a Windows scheduled task that executes
python.exe script.pyevery day. This creates a cross-session execution mechanism that remains active after the original skill operation has ended.Both executable and script paths are unqualified. The project does not include or identify the expected
script.py, meaning resolution depends on the scheduled task's runtime environment, working directory, and executable search behavior. An attacker able to influence the resolved script or interpreter could use the scheduled task as a recurring execution mechanism.Although presented as a reference example rather than automatically executed code, following the instructions without additional validation creates system persistence.
Attack Path
- A user or agent follows the documented commands and registers
DailyTask. - An attacker places or replaces a file that resolves as
script.py, or influences whichpython.exeis selected. - Windows Task Scheduler triggers the task daily at 8:00 AM.
- The attacker-controlled code executes under the security context configured for the task.
- Execution continues across sessions until the task is disabled or removed.
Impact Assessment
Exploited code can obtain the permissions of the account under which the scheduled task runs. For a normal user, this may expose that user's files, credentials available to local processes, and calendar-related data. If the task is registered by an ...[truncated 225 chars]
- A user or agent follows the documented commands and registers
- Remediation
View remediation
Remediation Suggestions
-
Remove the scheduled-task example unless persistent execution is essential to the skill.
-
Require explicit user consent before creating any persistent task.
-
Use absolute, canonical paths for both the Python interpreter and the reviewed script.
-
Include the intended script in the audited project and verify its integrity before registration.
-
Configure the task with the least-privileged account required for its purpose.
-
Set an explicit working directory and prevent untrusted users from modifying the interpreter, script, or parent directories.
-
Use a collision-resistant, application-specific task name and verify that an existing task is not overwritten.
-
Document task inspection and removal, for example:
powershell Unregister-ScheduledTask -TaskName "DailyTask" -Confirm:$false -
Prefer a non-persistent reminder mechanism when persistent background execution is not necessary.
-
