T06 · System Persistence
Error
- Location
- scripts/setup.sh:422
- Finding
- Default Installation Creates a Persistent Background Watcher<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup.sh:422-487`, `config.json:12-20`, `scripts/watch-install.sh:221-277` **Vulnerability Type**: Default cross-session service and scheduled-task installation **Risk Level**: High ### Vulnerable Code Default configuration enables the watcher: ```json "watcher": { "enabled": true, "backend": "auto", "interval": 300, "grace": 20, "jobName": "Team Dispatch watcher", "jobDescription": "Low-frequency reconciliation: scan tasks/active for overdue in-progress tasks and reset to pending when retries remain.", "note": "Cross-platform background watcher installer. backend: auto|openclaw-cron|launchd|systemd|cron" } ``` The main setup process installs it unless the user supplies an opt-out: ```bash if [ "$NO_WATCH" -eq 1 ]; then echo " ⏭️ 已通过 --no-watch 禁用 watcher 安装" elif [ "$WATCH_ENABLED" = "0" ]; then echo " ⏭️ team-dispatch.json 中 watcher.enabled=false,跳过" elif [ "$ERRORS" -ne 0 ]; then echo " ⚠️ 安装存在错误($ERRORS),跳过 watcher 安装" else echo " ▶︎ backend=$WATCH_BACKEND interval=$WATCH_INTERVAL grace=$WATCH_GRACE" INTERVAL="$WATCH_INTERVAL" GRACE="$WATCH_GRACE" bash "$SKILL_DIR/scripts/watch-install.sh" --backend "$WATCH_BACKEND" \ && echo " ✅ watcher 已安装/启用" \ || echo " ⚠️ watcher 安装失败(不影响主功能)。可手动运行: bash $SKILL_DIR/scripts/watch-install.sh" fi ``` On Linux with systemd, the installer creates an always-restarting user service: ```ini [Unit] Description=Team Dispatch low-frequency watcher After=network.target [Service] Type=simple Environment=INTERVAL=$INTERVAL Environment=GRACE=$GRACE ExecStart=/bin/bash $SKILL_DIR/scripts/watch.sh Restart=always RestartSec=3 [Install] WantedBy=default.target ``` ```bash run systemctl --user daemon-reload run systemctl --user enable --now team-dispatch-watch.service ``` The fallback creates a reboot-persistent crontab entry: ```bash LINE="@reboot INTERVAL=$INTERVAL GRACE=$GRACE /bin/bash $SKILL_DIR/scri ...[truncated 2751 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Set `team.watcher.enabled` to `false` in the shipped default configuration. 2. Require a separate, explicit command or interactive confirmation before creating any scheduled service. 3. Before installation, display the scheduler backend, executable path, execution frequency, log paths, and uninstall command. 4. Do not execute persistent services through a mutable Skill symlink. Install a version-pinned copy in a user-owned directory with restrictive permissions. 5. Verify ownership and integrity of the persistent executable before each launch. 6. Prefer a one-shot reconciliation command invoked on demand or when an actual completion event is missed. 7. Ensure uninstallation removes all supported backends, associated environment variables, logs, and service definitions. ]]>
