T06 · System Persistence
Warning
- Location
- scripts/install.sh:144
- Finding
- Automatically Installed Persistent Cron Task with Excessive Execution Frequency<![CDATA[ ## Vulnerability Details **File Location**: `scripts/install.sh:144-154` **Vulnerability Type**: Persistent scheduled execution **Risk Level**: Medium ### Vulnerable Code ```bash # 移除旧的 cron 任务(如果有) (crontab -l 2>/dev/null | grep -v "memory-workflow" || true) > /tmp/cron_temp # 添加新的 cron 任务 echo "*/1 * * * * $SCRIPTS_DIR/daily-summary.sh >> $LOGS_DIR/daily-summary.log 2>&1" >> /tmp/cron_temp # 安装 cron 任务 crontab /tmp/cron_temp rm /tmp/cron_temp ``` ### Technical Analysis The installer automatically modifies the installing account's crontab and registers `daily-summary.sh` for execution every minute. This scheduled task survives the installation process and subsequent login sessions. Scheduled execution is related to the declared daily-summary functionality and is disclosed in `SKILL.md`. However, running the script every minute is broader than the minimum execution frequency normally required to create one daily note. The task is also installed automatically rather than through a separate, explicit scheduling opt-in. The installer removes all existing crontab lines containing the substring `memory-workflow`. This is not restricted to an exact entry managed by this package and could unintentionally delete unrelated entries that happen to contain the same text. The paths are hard-coded under `/root/.openclaw/workspace`, indicating that the task is expected to run in a privileged root environment. Any subsequent modification of the scheduled script or its sourced configuration would therefore be executed repeatedly with the privileges of the crontab owner. ### Attack Path 1. The Skill installer is run, potentially as root because all operational paths are under `/root`. 2. The installer rewrites the current account's crontab. 3. A persistent cron entry invokes `daily-summary.sh` every minute. 4. If the scheduled script, its template, or the sourced configuration later becomes writable by an untrusted party, that party can introduce commands i ...[truncated 610 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Require explicit user consent before modifying the crontab. 2. Avoid hard-coded `/root` paths. Derive the workspace from a validated installation directory and run under a dedicated, unprivileged account. 3. Reduce the execution frequency to the minimum required. Prefer two narrowly scheduled jobs—one at the configured summary time and one after the timeout—rather than polling every minute. 4. Mark the managed entry with an exact unique identifier and remove only an exact match. Do not filter every entry containing `memory-workflow`. 5. Display the exact proposed cron entry before installation and provide a documented uninstall command. 6. Verify that the scheduled script and configuration are owned by the expected account and are not group- or world-writable. 7. Consider a user-level scheduler or application-native task mechanism instead of a privileged system cron entry. ]]>
