T03 · Remote Payload Retrieval and Execution
- Location
scripts/provision-vps.sh:47- Finding
Remote NodeSource Bootstrap Script Executed Directly as Root
- Content
View full analysis
/dev/null || [[ $(node -v | sed 's/v//' | cut -d. -f1) -lt 20 ]]; then log "Installing Node.js 22..." curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt-get install -y nodejs fi ``` ### Technical Analysis The provisioner downloads a mutable shell script from `deb.nodesource.com` and immediately pipes it into `bash`. There is no version pinning, checksum validation, signature verification, or opportunity to inspect the downloaded content before execution. The following `apt-get` command demonstrates that the provisioner is expected to run with root privileges. Consequently, the remotely supplied bootstrap script also executes as root. HTTPS protects the connection in transit but does not protect against a compromised upstream server, compromised publishing account, malicious upstream change, DNS/TLS trust compromise, or unexpected behavior introduced after this project was audited. Executing a remote repository configuration script is not the minimum privilege necessary to install Node.js. A signed package repository can be configured using explicit, reviewable steps without running mutable network content as shell code. ### Attack Path 1. An attacker compromises the NodeSource distribution endpoint, its publishing process, or another component in its delivery chain. 2. The attacker modifies `setup_22.x` to include arbitrary commands. 3. An administrator runs `provision-vps.sh` with root privileges. 4. `curl` retrieves the modified script and passes it directly to `bash`. 5. The payload executes with root privileges before Node.js installation continues. 6. The payload can alter the operating system, steal secrets, create privileged accounts, or establish persistence. ### Impact Assessment Successf ...[truncated 446 chars]- Remediation
View remediation
