T03 · Remote Payload Retrieval and Execution
- Location
scripts/update-skill.sh:71- Finding
Automatic Self-Update Replaces Trusted Instructions and Executable Scripts with Unverified Remote Content
- Content
View full analysis
/dev/null || echo "")}" REMOTE_SHA=$(curl -sf \ -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer $GH_TOKEN" \ "https://api.github.com/repos/fdarkaou/genviral-skill/commits/$REMOTE_BRANCH" \ | jq -r '.sha' 2>/dev/null || echo "") if [[ -z "$REMOTE_SHA" ]]; then echo "ERROR: Could not fetch remote SHA. Check network or GITHUB_TOKEN." exit 1 fi echo "Remote SHA: $REMOTE_SHA" if [[ "$CURRENT_SHA" == "$REMOTE_SHA" && "$FORCE" != "true" ]]; then echo "Already up to date. Nothing to do." exit 0 fi echo "Update available! Applying..." UPDATED_FILES=() FAILED_FILES=() for FILE in "${SKILL_OWNED_FILES[@]}"; do RAW_URL="https://raw.githubusercontent.com/fdarkaou/genviral-skill/$REMOTE_SHA/$FILE" TARGET="$SKILL_DIR/$FILE" if [[ "$DRY_RUN" == "true" ]]; then echo "[DRY RUN] Would update: $FILE" continue fi # Fetch and write atomically TMPFILE=$(mktemp) if curl -sf "$RAW_URL" -o "$TMPFILE"; then mkdir -p "$(dirname "$TARGET")" mv "$TMPFILE" "$TARGET" # Make scripts executable [[ "$FILE" == scripts/* ]] && chmod +x "$TARGET" UPDATED_FILES+=("$FILE") echo " ✓ Updated: $FILE" else rm -f "$TMPFILE" # File may not exist in remote (optional file) — not a hard error FAILED_FILES+=("$FILE") echo " - Skipped (not found in remote): $FILE" fi done ``` The setup documentation recommends executing this updater every day: ```bash openclaw cron add \ --name "Genviral: Daily Skill Update" \ --cron "0 6 * * *" ...[truncated 3106 chars]- Remediation
View remediation
