T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/install_deps.sh:62
- Finding
- Unverified remote installation scripts are executed directly<![CDATA[ ## Vulnerability Details **File Location**: `scripts/install_deps.sh:62-65`, `scripts/install_deps.sh:176-178`, and `scripts/install_deps.sh:259-262` **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```bash info "Installing Homebrew..." /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" ``` ```bash # Install nvm then node info "Installing nvm first..." curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash ``` ```bash elif [ "$OS" = "Linux" ]; then info "Installing Docker Engine..." curl -fsSL https://get.docker.com | sh sudo usermod -aG docker "$USER" 2>/dev/null || true ``` ### Technical Analysis The script passes responses received from external URLs directly to command interpreters. This removes the opportunity to verify the downloaded content before execution. The Homebrew URL references mutable `HEAD`, so the effective payload can change after this Skill is reviewed. The nvm URL identifies a release tag, but the downloaded response is still not verified against a trusted checksum or signature. `get.docker.com` is also a mutable installer endpoint. HTTPS protects the connection in transit but does not protect against compromise of the hosting account, upstream repository, release process, DNS/TLS trust infrastructure, or the remote endpoint itself. If any source returns malicious content, that content executes immediately. The Docker installation path has especially high impact. Docker installation scripts commonly perform system package-management operations, and the script subsequently invokes `sudo usermod`. Membership in the Docker group is effectively root-equivalent on typical Linux systems because a member can start privileged containers and mount the host filesystem. These installation actions support the declared dependency-setup functionality, but direct remote-to-shell execution exceeds the min ...[truncated 1170 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove all `curl | bash`, `curl | sh`, and command-substitution installation patterns. 2. Pin every installer to an immutable, reviewed version rather than mutable `HEAD` or generic installer endpoints. 3. Download installers to files created with `mktemp` and restrictive permissions. 4. Verify each artifact using a hardcoded SHA-256 digest obtained through a separate trusted channel, or verify a trusted publisher signature. 5. Execute only after verification succeeds; fail closed if verification cannot be performed. 6. Prefer signed operating-system package repositories where available. 7. Do not automatically add the user to the Docker group. Explain its root-equivalent security implications and require a separate, explicit confirmation. 8. Offer a default check-only mode and make high-impact installation an explicit opt-in. 9. Run dependency installation in a disposable environment where practical. A safer pattern is: ```bash installer="$(mktemp)" trap 'rm -f "$installer"' EXIT curl --fail --show-error --location \ "https://trusted.example/installer-pinned-version.sh" \ -o "$installer" printf '%s %s\n' "$EXPECTED_SHA256" "$installer" | sha256sum --check - /bin/bash "$installer" ``` ]]>
