T06 · System Persistence
- Location
scripts/doctor-call.sh:107- Finding
Persistent Systemd Timer Executes Automated Repair Operations Across Sessions
- Content
View full analysis
Vulnerability Details
File Location:
scripts/doctor-call.sh, lines 107–139
Vulnerability Type:T06: System Persistence
Risk Level: HighThe
setupaction creates, enables, and immediately starts a systemd user timer. This timer survives the original Skill invocation and repeatedly executes thefixaction every five minutes.bash elif [ "$ACTION" = "setup" ]; then # Set up systemd user timer (no sudo needed!) echo -e "${GREEN}🔧 Setting up auto-restart via systemd...${NC}" echo "" mkdir -p ~/.config/systemd/user # Create systemd service (user-level, no sudo needed) cat > ~/.config/systemd/user/openclaw-health.service <<'EOF' [Unit] Description=OpenClaw Health Monitor [Service] Type=oneshot ExecStart=/home/umbrel/.openclaw/skills/doctor-call/scripts/doctor-call.sh fix StandardOutput=journal StandardError=journal EOF # Create systemd timer (runs every 5 minutes) cat > ~/.config/systemd/user/openclaw-health.timer <<'EOF' [Unit] Description=Run OpenClaw health check every 5 minutes [Timer] OnBootSec=30 OnUnitActiveSec=5min Unit=openclaw-health.service [Install] WantedBy=default.target EOF systemctl --user daemon-reload systemctl --user enable openclaw-health.timer systemctl --user start openclaw-health.timerTechnical Analysis
Enabling a systemd timer establishes cross-session scheduled execution under the affected user's account. Thirty seconds after the user service manager starts, and every five minutes thereafter, systemd invokes the service's hard-coded script path with the
fixargument.The invoked repair path can run
openclaw doctor --repairand restartopenclaw-gateway. Consequently, configuration changes and service restarts may occur without new approval in later sessions.The
ExecStartvalue is hard-coded to/home/umbrel/.openclaw/skills/doctor-call/scripts/doctor-call.shrather th ...[truncated 1871 chars]- Remediation
View remediation
Remediation Suggestions
- Remove automatic creation and activation of persistent systemd units from the normal Skill workflow. Prefer a one-shot health check that runs only when explicitly requested.
- If recurring monitoring is essential, distribute separately reviewable service and timer templates and require explicit, informed approval before installation and activation.
- Clearly disclose that the task survives the current session, its exact five-minute frequency, the commands it can run, and the supported removal procedure.
- Resolve the script's canonical absolute path during installation instead of using
/home/umbrel/.... Validate that the target is a regular file owned by the expected user and is not writable by untrusted users. - Consider copying an integrity-verified executable into a user-owned, non-shared installation directory and reference that exact protected path from
ExecStart. - Check the exit status of unit creation,
daemon-reload,enable, andstart; do not report success when any operation fails. - Make the documented and displayed interval match the timer configuration.
- Require separate confirmation before any recurring task performs configuration repair or gateway restart. A safer timer should perform read-only health checks and only emit an alert.
- Ensure
removestops and disables the timer, deletes both unit files, reloads systemd, resets failed state where necessary, and verifies that no active or enabled unit remains.
