T06 · System Persistence
- Location
- SETUP_AI.md:153
- Finding
- Automatic Cross-Session Persistence Through Scheduled Tasks, launchd, and cron<![CDATA[ ## Vulnerability Details **File Location**: `SETUP_AI.md:153-175` **Vulnerability Type**: Automatic startup persistence with elevated execution **Risk Level**: High ### Complete Code Snippet ```powershell ### 1.7 Register SENTINEL as Scheduled Task **Windows:** $action = New-ScheduledTaskAction -Execute "powershell.exe" -Argument "-ExecutionPolicy Bypass -WindowStyle Hidden -File `"$env:USERPROFILE\.openclaw\SENTINEL.ps1`"" $trigger = New-ScheduledTaskTrigger -AtLogOn Register-ScheduledTask -TaskName "AISentinel" -Action $action -Trigger $trigger -RunLevel Highest -Force ``` ```bash # macOS cp engine/com.adamframework.sentinel.plist ~/Library/LaunchAgents/ launchctl load ~/Library/LaunchAgents/com.adamframework.sentinel.plist # Linux (crontab -l 2>/dev/null; echo "@reboot /bin/bash ~/.openclaw/SENTINEL.sh >> ~/.openclaw/sentinel.log 2>&1") | crontab - ``` Equivalent instructions also appear in `SETUP_HUMAN.md:157-184` and `docs/SETUP.md:262-267`. ### Technical Analysis The installation process creates persistence across logins and reboots on Windows, macOS, and Linux. On Windows, it additionally requests the highest task run level, suppresses the PowerShell window, and bypasses the PowerShell execution policy. An always-running watchdog is consistent with the advertised availability and automatic memory-reconciliation features. However, persistence is not strictly required to provide file-based memory retrieval. The elevated Windows run level also exceeds the minimum privileges needed to read and update files in a user-owned vault. The registered script remains in a user-writable location. Any later modification of that file—whether through another compromised process, malicious update, or poisoned installation—will be executed automatically at subsequent logins or reboots. ### Attack Path 1. The user or an AI agent follows the setup guide. 2. The Sentinel script is copied into `~/.openclaw` or the corresponding Windows profile directory. 3 ...[truncated 771 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Make automatic startup an explicit, separately confirmed opt-in rather than a mandatory installation phase. - Default to manual execution or a user-level service with no elevated run level. - Remove `-RunLevel Highest`, `-WindowStyle Hidden`, and `-ExecutionPolicy Bypass`. - Store the executable script in a directory that is not writable by unrelated processes. - Validate the script owner and an integrity hash before every launch. - Use native service-manager restart controls rather than implementing an independent persistent watchdog. - Document exact removal commands for Task Scheduler, launchd, and cron. - Prevent duplicate cron entries and verify existing configuration before modifying it. ]]>
