T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/lib.sh:10
- Finding
- Unverified Remote Replacement of Executable Skill Scripts<![CDATA[ ## Vulnerability Details **File Location**: `scripts/lib.sh:10-15, 25-86` **Vulnerability Type**: Runtime download and installation of unverified executable code **Risk Level**: High ### Code Snippet ```bash VERSION_FILE="${SKILL_DIR}/VERSION" REMOTE_VERSION_URL="https://raw.githubusercontent.com/marswaveai/skills/main/skills/listenhub/VERSION" check_version() { # Skip if no local VERSION file [ -f "$VERSION_FILE" ] || return 0 local local_ver remote_ver http_code response local_ver=$(cat "$VERSION_FILE" 2>/dev/null | tr -d '[:space:]') # Validate local version before integer comparisons [[ "$local_ver" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || return 0 # Fetch remote version with 5s timeout, check HTTP status response=$(curl -sS --max-time 5 -w "\n%{http_code}" "$REMOTE_VERSION_URL" 2>/dev/null) || return 0 http_code=$(echo "$response" | tail -1) remote_ver=$(echo "$response" | head -1 | tr -d '[:space:]') # Only compare if HTTP 200 and valid semver-like format [[ "$http_code" == "200" && "$remote_ver" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]] || return 0 # Same version, skip [ "$local_ver" != "$remote_ver" ] || return 0 # Parse semver: major.minor.patch local local_major local_minor local_patch local remote_major remote_minor remote_patch IFS='.' read -r local_major local_minor local_patch <<< "$local_ver" IFS='.' read -r remote_major remote_minor remote_patch <<< "$remote_ver" if [ "$remote_major" -gt "$local_major" ] || \ { [ "$remote_major" -eq "$local_major" ] && [ "$remote_minor" -gt "$local_minor" ]; }; then local base_url="https://raw.githubusercontent.com/marswaveai/skills/main/skills/listenhub" local api_url="https://api.github.com/repos/marswaveai/skills/contents/skills/listenhub/scripts" local update_success=true if ! curl -fsSL --max-time 10 "$base_url/VERSION" -o "$VERSION_FILE.tmp" 2>/dev/null; then update_success=false fi if [ "$update_success" = true ]; then lo ...[truncated 2669 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Remove automatic executable updates from normal Skill execution. - Distribute updates through a separate, user-initiated installation or package-management process. - If runtime updating is unavoidable: - Pin downloads to an immutable commit or signed release. - Verify every file against a signed manifest and cryptographic hash. - Maintain an explicit allowlist of expected filenames. - Reject unexpected files and symbolic links. - Download into a private staging directory and validate the complete release before installation. - Require explicit user confirmation before replacing executable files. - Preserve and verify a rollback copy. - Do not treat a mutable Git branch as a trusted executable release channel. ]]>
