T06 · System Persistence
Error
- Location
- install.sh:52
- Finding
- Installer creates privileged and recurring persistence without explicit opt-in<![CDATA[ ## Vulnerability Details **File Location**: `install.sh:52-55`, `install.sh:89-92`; related service startup in `run.sh:12-18` **Vulnerability Type**: Persistent system service and scheduled task registration **Risk Level**: High ### Vulnerable Code ```bash if ! systemctl is-active --quiet syncthing@claw 2>/dev/null; then sudo systemctl enable syncthing@claw sudo systemctl start syncthing@claw fi ``` ```bash if ! crontab -l 2>/dev/null | grep -q "auto-commit-memory.sh"; then (crontab -l 2>/dev/null; echo "*/30 * * * * $SKILL_DIR/scripts/auto-commit-memory.sh >> $LOG_FILE 2>&1") | crontab - fi ``` Related startup behavior: ```bash if systemctl is-active --quiet syncthing@claw 2>/dev/null; then echo "Syncthing is already running" else sudo systemctl start syncthing@claw sleep 2 fi ``` ### Technical Analysis The installer enables a system-level Syncthing service and adds a user cron entry that runs every 30 minutes. These changes survive the installation process and future interactive sessions. Enabling a service with `sudo` crosses a privilege boundary and affects system startup behavior. Continuous synchronization is related to an advertised optional feature, but it is not required for local memory indexing, searching, tagging, or graph generation. The installer does not request explicit consent for either persistence mechanism, offer a local-only installation mode, validate the service configuration, or provide an uninstall routine. The cron entry invokes a script from a writable workspace path. If that script or any parent path becomes attacker-controlled, the persistent scheduler becomes a recurring code-execution mechanism under the affected user account. ### Attack Path 1. A user runs `install.sh` expecting the memory Skill to be installed. 2. The script invokes `sudo systemctl enable syncthing@claw`, causing Syncthing to start automatically in future boots. 3. The script adds `auto-commit-memory.sh` to the user's ...[truncated 663 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Make Syncthing and cron configuration explicit, optional installation modes. - Do not invoke `sudo` from the general-purpose installer. Print a reviewed command that an administrator may run separately. - Prefer a user-scoped service such as `systemctl --user` when persistence is explicitly requested. - Display the exact schedule, executable path, and data synchronized before asking for confirmation. - Verify script ownership and permissions before scheduling it; reject group-writable or world-writable paths. - Provide an uninstall command that disables the service and removes only the exact cron entry created by this Skill. - Default to manual synchronization and local-only operation. ]]>
