T06 · System Persistence
- Location
- references/initialization.md:15
- Finding
- Persistent Scheduled Execution Through Cron and LaunchAgents<![CDATA[ ## Vulnerability Details **File Location**: `references/initialization.md:15-52, 63-70, 74-96` **Vulnerability Type**: Scheduled cross-session execution **Risk Level**: Medium ### Vulnerable Code ```bash # Monitor agent status every 10 minutes openclaw cron add \ --name dev-team-monitor \ --cron "*/10 * * * *" \ --command scripts/check-agents.sh \ --working-dir /Users/Vint/.openclaw/workspace/skills/dev-team \ --session isolated \ --no-deliver \ --message "Run the dev-team monitoring script" # Clean worktrees daily openclaw cron add \ --name dev-team-cleanup \ --cron "0 3 * * *" \ --command scripts/cleanup-worktrees.sh \ --working-dir /Users/Vint/.openclaw/workspace/skills/dev-team \ --session isolated \ --no-deliver ``` ```bash crontab -e */10 * * * * cd /path/to/skills/dev-team && ./scripts/check-agents.sh >> ./assets/logs/cron.log 2>&1 0 3 * * * cd /path/to/skills/dev-team && ./scripts/cleanup-worktrees.sh >> ./assets/logs/cleanup.log 2>&1 10 3 * * * cd /path/to/skills/dev-team && ./scripts/prune-history.sh --keep-days 7 --keep-count 50 >> ./assets/logs/prune.log 2>&1 ``` ```xml <plist version="1.0"> <dict> <key>Label</key> <string>com.dev-team.agent-check</string> <key>ProgramArguments</key> <array> <string>/bin/bash</string> <string>/path/to/skills/dev-team/scripts/check-agents.sh</string> </array> <key>StartInterval</key> <integer>600</integer> </dict> </plist> ``` ```bash launchctl load ~/Library/LaunchAgents/com.dev-team.agent-check.plist ``` ### Technical Analysis The initialization guide instructs users to establish recurring execution through OpenClaw cron, the operating-system crontab, or a macOS LaunchAgent. These mechanisms survive the original Skill session and repeatedly execute scripts with the permissions of the account that registered them. Periodic monitoring and cleanup are relevant to multi-agent orchestration, so the mechanism has a legitimate operati ...[truncated 1318 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Make all persistence mechanisms explicitly optional rather than presenting them as required initialization. - Prefer foreground monitoring or a manually started supervisor for ordinary use. - Document complete removal procedures, including: - `openclaw cron remove <job>` - removal of the relevant crontab entries - `launchctl unload <plist>` followed by deletion of the plist - Run scheduled tasks in a dedicated, least-privileged account or isolated execution environment. - Use absolute, administrator-approved paths and reject writable or symlinked script locations. - Verify script ownership, permissions, and integrity before every scheduled execution. - Restrict inherited environment variables and credential access. - Log registration, execution, updates, and removal of persistent jobs. ]]>
