T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/install_binary.sh:2
- Finding
- External Teldrive binary is downloaded and installed without integrity verification<![CDATA[ ## Vulnerability Details **File Location**: `scripts/install_binary.sh:2-17` **Vulnerability Type**: Unverified remote payload retrieval and execution **Risk Level**: High ```bash # install_binary.sh - Portable Teldrive Downloader VERSION="1.8.0" SKILL_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" BIN_DIR="$SKILL_DIR/bin" TEMP_DIR="$SKILL_DIR/temp_install" mkdir -p "$BIN_DIR" mkdir -p "$TEMP_DIR" echo "Downloading Teldrive $VERSION..." URL="https://github.com/tgdrive/teldrive/releases/download/$VERSION/teldrive-$VERSION-linux-amd64.tar.gz" curl -L -o "$TEMP_DIR/teldrive.tar.gz" "$URL" tar -xzf "$TEMP_DIR/teldrive.tar.gz" -C "$TEMP_DIR" mv "$TEMP_DIR/teldrive" "$BIN_DIR/teldrive" chmod +x "$BIN_DIR/teldrive" ``` ### Technical Analysis The installer retrieves a precompiled executable archive from an external GitHub release and marks the extracted binary as executable without verifying a cryptographic checksum or signature. Although the URL belongs to the Teldrive repository identified in the Skill documentation and the version is pinned to `1.8.0`, version pinning alone does not establish artifact integrity. The effective payload can change if the release artifact, repository, maintainer account, redirect destination, or distribution infrastructure is compromised. The use of `curl -L` permits redirects, while the absence of `--fail` and shell fail-fast options means HTTP and extraction failures are not handled robustly. Archive entries are also not inspected before extraction. The installed payload is subsequently executed by `scripts/manage.sh`: ```bash nohup "$BIN" run --config "$CONFIG" > "$LOG_DIR/stdout.log" 2>&1 & ``` This behavior is necessary to install Teldrive, but downloading executable code without independent integrity verification exceeds the minimum safe trust model for that functionality. ### Attack Path 1. An attacker compromises the upstream release, maintainer account, artifact storage, or another trusted distrib ...[truncated 1234 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Publish a trusted SHA-256 digest for the exact release artifact and verify it before extraction: ```bash echo "$EXPECTED_SHA256 $TEMP_DIR/teldrive.tar.gz" | sha256sum --check - ``` 2. Prefer verification of a maintainer-signed checksum or release artifact using Sigstore, GPG, or another authenticated signing mechanism. 3. Add strict shell error handling: ```bash set -euo pipefail ``` 4. Harden the download command: ```bash curl --fail --show-error --location \ --proto '=https' --tlsv1.2 \ --output "$TEMP_DIR/teldrive.tar.gz" "$URL" ``` 5. Inspect archive entry names before extraction, reject absolute paths and `..` traversal components, and confirm that the expected executable is a regular file. 6. Use `mktemp -d` for the installation directory and remove it with an `EXIT` trap. 7. Install and run the binary as a dedicated unprivileged account with access only to the required configuration, database, network endpoints, and storage paths. ]]>
