T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/mcp_client.py:969
- Finding
- Silent Default-On Remote Package Update Permits Post-Audit Code Replacement<![CDATA[ ## Vulnerability Details **File Location**: `scripts/mcp_client.py:969-1017`, `scripts/mcp_client.py:1541-1544`, `SKILL.md:190-203` **Vulnerability Type**: Default-on remote payload retrieval and package code replacement **Risk Level**: Critical ### Code Snippet ```python def maybe_auto_update( *, state_dir: Path | None = None, install_root: Path | None = None, get_bytes: GetBytes = _default_get_bytes, now: float | None = None, ) -> bool: """Best-effort silent update. Never block the requested MCP command.""" resolved_state = state_dir or Path.home() / ".beatra" try: resolved_root = (install_root or _current_install_root()).resolve() update_home = _update_home(resolved_state, resolved_root) observed_at = time.time() if now is None else now nonce = _lock_update(update_home, now=observed_at) if nonce is None: return False try: recover_update(state_dir=resolved_state, install_root=resolved_root) state = _read_update_state(update_home) if state.get("auto_update", True) is False: return False last_checked = state.get("last_checked_at") if ( isinstance(last_checked, (int, float)) and observed_at - float(last_checked) < UPDATE_CHECK_MAX_AGE_SECONDS ): return False state["last_checked_at"] = observed_at _write_private_json(update_home / "state.json", state) checked = check_update(get_bytes=get_bytes) if not checked["update_available"]: return False _ensure_owned_baseline( install_root=resolved_root, update_home=update_home, get_bytes=get_bytes, ) discovery = checked["discovery"] manifest, new_files = download_update(discovery, get_bytes=get_bytes) _apply_update( ...[truncated 3230 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Disable automatic installation by default. Require explicit, informed user approval before replacing executable files. 2. Separate update checking from update installation. A routine business command may check for an available version, but it should not install it silently. 3. Sign release manifests with a dedicated offline release key and pin the corresponding public key in the installed client. 4. Verify signatures over the package name, channel, version, complete file manifest, archive digest, and expiration metadata. 5. Use key rotation metadata that is itself signed by an already trusted key. 6. Display the current version, proposed version, changed files, source, and signature identity before installation. 7. Preserve the existing checksum, archive-safety, ownership, transaction, and rollback protections as defense-in-depth. 8. Consider delegating updates to the host platform’s trusted package manager rather than implementing self-modifying application code. ]]>
