T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/install.sh:35
- Finding
- Unverified Remote Application Retrieval and Dependency Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/install.sh:35-64`, `scripts/install.sh:76-87`, `scripts/install.sh:155-174` **Vulnerability Type**: Remote payload retrieval and unsafe software supply chain **Risk Level**: High ### Vulnerable Code ```bash if [ ! -d "$INSTALL_DIR/api" ] || [ ! -d "$INSTALL_DIR/web" ]; then log "Source directories missing. Cloning $REPO_URL @ $RELEASE_TAG ..." TEMP_CLONE=$(mktemp -d) git clone --depth 1 --branch "$RELEASE_TAG" "$REPO_URL" "$TEMP_CLONE" || err "Failed to clone webclaw repo from $REPO_URL (tag: $RELEASE_TAG)" # Copy source into install dir, preserving any existing files (SKILL.md, scripts/) rsync -a --ignore-existing "$TEMP_CLONE/" "$INSTALL_DIR/" --exclude='.git/' rm -rf "$TEMP_CLONE" log "Source cloned into $INSTALL_DIR (tag: $RELEASE_TAG)" fi log "Setting up Python backend..." if [ ! -d "$INSTALL_DIR/.venv" ]; then python3 -m venv "$INSTALL_DIR/.venv" fi "$INSTALL_DIR/.venv/bin/pip" install --quiet --upgrade pip "$INSTALL_DIR/.venv/bin/pip" install --quiet -r "$INSTALL_DIR/api/requirements.txt" log "Backend ready." log "Building frontend..." cd "$INSTALL_DIR/web" npm install --silent 2>/dev/null || npm install npm run build ``` The downloaded Python implementation is subsequently imported and executed: ```bash "$INSTALL_DIR/.venv/bin/python3" -c " import sys, os, sqlite3 sys.path.insert(0, '$INSTALL_DIR/api') os.environ['WEBCLAW_DB_PATH'] = '$DB_PATH' from db import get_connection conn = get_connection('$DB_PATH') tables = conn.execute(\"SELECT COUNT(*) FROM sqlite_master WHERE type='table'\").fetchone()[0] if tables < 5: print(f'ERROR: Only {tables} tables created, expected 9+', file=sys.stderr) sys.exit(1) conn.close() print(f'Database initialized at $DB_PATH ({tables} tables)') " ``` Downloaded service templates are also installed persistently: ```bash TEMP_SVC=$(mktemp) sed -e "s|{{INSTALL_DIR}}|$INSTALL_DIR|g" \ -e "s|{{USER}}|$CURRENT_USE ...[truncated 3403 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Include the complete `api/`, `web/`, `templates/`, dependency manifests, and lockfiles in the reviewed Skill package. 2. If remote retrieval is unavoidable, pin the source to an immutable Git commit hash rather than relying only on a tag. 3. Publish a signed release manifest containing SHA-256 or stronger hashes for every downloaded artifact, and verify it before copying or executing any content. 4. Require cryptographic signature verification using a pinned and documented maintainer key. 5. Use fully locked Python dependencies with hashes, such as `pip install --require-hashes -r requirements.lock`. 6. Commit the npm lockfile and use `npm ci` rather than `npm install`. 7. Disable npm lifecycle scripts where they are unnecessary. If lifecycle scripts are required, audit and explicitly allow them. 8. Validate generated systemd units against a locally packaged policy before privileged installation. 9. Apply systemd hardening such as `NoNewPrivileges=true`, `PrivateTmp=true`, `ProtectSystem=strict`, `ProtectHome=true`, restricted writable paths, and explicit network restrictions where compatible. 10. Display the exact source commit and verified artifact digest to the administrator before installation. ]]>
