T03 · Remote Payload Retrieval and Execution
- Location
scripts/install_mp_weixin_skill.sh:112- Finding
Unverified Remote Executable Is Automatically Downloaded and Executed
- Content
View full analysis
/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
View remediation
