T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/setup.sh:38
- Finding
- Unverified Remote Binary Download and Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup.sh`, lines 5 and 38-52 **Vulnerability Type**: Remote payload retrieval and execution without integrity verification **Risk Level**: High ### Vulnerable Code ```bash CORTEX_VERSION="${CORTEX_VERSION:-latest}" ``` ```bash # Download binary if [[ "$CORTEX_VERSION" == "latest" ]]; then DOWNLOAD_URL="https://github.com/$REPO/releases/latest/download/cortex-${OS}-${ARCH}" else DOWNLOAD_URL="https://github.com/$REPO/releases/download/$CORTEX_VERSION/cortex-${OS}-${ARCH}" fi echo " Downloading: $DOWNLOAD_URL" if command -v curl &>/dev/null; then curl -fSL "$DOWNLOAD_URL" -o "$INSTALL_DIR/cortex" 2>/dev/null elif command -v wget &>/dev/null; then wget -q "$DOWNLOAD_URL" -O "$INSTALL_DIR/cortex" else echo "ERROR: Need curl or wget" >&2; exit 1 fi chmod +x "$INSTALL_DIR/cortex" # Verify VERSION="$("$INSTALL_DIR/cortex" version 2>/dev/null || echo "FAILED")" ``` ### Technical Analysis The setup script downloads a precompiled executable from a remote GitHub release, marks it executable, and immediately runs it. It does not verify a cryptographic checksum or a release signature. The default version selector is `latest`, which is a mutable reference. Consequently, the effective code executed by the Skill can change after the Skill package itself has been reviewed. The existing “Verify” step only checks whether the downloaded program can execute and return a version; it does not establish authenticity or integrity. HTTPS protects the transfer in transit but does not protect against compromise of the upstream repository, maintainer account, release workflow, or published release artifact. This behavior exceeds the minimum safe privilege necessary for installation because arbitrary remote code is trusted and executed without independent validation. ### Attack Path 1. An attacker compromises the upstream GitHub repository, maintainer credentials, release automation, or release art ...[truncated 1074 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace the mutable `latest` default with a specifically pinned, reviewed release version. 2. Publish a SHA-256 or stronger digest for every supported platform artifact and pin the expected digest in trusted Skill code. 3. Download the binary to a newly created temporary file rather than directly overwriting the installed executable. 4. Verify the digest before applying executable permissions or invoking the binary. 5. Prefer signed release artifacts and validate signatures against a pinned maintainer public key. 6. Abort installation on every verification failure and remove the temporary artifact. 7. Atomically move the verified artifact into the installation directory. 8. Avoid suppressing download diagnostics that would be useful for identifying redirects or verification failures. 9. Consider building from a pinned source commit in a controlled build environment when reproducible builds are available. A hardened installation flow should follow this order: ```text Pin version and digest → download to a secure temporary file → verify checksum and signature → set permissions → atomically install → execute only the verified artifact ``` ]]>
