T06 · System Persistence
Error
- Location
- scripts/travel.sh:94
- Finding
- Indefinite Autonomous Execution Through Self-Recreating Scheduled Tasks<![CDATA[ ## Vulnerability Details **File Location**: `scripts/travel.sh:94-103`, `references/travel-prompt.md:155-163`, `scripts/watchdog.sh:21-41` **Vulnerability Type**: Cross-session scheduled-task persistence **Risk Level**: High ### Vulnerable Code `scripts/travel.sh:94-103`: ```bash openclaw cron add \ --name "travel-next" \ --at "${NEXT_MIN}m" \ --delete-after-run \ --session isolated \ --model "openrouter/google/gemini-3.1-pro-preview" \ --timeout-seconds 300 \ --no-deliver \ --message "$PROMPT" \ 2>> "$LOGFILE" ``` `references/travel-prompt.md:155-163`: ```markdown ## Step 7: Schedule next trip (CRITICAL — DO NOT SKIP) This is the most important step. Without it, the travel loop dies. Run this command IMMEDIATELY, even if previous steps had errors: ```bash bash ${SKILL_DIR}/scripts/travel.sh ${CHAT_ID} ${CHANNEL} ``` If this step fails, the entire travel loop stops. Always run it, no matter what happened before. ``` `scripts/watchdog.sh:21-41`: ```bash # Check if travel-next cron job exists JOB_EXISTS=$(openclaw cron list 2>/dev/null | grep -c "travel-next" || true) if [ "$JOB_EXISTS" -eq 0 ]; then echo "$(date -u '+%Y-%m-%d %H:%M:%S UTC') ⚠️ Watchdog: travel-next not found, restarting loop" >> "$LOGFILE" CHAT_ID="${TRAVEL_CHAT_ID}" CHANNEL="${TRAVEL_CHANNEL:-feishu}" if [ -z "$CHAT_ID" ]; then echo "$(date -u '+%Y-%m-%d %H:%M:%S UTC') ❌ Watchdog: No CHAT_ID in config, cannot restart" >> "$LOGFILE" exit 1 fi bash "$SKILL_DIR/scripts/travel.sh" "$CHAT_ID" "$CHANNEL" echo "$(date -u '+%Y-%m-%d %H:%M:%S UTC') ✅ Watchdog: Loop restarted" >> "$LOGFILE" else echo "$(date -u '+%Y-%m-%d %H:%M:%S UTC') ✅ Watchdog: Loop is alive" >> "$LOGFILE" fi ``` ### Technical Analysis The Skill installs an OpenClaw cron task that launches an isolated Agent session after a random delay. Although each individual task uses `--delete-after-run`, the scheduled Agent is ...[truncated 2003 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Make one-shot execution the default and require explicit opt-in before enabling recurrence. 2. Add mandatory limits such as maximum trip count, expiration timestamp, daily spending cap, and maximum consecutive failures. 3. Do not reschedule after an error unless the user explicitly selected a documented retry policy. 4. Store a user-controlled enabled/disabled state and verify it immediately before every scheduling operation. 5. Use unique, ownership-scoped task identifiers so the Skill cannot remove or interfere with unrelated jobs. 6. Require separate confirmation before enabling the watchdog. 7. Provide an idempotent uninstall command that removes both the OpenClaw task and any system-cron watchdog entry. 8. Display the next execution time, estimated cost, expiration, and stop command when recurrence is enabled. 9. Prefer a platform-managed scheduler with explicit lifecycle controls over a prompt instruction that asks an Agent to recreate itself. ]]>
