T06 · System Persistence
Error
- Location
- SKILL.md:53
- Finding
- Persistent Always-On Desktop-Control Service<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 53–132 **Vulnerability Type**: Persistent startup service or scheduled task **Risk Level**: High ### Vulnerable Code ```bash ### Running as a Background Service For always-on desktop control, set up as a system service: **macOS (launchd):** ```bash # Create a plist file cat > ~/Library/LaunchAgents/com.cua.server.plist <<EOF <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Label</key> <string>com.cua.server</string> <key>ProgramArguments</key> <array> <string>/usr/local/bin/cua-server</string> <string>start</string> <string>--port</string> <string>8000</string> </array> <key>RunAtLoad</key> <true/> <key>KeepAlive</key> <true/> </dict> </plist> EOF # Load the service launchctl load ~/Library/LaunchAgents/com.cua.server.plist # Start the service launchctl start com.cua.server ``` **Linux (systemd):** ```bash # Create service file sudo tee /etc/systemd/system/cua-server.service > /dev/null <<EOF [Unit] Description=CUA Computer Server After=network.target [Service] Type=simple User=$USER Environment="DISPLAY=:0" Environment="XAUTHORITY=/home/$USER/.Xauthority" ExecStart=/usr/local/bin/cua-server start --port 8000 Restart=always RestartSec=10 [Install] WantedBy=multi-user.target EOF # Enable and start the service sudo systemctl daemon-reload sudo systemctl enable cua-server sudo systemctl start cua-server # Check status sudo systemctl status cua-server ``` **Windows (Task Scheduler):** ```powershell # Create a scheduled task to run at startup $action = New-ScheduledTaskAction -Execute "cua-server.exe" -Argument "start --port 8000" $trigger = New-ScheduledTaskTrigger -AtStartup $principal = New-ScheduledTaskPrincipal -UserId "$env:USERNAME" -LogonType Interactive $settings = New-ScheduledTaskSe ...[truncated 3299 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove persistent service registration from the default installation procedure. 2. Start the CUA server only after an explicit user request and terminate it when the requested desktop-control operation is complete. 3. If persistent operation is genuinely required, present it as a separate, clearly disclosed opt-in configuration with an explicit warning about desktop takeover risks. 4. Require a strong, randomly generated authentication token even when binding only to localhost. 5. Restrict the listener explicitly to `127.0.0.1` and reject startup if authentication is absent. 6. Prefer per-user service management over a system-wide systemd unit; avoid `sudo` and `/etc/systemd/system` where possible. 7. Apply API authorization so clients receive only the commands needed for a specific workflow. 8. Add request logging, rate limiting, token rotation, and a visible indication that remote desktop control is active. 9. Provide complete removal procedures for every platform, including unloading and deleting the launch agent, disabling and deleting the systemd unit, and unregistering the Windows scheduled task. 10. Do not configure unconditional restart behavior unless required and explicitly approved by the user. ]]>
