T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/update-skill.sh:71
- Finding
- Automatic Self-Update Replaces Trusted Instructions and Executable Scripts with Unverified Remote Content<![CDATA[ ## Vulnerability Details **File Location**: `scripts/update-skill.sh:71-113`; automatic scheduling is recommended in `docs/setup.md:202-211` **Vulnerability Type**: Remote payload retrieval and execution through an unsigned self-update mechanism **Risk Level**: High ### Vulnerable Code ```bash # Fetch latest commit SHA from GitHub API (no git required) # Resolve GitHub token (explicit env var, or from gh CLI) GH_TOKEN="${GITHUB_TOKEN:-$(gh auth token 2>/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
- <![CDATA[ ## Remediation Suggestions 1. Disable unattended updates by default, especially updates to `SKILL.md` and files under `scripts/`. 2. Require explicit user or administrator approval before applying an update. 3. Download proposed updates into a staging directory and display a complete diff before replacement. 4. Publish signed releases and verify signatures against a public key pinned in the installed package. 5. Alternatively, verify every file against a manifest whose digest is independently pinned or administrator-approved. 6. Do not treat a commit identifier obtained from the same mutable repository as an independent trust anchor. 7. Separate documentation updates from executable and instruction updates; apply stricter approval requirements to scripts and `SKILL.md`. 8. Preserve and verify restrictive ownership and permissions on replacement files. 9. Record the old and new trusted version identifiers in an audit log and support rollback. 10. If automated checks are necessary, allow the scheduled job to report that an update exists without applying it. ]]>
