T06 · System Persistence
Error
- Location
- SKILL.md:27
- Finding
- Privileged Systemd Service Persistence Without Verifiable Service Definition## Vulnerability Details **File Location**: `SKILL.md`, line 27 **Vulnerability Type**: `T06: System Persistence` **Risk Level**: High **Complete Code Snippet**: ```bash sudo systemctl daemon-reload sudo systemctl enable --now ssh-agentd.service sudo systemctl restart ssh-agentd.service sudo systemctl stop ssh-agentd.service ``` ### Technical Analysis The command `sudo systemctl enable --now ssh-agentd.service` performs two privileged operations: 1. It starts the service immediately. 2. It registers the service to start automatically on future boots. Persistence is related to the Skill's declared support for a systemd-resident SSH agent and persistent SSH sessions. However, enabling boot persistence is not necessary for routine API requests, health checks, session inspection, or one-time service execution. It therefore exceeds the minimum privileges required for those common operations unless the user explicitly requests automatic startup. The service unit, referenced executable, and configuration are not included in the audited project. The documentation instead references external resources such as `/home/krex/.openclaw/workspace-hermes/ssh-agentd/bin/ssh-agentd` and `/home/krex/.openclaw/ssh-agentd/hosts.yaml`. Consequently, this package cannot establish what executable systemd will launch, which user it will run as, or whether appropriate systemd sandboxing is configured. ### Attack Path 1. An attacker or another compromised process creates or modifies `ssh-agentd.service`, its referenced executable, or associated configuration outside this project. 2. An operator or AI agent follows the Skill instructions and authorizes the `sudo systemctl enable --now ssh-agentd.service` command. 3. systemd immediately launches the externally defined and unaudited service with the privileges configured by its unit. 4. The enable operation installs cross-session persistence, causing the same service to launch after subseque ...[truncated 857 chars]
- Remediation
- ## Remediation Suggestions - Do not enable the service automatically as part of routine Skill use. Separate API operations, temporary service startup, and boot-persistence setup into distinct workflows. - Require explicit, informed user confirmation before executing `sudo systemctl enable`, clearly stating that it creates persistence across reboots. - Prefer `systemctl start ssh-agentd.service` without `enable` when only temporary operation is required. - Before startup or enablement, inspect the effective unit with `systemctl cat ssh-agentd.service` and `systemctl show ssh-agentd.service`. - Verify the referenced executable and configuration using trusted ownership, restrictive permissions, and a known-good checksum or signature. - Confirm that neither the unit nor its executable is writable by untrusted users. - Run the daemon as a dedicated unprivileged account, or use a per-user systemd service where system-wide privileges are unnecessary. - Harden the unit with appropriate controls such as `NoNewPrivileges=true`, `ProtectSystem=strict`, `ProtectHome=true`, `PrivateTmp=true`, restricted capabilities, and narrowly scoped filesystem access. - Keep the API bound to loopback unless remote exposure is explicitly required, and retain authentication for commands capable of remote execution. - Include the service unit or a verifiable unit template in the audited package so its executable path, service user, capabilities, and sandboxing can be reviewed.
