T03 · Remote Payload Retrieval and Execution
- Location
scripts/restore-kit.sh:238- Finding
Remote NodeSource Script Is Executed with Elevated Privileges Without Integrity Verification
- Content
View full analysis
/dev/null | $SUDO bash - 2>/dev/null; then $SUDO apt-get install -y -qq nodejs 2>/dev/null else ``` ### Technical Analysis The restore kit downloads a mutable shell script from an external URL and immediately pipes it into `bash`. When the user is not root, `$SUDO` is set to `sudo`, causing the remotely retrieved script to execute with root privileges. The downloaded content is not pinned to a cryptographic digest, authenticated using a separately verified signature, saved for inspection, or otherwise checked before execution. Although HTTPS protects the connection under normal circumstances, it does not protect against compromise of the remote distribution server, its publishing pipeline, DNS or certificate infrastructure, or an account authorized to modify the script. The effective code executed by the audited package can therefore change after the package itself has been reviewed. ### Attack Path 1. An attacker compromises the NodeSource endpoint, publishing process, hosting account, or another part of the trusted delivery chain. 2. The attacker modifies `setup_22.x` to include arbitrary shell commands. 3. A user runs `scripts/restore-kit.sh` during recovery. 4. The script downloads the current remote response. 5. The response is passed directly to `sudo bash`. 6. The attacker's commands execute as root without any local integrity check. ### Impact Assessment Successful exploitation provides arbitrary root-level code execution on the recovering machine. The attacker could: - Read or modify all accessible files and credentials. - Install persistent services, scheduled tasks, or backdoors. - Replace system binaries or security tools. - Ca ...[truncated 237 chars]- Remediation
View remediation
