T06 · System Persistence
- Location
references/setup.md:59- Finding
Persistent Root-Privileged Arbitrary Command Service
- Content
View full analysis
Vulnerability Details
File Location:
references/setup.md, lines 59-64
Vulnerability Type: Persistent privileged command-execution service
Risk Level: CriticalVulnerable Code
bash sudo cp ~/hostlink/hostlink.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable hostlinkd sudo systemctl start hostlinkd sudo systemctl status hostlinkdThe guide further states at
references/setup.md:134-136:text - All commands run as the user hostlinkd is started as (typically root if using systemd). Consider running as a dedicated less-privileged user for production use.Technical Analysis
The installation procedure copies a systemd unit into the system service directory and enables it at startup. This causes the daemon to survive reboots and future sessions. The daemon exposes arbitrary shell-command execution and, according to the documentation, normally runs as root when installed through systemd.
Although persistent service registration can be operationally reasonable for a host-management daemon, the documented configuration does not apply least privilege. Generic host command execution does not inherently require root access, and unrestricted
/bin/bashexecution gives the client every privilege held by the daemon.The actual
hostlink.servicefile and daemon source are not included in the audited project. Consequently, systemd sandboxing, privilege dropping, request authorization, token validation, command restrictions, and logging behavior cannot be verified.Attack Path
- An attacker compromises the OpenClaw agent, its container, or the authentication token.
- The attacker connects to the enabled HostLink service through the mounted Unix socket.
- The attacker submits an arbitrary shell command using
hostlink exec. hostlinkdexecutes the command with its service identity, documented as typically root.- The attacker modifies ...[truncated 557 chars]
- Remediation
View remediation
Remediation Suggestions
- Do not enable the daemon automatically as part of the default setup. Require an explicit, documented administrator decision before creating a persistent service.
- Run
hostlinkdunder a dedicated, non-login, unprivileged account instead of root. - Replace unrestricted shell execution with narrowly scoped, allowlisted RPC operations.
- Require explicit approval or separate authorization for privileged operations.
- Use a privilege-separation helper for the small subset of operations that genuinely require elevation.
- Harden the systemd unit with options such as
NoNewPrivileges=yes,ProtectSystem=strict,ProtectHome=yes,PrivateTmp=yes,PrivateDevices=yes,RestrictSUIDSGID=yes, capability restrictions, syscall filtering, and restrictive filesystem access. - Disable unnecessary network listeners and bind only to the protected Unix socket.
- Add comprehensive command, identity, result, and authorization logging.
- Publish the complete service unit and daemon source with the Skill so their security properties can be audited.
