T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/mcp_client.py:969
- Finding
- Silent Automatic Updates Permit Post-Review Remote Code Replacement<![CDATA[ ## Vulnerability Details **File Location**: `scripts/mcp_client.py:969-1018`, `scripts/mcp_client.py:1517-1544`; documented in `SKILL.md:225-241` and `references/automatic-updates-and-safety.md:3-19` **Vulnerability Type**: Default-enabled remote payload retrieval and package replacement **Risk Level**: High ### Vulnerable Code ```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_u ...[truncated 3067 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Disable automatic installation by default. Checking for updates may remain automatic, but file replacement should require explicit user confirmation. 2. Sign release manifests with a dedicated offline release key. 3. Embed only the verification public key in the reviewed client and reject unsigned, invalidly signed, expired, or wrong-package manifests. 4. Ensure the signed data covers the package name, channel, locale, version, complete file list, permissions, file hashes, and archive hash. 5. Support key rotation through a separately authenticated mechanism rather than trusting keys supplied by the same discovery response. 6. Present the target version and release metadata before replacement. 7. Consider staging the new package separately and requiring the host platform to activate it only after verification or review. 8. Preserve the existing path, archive, downgrade, size, lock, rollback, and package-ownership protections. ]]>
