T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/bootstrap.sh:7
- Finding
- Unverified Remote Toolchain Download and Immediate Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/bootstrap.sh:7-8, 20-29, 47-68`; documented in `SKILL.md:57` **Vulnerability Type**: Remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```bash TOOLCHAIN="/workspace/toolchain" REPO="TurinFohlen/openclaw-toolchain" RELEASE_URL="https://github.com/$REPO/releases/download/v2.0/toolchain_v2.tar.gz" ``` ```bash do_setup() { info "开始工具链引导安装..." # 如果已有完整工具链,跳过下载 if [ -x "$TOOLCHAIN/go/bin/go" ] && [ -x "$TOOLCHAIN/erlang/bin/erl" ]; then ok "工具链已存在,跳过下载" else info "下载工具链包 (~590MB)..." curl -L --progress-bar "$RELEASE_URL" -o /tmp/toolchain_v2.tar.gz info "解压到 /workspace/ ..." tar -xzf /tmp/toolchain_v2.tar.gz -C /workspace/ rm -f /tmp/toolchain_v2.tar.gz fi ``` The downloaded programs are subsequently executed during verification: ```bash check_tool() { local path="$1"; local name="$2"; local cmd="$3" if [ -x "$path" ]; then local ver=$(eval "$cmd" 2>/dev/null | head -1 | tr -d '\n' || echo "OK") ok "$name: $ver" else err "$name: 未安装" failed=$((failed+1)) fi } check_tool "$TOOLCHAIN/go/bin/go" "Go" "$TOOLCHAIN/go/bin/go version" check_tool "$TOOLCHAIN/jdk-21.0.10+7/bin/java" "Java" "$TOOLCHAIN/jdk-21.0.10+7/bin/java -version 2>&1 | head -1" check_tool "$TOOLCHAIN/apache-maven-3.9.6/bin/mvn" "Maven" "$TOOLCHAIN/apache-maven-3.9.6/bin/mvn -version 2>&1 | head -1" check_tool "$TOOLCHAIN/erlang/bin/erl" "Erlang" "$TOOLCHAIN/erlang/bin/erl -eval 'erlang:display(erlang:system_info(otp_release)),halt().' -noshell 2>/dev/null" check_tool "$TOOLCHAIN/elixir/bin/elixir" "Elixir" "$TOOLCHAIN/elixir/bin/elixir --version 2>&1 | head -1" RUST_BIN=$(ls $TOOLCHAIN/rust/rustup/toolchains/*/bin/rustc 2>/dev/null | head -1) if [ -n "$RUST_BIN" ] && [ -x "$RUST_BIN" ]; then ok "Rust: $($RUST_BIN --version 2>&1 | awk '{print $2}')" ...[truncated 2570 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Publish an expected SHA-256 or stronger digest inside the reviewed Skill package and verify it before extraction: ```bash printf '%s %s\n' "$EXPECTED_SHA256" "$archive" | sha256sum --check --status ``` 2. Fail closed and delete the downloaded file if verification fails. 3. Prefer a signed release and verify it with a pinned public key or trusted Sigstore identity and provenance policy. 4. Pin an immutable release artifact and document how its digest was generated and reviewed. 5. Download into a restrictive temporary directory created with `mktemp -d`. 6. Extract into a staging directory and inspect the expected directory structure and file types before installation. 7. Do not automatically execute downloaded programs merely to confirm installation. Make verification an explicit, separate operation after integrity validation. 8. Use `curl --fail --show-error --location` and reject unexpected download failures or HTTP error responses. 9. Where possible, obtain language runtimes from trusted distribution repositories or official vendor channels rather than a personal aggregate binary archive. ]]>
