T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/mcp_client.py:969
- Finding
- Silent Automatic Retrieval and Installation of Remotely Controlled Code<![CDATA[ ## Vulnerability Details **File Location**: `scripts/mcp_client.py:969-1018`, `scripts/mcp_client.py:1528-1544` **Vulnerability Type**: Automatic remote payload retrieval and execution without an independent signature trust anchor **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_update(discovery, get_bytes=get_bytes) _apply_u ...[truncated 3623 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Disable automatic installation by default. Update checks may remain automatic, but code replacement should require explicit user approval. 2. Embed a trusted release-verification public key in the reviewed package and require every discovery document or release manifest to carry a valid signature. 3. Use a threshold-signing or transparency-backed release process so compromise of one publishing service is insufficient to authorize code. 4. Bind the signature to the package slug, release version, channel, locale, complete file manifest, and archive digest. 5. Reject unsigned releases even if their checksums and HTTPS endpoints appear valid. 6. Present the source, current version, target version, and affected executable files before installation. 7. Pin or record the expected signer identity and support deliberate key rotation with an auditable transition mechanism. 8. Consider staging the update and requiring a separate process invocation before newly downloaded code can run. 9. Preserve the existing archive-validation, ownership, path-safety, rollback, and downgrade-prevention controls as defense-in-depth. ]]>
