T03 · Remote Payload Retrieval and Execution
Error
- Location
- setup.sh:81
- Finding
- Unpinned Remote Source Fallback Permits Mutable Payload Execution<![CDATA[ ## Vulnerability Details **File Location**: `setup.sh`, lines 81–107 **Vulnerability Type**: Remote payload retrieval and unsafe dependency sourcing **Risk Level**: High ### Vulnerable Code ```bash install() { echo "🔧 Installing mirage-proxy v${VERSION}..." # Download binary local plat=$(detect_platform) local url="https://github.com/${REPO}/releases/download/v${VERSION}/mirage-proxy-v${VERSION}-${plat}" local expected=$(expected_sha256 "$plat") echo " ↓ Downloading ${plat} binary..." curl -sL -o "${MIRAGE_BIN}" "${url}" chmod +x "${MIRAGE_BIN}" # Verify integrity if [ -n "$expected" ]; then verify_sha256 "${MIRAGE_BIN}" "$expected" else echo " ⚠ No checksum on record for platform ${plat} — skipping verification" fi # Verify it runs if ! "${MIRAGE_BIN}" --version >/dev/null 2>&1; then echo " ⚠ Binary failed (glibc mismatch?). Building from source..." if command -v cargo >/dev/null 2>&1; then cargo install --git "https://github.com/${REPO}" --root "${WORKSPACE}/.cargo-mirage" cp "${WORKSPACE}/.cargo-mirage/bin/mirage-proxy" "${MIRAGE_BIN}" else echo " ✗ No cargo found. Install Rust: https://rustup.rs" exit 1 fi fi ``` The checksum function also explicitly permits installation without verification: ```bash else echo " ⚠ No sha256sum or shasum found — skipping integrity check" return 0 fi ``` ### Technical Analysis The script retrieves a native executable from an external GitHub release and runs it locally. Although checksums are defined for supported platforms, verification fails open when neither `sha256sum` nor `shasum` is available. More critically, if the downloaded binary does not pass the `--version` execution check, the fallback runs: ```bash cargo install --git "https://github.com/${REPO}" --root "${WORKSPACE}/.cargo-mirage" ``` This command does not specify an immutable commit through `--rev`. Consequently, it builds whichever revision ...[truncated 2088 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin source installation to a reviewed immutable commit: ```bash cargo install \ --git "https://github.com/${REPO}" \ --rev "<reviewed-full-commit-hash>" \ --locked \ --root "${WORKSPACE}/.cargo-mirage" ``` 2. Fail closed when no supported checksum utility is available. Never execute an artifact whose digest has not been verified. 3. Download into a securely created temporary directory and do not mark the file executable until verification succeeds. 4. Use `curl --fail --show-error --location` and verify that the response is a successful artifact download. 5. Verify both release artifacts and source-build outputs against independently maintained, reviewed digests or signatures. 6. Prefer bundling auditable source code or a reviewed artifact with the Skill rather than downloading mutable executable content during installation. 7. Run the proxy under a dedicated least-privilege account or a restricted container with narrowly scoped filesystem and network permissions. 8. Document what request headers and environment variables the proxy can access, and avoid exposing credentials not required for forwarding. ]]>
