T03 ยท Remote Payload Retrieval and Execution
- Location
scripts/hab.sh:5- Finding
Unpinned and Unverified Remote Binary Retrieval and Execution
- Content
View full analysis
Vulnerability Details
File Location:
scripts/hab.sh, lines 5โ6 and 62โ74
Vulnerability Type: Remote payload retrieval and execution
Risk Level: HighThe wrapper downloads the current
latestrelease binary from GitHub and executes it without pinning a version or verifying its checksum, signature, or provenance.bash REPO="balloob/home-assistant-build-cli" BASE_URL="https://github.com/${REPO}/releases/latest/download"bash url="${BASE_URL}/${filename}" echo "Downloading hab (${os}/${arch})..." local tmp_file tmp_file="${CACHE_DIR}/.download-${filename}" if download "${url}" "${tmp_file}" && [ -s "${tmp_file}" ]; then chmod +x "${tmp_file}" mv -f "${tmp_file}" "${binary_path}" else rm -f "${tmp_file}" echo "Error: download failed from ${url}" >&2 exit 1 fiThe downloaded file is subsequently executed at
scripts/hab.sh:77:bash exec "${binary_path}" "$@"Technical Analysis
The URL uses the mutable GitHub
releases/latestendpoint, so the executable retrieved at runtime can change after the Skill has been reviewed. The only integrity check is[ -s "${tmp_file}" ], which confirms merely that the file is nonempty. It does not establish that the file is an approved release artifact.HTTPS protects the transfer in transit but does not protect against compromise of the upstream repository, release workflow, maintainer credentials, or release assets. If any of those controls are compromised, an attacker can replace the expected platform artifact with arbitrary executable code. The wrapper then grants executable permission and runs that payload automatically.
This behavior is particularly sensitive because
SKILL.mdrequires users and agents to replace normalhabcommands with this wrapper. The resulting process can inheritHAB_TOKEN,HAB_URL, and other environment variables.Attack Path
- An attacker co ...[truncated 1652 chars]
- Remediation
View remediation
Remediation Suggestions
- Pin an audited release version. Replace the mutable
latestendpoint with an explicit, reviewed release tag. - Verify artifact integrity. Store trusted SHA-256 digests for every supported OS and architecture in the Skill, and verify the downloaded artifact before granting executable permission or moving it into the cache.
- Verify authenticity and provenance. Validate a cryptographic release signature or supported build-provenance attestation in addition to checking a digest.
- Fail closed. Delete the downloaded file and abort if any digest, signature, filename, file-type, or provenance check fails.
- Use secure temporary-file handling. Create temporary files with
mktempin a directory accessible only to the current user, and reject symbolic links or unexpected file types before installation. - Require approval for installation and upgrades. Clearly display the pinned version, source URL, and expected digest, then request explicit approval before the first download or any version change.
- Limit credential exposure. Avoid exposing unrelated environment variables to the downloaded process. Where feasible, pass only the variables required for legitimate CLI operation.
- Document controlled updates. Upgrade the pinned version only through a review process that verifies the source, release artifacts, checksums, and behavior of the new binary.
- Pin an audited release version. Replace the mutable
