T05 · Unauthorized Access and Privilege Escalation
- Location
scripts/install.sh:9- Finding
Root System Service Executes User-Writable JavaScript
- Content
View full analysis
/dev/null << EOF [Unit] Description=iblai-router - Cost-optimizing Claude model routing After=network.target [Service] Type=simple ExecStart=$NODE_BIN $ROUTER_DIR/server.js Environment=ANTHROPIC_API_KEY=$API_KEY Environment=ROUTER_CONFIG=$ROUTER_DIR/config.json Environment=ROUTER_PORT=$PORT Environment=ROUTER_LOG=1 Restart=always RestartSec=3 [Install] WantedBy=multi-user.target EOF sudo systemctl daemon-reload sudo systemctl enable --now "$SERVICE_NAME" ``` ### Technical Analysis The installer creates a system-wide systemd unit but does not define a `User=` or `Group=` directive. System services run as root by default. The service therefore launches Node.js with root privileges. The executed `server.js` file is stored under the installing user's home directory at `~/.openclaw/workspace/router/server.js`. That location remains writable by the unprivileged user. This violates a fundamental privilege-boundary requirement: a privileged service must not execute code that a less-privileged user can modify. The router only needs to listen on `127.0.0.1:8402`, an unprivileged port, read its configuration, and make outbound HTTPS requests. Root access is not necessary for its declared functionality. Although persistent execution is relevant to operating a proxy, system-wide root persistence exceeds the minimum privileges required. ### Attack Path 1. A user runs `scripts/install.sh`, which copies `server.js` into the user's writable home directory. 2. The installer registers and ...[truncated 983 chars]- Remediation
View remediation
