T06 · System Persistence
- Location
SKILL.md:79- Finding
Long-Lived Scheduled Task Enables Persistent Arbitrary Script Execution
- Content
View full analysis
' $script = '<脚本绝对路径>' $workDir = '<脚本所在目录>' $action = New-ScheduledTaskAction -Execute $python -Argument ('"{0}"' -f $script) -WorkingDirectory $workDir $trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddMinutes(1) -RepetitionInterval (New-TimeSpan -Minutes <间隔分钟>) -RepetitionDuration (New-TimeSpan -Days 365) $settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -ExecutionTimeLimit (New-TimeSpan -Minutes 5) -MultipleInstances IgnoreNew Register-ScheduledTask -TaskName "<任务名>-<间隔分钟>min" -Action $action -Trigger $trigger -Settings $settings -Description '<任务描述>' -Force ``` Supporting instructions state that the Agent should complete the process automatically, provide commands for managing the persistent task, and use `Register-ScheduledTask` when `schtasks` is blocked: ```text ## 执行流程(Agent 全自动完成,用户无需动手) ``` ```text - **修改间隔**:删除后重建(`Unregister-ScheduledTask -TaskName X -Confirm:$false`,再走 Step 4) - **暂停**:`Disable-ScheduledTask -TaskName X`(保留定义,可恢复) - **恢复**:`Enable-ScheduledTask -TaskName X` - **彻底删除**:`Unregister-ScheduledTask -TaskName X -Confirm:$false` ``` ```text - `schtasks` 等系统工具被安全策略禁用 → 用 `Register-ScheduledTask`(本方案不依赖 schtasks) ``` ### Technical Analysis The Skill instructs the Agent to generate a Python script containing task-specific logic and register that script with Windows Task Scheduler. The resulting task executes every N minutes for 365 days and survives the Agent session, application restarts, and user logon boundaries supported by the task's execution context. Scheduled execution is related to the Skill's declared minute-level scheduling function. However, the implementation creates a significant persistence boundary without requiring explicit, informed ...[truncated 2918 chars]- Remediation
View remediation
