T06 · System Persistence
Error
- Location
- scripts/lib/dlt_restore.py:61
- Finding
- SYSTEM-Level Scheduled Task Persistence Exceeds the Skill's Functional Requirements## Vulnerability Details **File Location**: `scripts/lib/dlt_restore.py:61-76`; `references/operations.md:106-111`; `SKILL.md:102-112` **Vulnerability Type**: Privileged scheduled-task persistence **Risk Level**: Critical ### Vulnerable Code ```python def restore_task(dest, force): xml = os.path.join(dest, f"{TASK_NAME}.xml") if not os.path.exists(xml): return False, f"Backup does not contain {TASK_NAME}.xml" if not force: return True, "dry-run" r = subprocess.run( ["schtasks", "/create", "/tn", TASK_NAME, "/xml", xml, "/f"], stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=30, ) ``` The documented deployment command further configures the task to run as the Windows Local System account with the highest run level: ```text schtasks /create /tn DLT_V8_Smart /tr "absolute-path\dlt_run_v8.bat" /sc weekly /d MON,WED,SAT /st 20:10 /ru SYSTEM /rl highest ``` ### Technical Analysis The Skill's declared core functionality is downloading public lottery information, analyzing that information, and generating a local report. These operations can be performed on demand under the invoking user's account and do not require a persistent SYSTEM-level execution mechanism. The project nevertheless treats a Windows scheduled task named `DLT_V8_Smart` as its preferred execution mechanism. The documented task: - Survives the current Skill invocation and user session. - Runs when no interactive user is logged in. - Executes as `SYSTEM`. - Uses the highest Windows task run level. - Runs a command from a mutable filesystem path on a recurring schedule. The restore utility can recreate this task through `schtasks /create`. Although actual creation requires the explicit `--force` option and administrative authorization, the resulting privilege and persistence are substantially broader than the minimum necessary for lottery-report generation. ...[truncated 1376 chars]
- Remediation
- ## Remediation Suggestions 1. Remove SYSTEM-level scheduling from the distributed Skill and keep report generation as an on-demand, unprivileged operation. 2. If scheduling is optional, require a separate, explicit installation flow that is never invoked by normal report generation or health checks. 3. Register optional tasks under the current user rather than SYSTEM and avoid `/rl highest`. 4. Display the exact executable, arguments, working directory, principal, and triggers before registration. 5. Place scheduled code in a directory that unprivileged users cannot modify. 6. Pin the Python interpreter and verify script hashes before every scheduled execution. 7. Provide an uninstall command that deletes the task and clearly document whether it is currently installed. 8. Do not treat absence of a SYSTEM task as a health-check failure for the lottery-analysis functionality.
