T06 · System Persistence
- Location
- scripts/setup.sh:137
- Finding
- Reboot-Persistent System Service Installation<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup.sh:137-157` **Vulnerability Type**: System-wide service persistence **Risk Level**: High ### Vulnerable Code ```bash if [ "$INSTALL_SERVICE" = true ]; then echo "==> Installing systemd service..." ANTSEED_BIN=$(command -v antseed) sudo tee /etc/systemd/system/antseed-buyer.service > /dev/null <<SERVICE [Unit] Description=AntSeed Buyer Proxy After=network-online.target Wants=network-online.target [Service] Type=simple User=$(whoami) ExecStart=${ANTSEED_BIN} connect --router local-proxy --port ${PORT} Restart=on-failure RestartSec=10 StandardOutput=journal StandardError=journal SyslogIdentifier=antseed-buyer [Install] WantedBy=multi-user.target SERVICE sudo systemctl daemon-reload sudo systemctl enable --now antseed-buyer echo " Service installed and started" ``` The same persistence procedure is explicitly documented in `SKILL.md:47-68`. ### Technical Analysis When the `--service` option is supplied, the setup script uses `sudo` to create a system-wide systemd unit under `/etc/systemd/system`. It then enables and immediately starts the service. The service survives the Skill run, user logout, and system reboot. Running the proxy continuously may be convenient, and the behavior is disclosed through the option and documentation. However, system-wide persistence is not necessary for the Skill's minimum declared functionality: the proxy can operate as an ordinary foreground process. A user-level systemd unit would also satisfy most persistence requirements without modifying system-wide startup configuration. The persisted executable comes from a globally installed, unpinned npm package and connects to an external P2P network. The unit has no meaningful systemd sandboxing controls such as `NoNewPrivileges`, `ProtectSystem`, `ProtectHome`, `PrivateTmp`, or restrictive network policies. ### Attack Path 1. A user runs `scripts/setup.sh` with the `--service` option or follows the ...[truncated 1037 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Keep foreground execution as the default and request explicit confirmation before installing any persistent service. 2. Prefer a user-level unit under `~/.config/systemd/user/` and use `systemctl --user`, avoiding sudo and `/etc/systemd/system`. 3. If a system service is genuinely required, apply systemd hardening controls, including: - `NoNewPrivileges=true` - `PrivateTmp=true` - `ProtectSystem=strict` - `ProtectHome=true` or a narrowly scoped alternative - `ProtectKernelTunables=true` - `ProtectControlGroups=true` - `RestrictSUIDSGID=true` - A restrictive `UMask` - Explicitly limited writable paths and network access 4. Pin and verify the executable and plugin versions before registering them for startup. 5. Provide an uninstall operation that stops, disables, and removes the unit, followed by `systemctl daemon-reload`. 6. Clearly disclose that the process connects to a P2P network and remains active after reboot. ]]>
