T08 · Insecure Dependencies
Error
- Location
- scripts/install.sh:48
- Finding
- Downloaded Executable Is Installed and Run When Integrity Verification Is Unavailable<![CDATA[ ## Vulnerability Details **File Location**: `scripts/install.sh`, lines 48–80 and 94–107 **Vulnerability Type**: Fail-open integrity verification of a remotely downloaded executable **Risk Level**: High ### Vulnerable Code ```bash # Download binary and checksums echo " Downloading ${BINARY}-${PLATFORM}..." curl -fsSL "${BASE_URL}/${BINARY}-${PLATFORM}" -o "${TMPDIR}/${BINARY}" || { echo "❌ Download failed. No release binaries found." echo " Build from source: git clone https://github.com/${REPO} && cd satgate-cli && make build" exit 1 } echo " Downloading SHA256SUMS..." curl -fsSL "${BASE_URL}/SHA256SUMS" -o "${TMPDIR}/SHA256SUMS" || { echo "⚠️ Checksums not available — skipping verification." echo " Consider building from source for verified integrity." } # Verify checksum if [ -f "${TMPDIR}/SHA256SUMS" ]; then echo " Verifying checksum..." cd "$TMPDIR" EXPECTED=$(grep "${BINARY}-${PLATFORM}" SHA256SUMS | awk '{print $1}') if [ -n "$EXPECTED" ]; then if command -v sha256sum &>/dev/null; then ACTUAL=$(sha256sum "$BINARY" | awk '{print $1}') elif command -v shasum &>/dev/null; then ACTUAL=$(shasum -a 256 "$BINARY" | awk '{print $1}') else echo "⚠️ No sha256sum or shasum found — skipping verification." ACTUAL="$EXPECTED" fi if [ "$EXPECTED" != "$ACTUAL" ]; then echo "❌ Checksum verification FAILED!" echo " Expected: $EXPECTED" echo " Actual: $ACTUAL" echo " The binary may have been tampered with. Aborting." exit 1 fi echo " ✓ Checksum verified." else echo "⚠️ Binary not found in SHA256SUMS — skipping verification." fi cd - >/dev/null fi ``` ```bash # Install chmod +x "${TMPDIR}/${BINARY}" mkdir -p "$INSTALL_DIR" 2>/dev/null || true if [ -w "$INSTALL_DIR" ]; then mv "${TMPDIR}/${BINARY}" "${INSTALL_DIR}/${BINARY}" else echo " Installing to ${INSTALL_DIR} (requires sudo)..." sudo mv "${TMPDIR}/${BINARY}" "${INSTAL ...[truncated 2793 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Fail closed if the checksum file cannot be downloaded, the platform entry is missing, or no supported hashing tool is available. 2. Remove the fallback assignment `ACTUAL="$EXPECTED"` and terminate installation with a nonzero exit status instead. 3. Pin an explicit release version rather than defaulting to the mutable `latest` endpoint. 4. Authenticate releases using a cryptographic signature verified against a publisher key obtained through a separate trusted channel. 5. Prefer embedding or distributing an expected digest through a trusted, version-controlled release process rather than retrieving the binary and digest from the same mutable location. 6. Validate that the checksum entry exactly matches the expected filename and reject missing, duplicate, or malformed entries. 7. Download to a securely created temporary directory, verify before setting executable permissions, and install only after all checks pass. 8. Avoid immediately executing the newly installed binary. If post-installation execution is necessary, perform it only after successful independent authentication. 9. Document the exact upstream repository, release version, verification method, and expected signing identity for operators. ]]>
