T03 · Remote Payload Retrieval and Execution
Error
- Location
- deploy/setup.sh:10
- Finding
- Root-Level Execution of a Mutable Remote Installation Script<![CDATA[ ## Vulnerability Details **File Location**: `deploy/setup.sh:10-13` **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```bash # Install Node.js 22 LTS if ! command -v node &> /dev/null; then echo "Installing Node.js 22..." curl -fsSL https://deb.nodesource.com/setup_22.x | bash - apt-get install -y nodejs fi ``` ### Technical Analysis The setup script downloads content from a remote URL and passes it directly to Bash. The response is not pinned to a version, inspected, signature-verified, or checked against a known digest before execution. The surrounding commands install system packages and create directories under `/opt`, indicating that the script is intended to run with root privileges. Consequently, the remotely supplied script also executes with root authority. NodeSource is a recognizable package provider, and there is no evidence that its current script is malicious. However, the effective code executed by this project can change after the project itself has been reviewed. A compromise of the remote endpoint, upstream publication process, DNS resolution, or TLS trust chain would therefore become arbitrary root code execution. ### Attack Path 1. An administrator runs `deploy/setup.sh` with root privileges on a fresh server. 2. The script requests the current content of `https://deb.nodesource.com/setup_22.x`. 3. A compromised or unexpectedly modified response is streamed directly into Bash. 4. Bash executes the response without local review or integrity verification. 5. The remote payload gains root-level access to the host. ### Impact Assessment A successful supply-chain compromise could obtain complete control of the deployment server. The resulting privileges could include: - Reading application secrets and wallet private keys. - Replacing the inference service or its dependencies. - Modifying payment destinations or transaction logic. - Installing persistent service ...[truncated 156 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove the `curl | bash` pipeline. 2. Prefer Ubuntu's signed package repositories or a repository configured through a locally reviewed procedure. 3. Install repository signing keys using a dedicated keyring rather than globally trusting a downloaded key. 4. Pin the Node.js major and package versions used in production. 5. If a standalone artifact is required: - Download it to a temporary file. - Verify its publisher signature. - Compare its SHA-256 digest with a pinned, trusted value. - Inspect or execute it only after verification succeeds. 6. Run installation steps with the minimum privileges needed instead of executing an entire mutable script as root. 7. Record verified artifact versions and hashes in deployment documentation for reproducible builds. ]]>
