T06 · System Persistence
- Location
SKILL.md:27- Finding
Privileged Systemd Service Persistence Without Verifiable Service Definition
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md, line 27
Vulnerability Type:T06: System Persistence
Risk Level: HighComplete 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.serviceTechnical Analysis
The command
sudo systemctl enable --now ssh-agentd.serviceperforms two privileged operations:- It starts the service immediately.
- 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-agentdand/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
- An attacker or another compromised process creates or modifies
ssh-agentd.service, its referenced executable, or associated configuration outside this project. - An operator or AI agent follows the Skill instructions and authorizes the
sudo systemctl enable --now ssh-agentd.servicecommand. - systemd immediately launches the externally defined and unaudited service with the privileges configured by its unit.
- The enable operation installs cross-session persistence, causing the same service to launch after subseque ...[truncated 857 chars]
- Remediation
View 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.servicewithoutenablewhen only temporary operation is required. - Before startup or enablement, inspect the effective unit with
systemctl cat ssh-agentd.serviceandsystemctl 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.
