T06 · System Persistence
Error
- Location
- SKILL.md:71
- Finding
- Persistent Scheduled Watchdog for Automatic Trading Process Restart## Vulnerability Details **File Location**: `SKILL.md`, lines 71–73 **Vulnerability Type**: `T06: System Persistence` **Risk Level**: Critical **Vulnerable Code Snippet**: ```markdown ### Cron Setup (recommended) Add a Guardian cron or Windows Task that checks `competition_log_okx.txt` freshness every minute. If log hasn't updated in 6 minutes → kill and restart. ``` The persistence behavior is also described at line 52: ```markdown | 5 | Guardian | Windows Task checks every minute, restarts if dead | ``` ### Technical Analysis The Skill recommends configuring an operating-system cron job or Windows scheduled task that executes every minute and automatically terminates and restarts the trading process. Such a task survives the original Skill run and user session, creating a persistent execution mechanism. No implementation is supplied for the Guardian, and the documentation does not define: - The exact executable and absolute path that the task will launch - How the target process is identified before termination - File ownership or integrity validation for the trading manager - The operating-system account and privileges under which it runs - A maximum restart count or automatic failure cutoff - A safe removal or disablement procedure - A requirement for user approval before restarting live trading Because the project only contains `SKILL.md`, the watchdog, trading manager, and claimed safeguards cannot be audited. The vulnerable behavior is therefore the documented recommendation to establish persistent scheduled execution, rather than a verified task installation performed by included code. ### Attack Path 1. A user follows the recommendation and creates a cron job or Windows scheduled task that runs every minute. 2. The task is configured to monitor `competition_log_okx.txt` and restart the referenced trading manager when the log becomes stale. 3. An attacker or another compromised process rep ...[truncated 1642 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the recommendation to create a cron job or Windows scheduled task. Prefer explicit, per-session startup initiated by the user. 2. Require fresh user confirmation before restarting any process capable of live trading. 3. If automated monitoring is operationally necessary, include the complete auditable Guardian implementation in the project. 4. Run the watchdog and trading manager under a dedicated, unprivileged operating-system account. 5. Use an absolute executable path and verify the executable's owner, permissions, and cryptographic hash before every launch. 6. Ensure that only the dedicated account can modify the executable, configuration, working directory, and task definition. 7. Identify processes using a verified PID file or operating-system service identity rather than broad name matching. 8. Add bounded retries, exponential backoff, and a failure threshold that disables automatic restarts and alerts the user. 9. Provide exact installation, inspection, disablement, and removal instructions for every persistent task. 10. Separate demo and live configurations. Automatic restart should be disabled for live trading by default. 11. Restrict OKX API keys to the minimum required trading permissions, disable withdrawals, use IP allowlisting where supported, and rotate keys after suspected compromise. 12. Protect `.secrets/okx.env` with restrictive filesystem permissions and explicitly exclude it from version control. 13. Log every restart attempt and trading-mode transition without recording API secrets.
