T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/install_mp_weixin_skill.sh:112
- Finding
- Unverified Remote Executable Is Automatically Downloaded and Executed<![CDATA[ ## Vulnerability Details **File Location**: `scripts/install_mp_weixin_skill.sh:112-155`; execution occurs through `scripts/publish_draft.sh:73-113, 174-181`; the personal release URL is documented at `SKILL.md:61-70` **Vulnerability Type**: Unverified remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code ```bash tmp_file="${OUT}.download" if [ -n "${GITHUB_TOKEN:-}" ]; then curl -fsSL -H "Authorization: Bearer ${GITHUB_TOKEN}" -H "Accept: application/octet-stream" -o "$tmp_file" "$asset_url" else curl -fsSL -H "Accept: application/octet-stream" -o "$tmp_file" "$asset_url" fi is_zip=0 if [ "${asset_url##*.}" = "zip" ]; then is_zip=1 fi if [ "$is_zip" -eq 0 ] && command -v file >/dev/null 2>&1; then if file "$tmp_file" | grep -qi 'zip archive'; then is_zip=1 fi fi if [ "$is_zip" -eq 1 ]; then if ! command -v unzip >/dev/null 2>&1; then echo "unzip is required to extract zip asset" >&2 exit 1 fi extract_dir="$(mktemp -d)" unzip -o "$tmp_file" -d "$extract_dir" >/dev/null candidate="$extract_dir/mp-weixin-skill" if [ ! -f "$candidate" ]; then candidate="$(find "$extract_dir" -type f -name 'mp-weixin-skill*' | head -n1 || true)" fi if [ -z "${candidate:-}" ] || [ ! -f "$candidate" ]; then echo "cannot find mp-weixin-skill in zip asset" >&2 rm -rf "$extract_dir" exit 1 fi chmod +x "$candidate" mv "$candidate" "$OUT" rm -rf "$extract_dir" "$tmp_file" else chmod +x "$tmp_file" mv "$tmp_file" "$OUT" fi ``` The publishing wrapper subsequently installs and invokes the downloaded executable: ```bash ensure_bin() { if [ -x "$BIN" ]; then return fi if [ -z "$GITHUB_REPO" ] && [ -z "$RELEASE_URL" ]; then err_json "executable not found: $BIN ; set --bin or configure --url/MP_WECHAT_RELEASE_URL or --repo/MP_WECHAT_GITHUB_REPO" exit 1 fi local installer="$SCRIPT_DIR/install_mp_weixin_skill.sh" if [ ! -x "$installer" ]; then err_json "inst ...[truncated 2966 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove arbitrary direct-URL installation and require an explicitly installed, trusted executable. 2. Prefer bundling auditable source code or a reproducibly built binary within the reviewed package. 3. If remote installation is essential, restrict downloads to an official allowlisted repository and HTTPS origin. 4. Pin an immutable release tag, exact asset name, and expected SHA-256 digest. Do not default to `latest`. 5. Verify the digest before extraction and before granting executable permissions. 6. Add cryptographic signature or Sigstore provenance verification using a pinned trusted identity. 7. Download to a securely created temporary directory, verify the artifact, and only then atomically install it. 8. Require explicit user confirmation before the first execution of a newly downloaded binary. 9. Execute the publisher with narrowly scoped filesystem and network access where sandboxing is available. 10. Publish the CLI source and build instructions so its credential access and network behavior can be independently audited. ]]>
