T06 · System Persistence
Warning
- Location
- heartbeat.md:111
- Finding
- Persistent Five-Minute Cron Job Introduces Unnecessary Cross-Session Execution<![CDATA[ ## Vulnerability Details **File Location**: `heartbeat.md:111-115` **Vulnerability Type**: Persistent scheduled-task registration **Risk Level**: Medium ### Vulnerable Code ```bash # Edit crontab crontab -e # Add line to run every 5 minutes */5 * * * * /path/to/heartbeat.sh >> /var/log/solclaw-heartbeat.log 2>&1 ``` ### Technical Analysis The instructions encourage users to install a cron entry that executes `heartbeat.sh` every five minutes and persists across terminal sessions, reboots, and individual skill invocations. Periodic monitoring is related to the heartbeat functionality, but permanent operating-system scheduling is not necessary for the core on-demand payment functionality. The cron entry trusts a mutable filesystem path without documenting ownership, integrity controls, restrictive permissions, or safe removal. If another account or process can modify the script or one of its parent directories, the scheduled job becomes a recurring command-execution mechanism under the account that installed it. The suggested `/var/log/solclaw-heartbeat.log` destination may require elevated permissions on typical systems. This could lead users to run setup steps with unnecessary privileges or weaken log-file permissions. ### Attack Path 1. A user creates `heartbeat.sh` and installs the provided cron entry. 2. The scheduled task remains active across future sessions and system restarts. 3. An attacker compromises or replaces the referenced script, or gains write access to one of its parent directories. 4. Cron executes the modified script automatically every five minutes. 5. The attacker's commands run with the permissions of the user who owns the crontab. 6. If the task was installed under a privileged account, the resulting commands inherit that account's broader access. ### Impact Assessment Successful exploitation provides recurring command execution under the cron owner's account. This can expose files, wallet configuration, environment ...[truncated 439 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Make scheduled monitoring explicitly optional and require informed user confirmation before installation. - Prefer on-demand checks for the default workflow. - If scheduling is required, use a dedicated, unprivileged user-level timer with sandboxing and resource limits. - Store the script in a user-owned directory with restrictive permissions, such as mode `0700` for the directory and `0700` or `0500` for the script. - Verify that neither the script nor its parent directories are writable by untrusted users. - Write logs to a user-owned location rather than `/var/log`, and configure log rotation and restrictive permissions. - Use absolute paths for the executable and all referenced files. - Document how to inspect and remove the cron entry. - Avoid installing the task under `root` or requesting elevated privileges. ]]>
