T06 · System Persistence
Error
- Location
- SKILL.md:96
- Finding
- Privileged System-Wide Persistence Through a Systemd Service<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:96-120` **Vulnerability Type**: `T06: System Persistence` **Risk Level**: High ### Vulnerable Code ```bash ### Step 6: Make it persistent (recommended) The webhook should survive reboots. Create a systemd service: cat > /tmp/vitavault-webhook.service << 'EOF' [Unit] Description=VitaVault Webhook Receiver After=network.target [Service] Type=simple User=$USER Environment=VITAVAULT_SYNC_TOKEN=<TOKEN> ExecStart=/usr/bin/python3 /path/to/skills/vitavault/scripts/webhook.py --host 127.0.0.1 --port 8787 Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target EOF # Adjust paths and token, then: sudo cp /tmp/vitavault-webhook.service /etc/systemd/system/ sudo systemctl daemon-reload sudo systemctl enable --now vitavault-webhook ``` ### Technical Analysis The setup instructions direct the Agent to use `sudo` to copy a service definition into `/etc/systemd/system/` and enable it at boot. This creates cross-session, reboot-persistent execution of the Python script. Continuous webhook operation is relevant to automatic health synchronization, but a root-authorized, system-wide service is not the minimum privilege necessary. An on-demand process or per-user service could provide the same functionality without modifying global startup configuration. The configured executable is also a Python script under a potentially mutable Skill installation path. If that script is replaced after service installation, the replacement code will run automatically under the configured service account. The service definition provides no meaningful systemd sandboxing or write restrictions. ### Attack Path 1. A user asks the Agent to configure VitaVault synchronization. 2. The Agent creates the service definition in `/tmp`. 3. The Agent uses `sudo` to install it into the system-wide systemd directory. 4. The service is enabled and starts automatically after subsequent reboots. 5. If the configured script path ...[truncated 585 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Require explicit, informed user approval before creating any persistent service. - Prefer a per-user systemd unit under `~/.config/systemd/user/` rather than a system-wide service. - Run the receiver on demand where continuous synchronization is unnecessary. - Point `ExecStart` to an immutable, administrator-controlled installation path. - Add systemd hardening directives such as: - `NoNewPrivileges=true` - `PrivateTmp=true` - `ProtectSystem=strict` - `ProtectHome=read-only` - `ReadWritePaths=%h/vitavault/data` - `RestrictAddressFamilies=AF_INET AF_INET6` - Load secrets through systemd credentials or a permission-restricted environment file. - Document commands to stop, disable, and remove the service. ]]>
