T06 · System Persistence
Error
- Location
- scripts/setup_cron.py:107
- Finding
- Persistent Recurring OpenClaw Jobs Installed Without Lifecycle Controls## Vulnerability Details **File Location**: `scripts/setup_cron.py:107-125` **Additional Location**: `scripts/setup_cron.py:158-183` **Vulnerability Type**: Persistent scheduled-task installation **Risk Level**: High ### Vulnerable Code ```python def execute_openclaw_cron(job_name, cron_expr, message): current_channel = load_active_channel() try: current_user_id = load_user_id_for_channel(current_channel) args = [ 'openclaw', 'cron', 'add', '--name', job_name, '--cron', cron_expr, '--tz', CURRENT_TZ, '--session', 'isolated', '--wake', 'now', '--channel', current_channel, '--to', current_user_id, '--message', message, '--announce' ] result = subprocess.run(args, capture_output=True, text=True) ``` The function is called by the main installation flow to create the following recurring jobs: - `daily-recorder-assistant-morning` with schedule `0 8 * * *` - `daily-recorder-assistant-evening` with schedule `0 18 * * *` ### Technical Analysis The setup script invokes `openclaw cron add` to create two recurring scheduled jobs. These jobs remain registered after the script and invoking session terminate, wake isolated OpenClaw sessions, and announce messages to the channel and user identifier loaded from persistent `state.json`. Scheduled reminders are related to the declared daily-recording functionality and installation is documented as a separate setup step. However, the persistence mechanism is not required for manual recording, analysis, or planning. It therefore exceeds the minimum privileges necessary for the Skill's core functionality unless the user explicitly opts into automated reminders. The script checks whether similarly named jobs already exist, but it continues installation when they are found. Consequently, repeated execution c ...[truncated 1913 chars]
- Remediation
- ## Remediation Suggestions 1. Keep manual operation as the default and require an explicit `--install-reminders` option. 2. Display the exact schedules, destination channel, destination user, and persistence implications before installation. 3. Require interactive confirmation immediately before invoking `openclaw cron add`, with a noninteractive confirmation flag for controlled automation. 4. Abort when matching jobs already exist unless the user supplies an explicit `--force` or `--allow-duplicates` option. 5. Record the exact job IDs returned by OpenClaw in a dedicated state structure after successful installation. 6. Add an `--uninstall` mode that removes only the exact job IDs created by this Skill. 7. Support optional expiration dates or bounded reminder counts rather than indefinite recurrence. 8. Validate that the destination user ID is authorized and reject placeholder values such as unconfigured or pending authorization. 9. Document removal commands directly beside installation instructions. 10. Correct the initialization message that describes `setup_cron.py` as a system crontab mechanism; the reviewed implementation registers OpenClaw cron jobs instead.
