# ADR-0002: Bellona Remote Control Threat Model

- **Status**: Accepted
- **Date**: 2026-04-21
- **Authors**: Bellona Remote Control Working Group, Codex
- **Reviewers**: Bellona, Psyche, Yemaya, Oshun Platform, Oshun Security

## Context and Problem Statement

ADR-0001 accepted a standalone Bellona Remote Gateway plus outbound Bellona
Remote Host architecture. Phase 180 then added a compatibility matrix and
external implementation research covering MCP, CDP, Playwright, Browser Use,
Computer Use, WebRTC/TURN, macOS TCC, Blender, Unreal, remote desktop security,
and cloud tunnel options.

That architecture can safely support creative automation only if threat controls
are built before privileged paths are enabled. Remote control can expose:

- local desktop pixels, windows, files, clipboard, input, and macOS permissions;
- Blender and Unreal project state, editor scripting, assets, renders, and local
  file paths;
- browser pages, cookies, storage, authenticated sessions, downloads, and
  malicious web content;
- gateway sessions, host identities, agent identities, command payloads,
  approvals, streams, and audit logs;
- supply-chain dependencies, host binaries, engine add-ons/plugins, browser
  profiles, and update channels.

This ADR defines the threat model that later protocol, gateway, host, adapter,
fallback, MCP, and Control Room work must satisfy before implementation items
can be checked.

## Decision Drivers

- Protect the controlled MacBook from arbitrary remote desktop, shell, engine
  scripting, browser profile, and file-system access.
- Prevent agents from treating untrusted web pages, screenshots, documents,
  assets, or engine scene text as trusted instructions.
- Ensure every privileged command is attributable, authorized, replay-resistant,
  policy-checked, approval-aware, auditable, and cancellable.
- Preserve the Phase 180 localhost adapter rule and outbound-host architecture.
- Keep deep adapters safer than desktop fallback and make fallback visibly
  degraded, policy-gated, and reversible where possible.
- Make compromised-gateway, compromised-host, compromised-agent, and local
  network attacker cases explicit before implementation starts.

## Threat Model Scope

In scope:

- Bellona Remote Gateway, Remote Host, Control Room, MCP gateway, command
  protocol, host pairing, host identity, adapter registry, audit ledger, WebRTC
  signaling, stream metadata, and fallback desktop automation.
- Blender, Unreal, Chrome/Chromium/CDP, browser automation profiles, macOS TCC
  permissions, file/path grants, screenshots, OCR, clipboard, keyboard, mouse,
  and process-launch surfaces.
- LAN and cloud gateway modes, TURN relay, optional VPN/tunnel underlays, and
  development fixtures.
- Software supply chain for the gateway, host, add-ons/plugins, dependencies,
  generated contracts, packaging, signing, and updates.

Out of scope for this ADR:

- Detailed cryptographic algorithm selection.
- Final OAuth/OIDC provider selection.
- Final storage vendor, TURN provider, or deployment topology selection.
- UI copy and detailed Control Room screen design.

## Trust Boundaries

| Boundary                    | Trusted Side                                                       | Untrusted / Lower-Trust Side                                                                  | Required Guard                                                                                          |
| --------------------------- | ------------------------------------------------------------------ | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------- |
| Actor to Gateway            | Authenticated human/operator/agent identity and scoped token.      | Anonymous clients, stale tokens, token passthrough, compromised agent sessions.               | Audience-bound tokens, scope checks, MFA/step-up for humans where needed, rate limits, audit.           |
| Gateway to Host             | Paired device identity, accepted protocol version, active session. | Local network attackers, replayed commands, fake gateways, stolen host tokens.                | Outbound authenticated WSS, host challenge validation, nonces, sequence/idempotency, key rotation.      |
| Host to Local Adapters      | Host policy preflight and adapter registry.                        | Blender/Unreal/CDP/desktop ports, editor scripts, local files, browser profiles.              | Localhost-only ports, adapter allow lists, risk classes, path grants, approval gates, audit evidence.   |
| Agent to Untrusted Content  | System/developer policies and Bellona command schemas.             | Web pages, screenshots, OCR text, documents, engine scene text, asset metadata, chat content. | Prompt-injection isolation, content labeling, egress policy, tool allow lists, human approval.          |
| Control Room to Gateway     | Operator-visible session state and approved commands.              | Browser compromise, XSS, CSRF, stale UI state, malicious extensions.                          | Auth, CSRF/XSS controls, server-side authorization, command confirmations, emergency stop.              |
| WebRTC Media to Command Bus | Gateway-authorized signaling and command control.                  | Media packet loss, TURN outage, unauthenticated peer attempts, screen content leakage.        | Separate command path, authorized signaling, TURN policy, teardown, bitrate/degraded-state controls.    |
| Build/Update to Runtime     | Signed, reviewed, reproducible host/gateway/addon artifacts.       | Dependency tampering, unsigned updates, malicious add-ons, poisoned generated contracts.      | Lockfiles, provenance, signatures/notarization, checksums, SBOM/scans, generated-contract drift checks. |

## STRIDE Threat Matrix

| STRIDE Category        | Bellona Remote-Control Examples                                                                                                                                                | Mandatory Controls                                                                                                                                                                                                                                 |
| ---------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Spoofing               | Fake Control Room client, fake MCP client, fake gateway, fake host, stolen pairing code, forged agent identity, malicious LAN peer pretending to be a Blender/Unreal adapter.  | Authenticated pairing, audience-bound tokens, host device keys stored outside repo/config, short-lived session tokens, gateway/host handshake challenge, host validates gateway identity, operator-visible device identity and capability reports. |
| Tampering              | Modified command envelope, changed risk class, altered approval decision, changed adapter capability report, tampered audit log, malicious host update, modified addon/plugin. | Canonical schemas, runtime validation, signed/hashed command and approval records where needed, append-only audit ledger, generated-contract drift checks, code signing/notarization, package integrity checks, addon/plugin provenance.           |
| Repudiation            | Agent denies command, operator denies approval, host denies execution, gateway loses event order, fallback actions are not reconstructable.                                    | Durable command ledger, correlation IDs, actor/session/device/command IDs, approval signer and timestamp, evidence hashes, immutable audit records, replayable event stream, no production process-local-only authority.                           |
| Information Disclosure | Browser cookies, local files, project assets, screenshots, clipboard, OAuth tokens, engine scene metadata, WebRTC media, logs, crash dumps, prompt content.                    | Isolated browser profiles, path grants, redaction, secret scanning, no real profile access by default, encryption in transit and at rest, least-privilege tokens, log scrubbing, explicit evidence retention and deletion policy.                  |
| Denial of Service      | Command flood, stream bitrate exhaustion, TURN outage, adapter hang, Blender/Unreal main-thread lock, gateway restart, host sleep/wake churn, dead-letter buildup.             | Rate limits, quotas, backpressure, command timeout/cancel, adapter circuit breakers, emergency stop, degraded/offline states, durable queues, host reconnect, media independent from command delivery, dead-letter handling.                       |
| Elevation of Privilege | Arbitrary shell, arbitrary Blender Python, Unreal console, desktop input, browser JavaScript execution, file writes outside grants, helper entitlement abuse.                  | Risk classes, deny-by-default policy, command allow lists, explicit approvals, host-side policy preflight, macOS TCC checks, sandbox/helper separation, no hidden privileged path, signed helpers, operator takeover and kill switch.              |

## Required Scenario Controls

### Prompt Injection

Threat:

- A malicious web page, document, screenshot, engine scene label, asset
  metadata, chat message, or OCR result instructs an agent to ignore policy,
  exfiltrate secrets, alter files, run scripts, approve commands, or hide
  activity.

Controls:

- Treat all page DOM, screenshots, OCR, file contents, engine scene text, and
  asset metadata as untrusted content unless explicitly created by the system.
- Separate model reasoning from command authority: only structured Bellona
  protocol commands can execute, and gateway/host policy evaluates them
  independently of page instructions.
- Require human approval for credential, payment, destructive, file-system,
  real-profile, desktop fallback, arbitrary script, and irreversible operations.
- Add prompt-injection test fixtures before browser and desktop fallback
  adapters are checked.

### Browser Credential Exposure

Threat:

- Browser adapter or desktop fallback leaks cookies, tokens, password-manager
  data, authenticated page contents, downloads, local storage, or real Chrome
  profile state.

Controls:

- Default to isolated automation profiles. Real user profiles are blocked until
  a future ADR accepts explicit profile grants and redaction rules.
- CDP endpoints must be localhost-only and launched with a non-default
  user-data-dir.
- Storage, cookie, credential, download, upload, and JavaScript-evaluation
  commands require separate protocol risk classes and policy/approval gates.
- Audit browser profile type, profile path grant, page origin, command risk,
  result redaction, and evidence retention decision.

### Malicious Web Pages

Threat:

- A page uses prompt injection, drive-by downloads, browser exploit attempts,
  deceptive UI, CSRF-like workflows, WebRTC IP leakage, data exfiltration, or
  hostile login/payment flows.

Controls:

- Browser adapter must run with isolated profiles and controlled downloads.
- High-risk navigations and authenticated flows require domain allow/deny
  policy, operator visibility, and approval where sensitive.
- Downloads/uploads require path grants and artifact registration.
- Web page content cannot directly call host APIs, gateway commands, MCP tools,
  file-system access, or approval decisions.

### Compromised Gateway

Threat:

- Gateway operator, exploit, deployment compromise, or dependency tampering
  attempts to route unauthorized commands, hide audit records, issue fake
  approvals, or impersonate clients.

Controls:

- Host performs local policy preflight and denies unknown/unsupported commands
  even if they arrive from a connected gateway.
- Host validates gateway identity, protocol version, command envelope shape,
  session membership, command nonce/sequence, and risk metadata.
- Gateway must use durable audit state and cannot rely on memory-only command or
  approval state in production.
- Device revocation, key rotation, emergency stop, and host disconnect controls
  must exist before production deployment.
- Critical host actions require operator approvals that are persisted and
  auditable, not just transient gateway memory.

### Compromised Host

Threat:

- Malware or local user compromise on the controlled MacBook steals host keys,
  alters adapter results, captures credentials, spoofs evidence, or issues local
  commands outside the gateway.

Controls:

- Store host identity in a secure local store in production, expected later as
  macOS Keychain integration.
- Sign/notarize host binaries and privileged helpers before production use.
- Report host binary version, adapter versions, permission state, and degraded
  capability state to the gateway.
- Gateway must support device quarantine/revocation and must make anomalous host
  behavior visible to operators.
- Audit cannot rely solely on host-provided statements for high-risk evidence;
  gateway records command intent and approval independently.

### Compromised Agent

Threat:

- An authorized or stolen agent session attempts excessive commands, destructive
  operations, credential access, browser exfiltration, or policy bypass.

Controls:

- Agents receive scoped tokens and least-privilege MCP/Gateway tool access.
- Risky commands require human approval or explicit policy grants independent of
  the agent's natural-language plan.
- Rate limits, budgets, session timeouts, and emergency stop apply per actor,
  session, device, and adapter.
- Agent-authored commands are auditable and attributable; agents cannot alter
  command risk class, approval requirement, or audit outcome.

### Local Network Attacker

Threat:

- An attacker on the LAN scans for bridge ports, spoofs the gateway, replays
  pairing traffic, tampers with traffic, or attempts WebRTC peer injection.

Controls:

- Remote Host connects outbound; no Blender, Unreal, CDP, desktop, or fallback
  control ports are exposed to LAN.
- Gateway/host traffic uses authenticated WSS/TLS with host identity checks.
- Pairing codes are short-lived, one-time, and bound to device/session context.
- WebRTC signaling is gateway-authorized; unknown peers and stale ICE sessions
  are rejected.
- Replay controls include nonces, timestamps, sequence checks, idempotency keys,
  and short-lived session credentials.

### Replay Attacks

Threat:

- A valid old command, approval, host handshake, pairing code, WebRTC signal, or
  audit event is resent to duplicate an action or confuse session state.

Controls:

- Protocol envelopes include command IDs, correlation IDs, session IDs,
  idempotency keys, nonces, timestamps, actor IDs, device IDs, adapter targets,
  and protocol version.
- Gateway and host reject stale, duplicate, wrong-session, wrong-device,
  wrong-adapter, and wrong-protocol messages.
- Approval decisions are bound to a specific command envelope and expire.
- Audit records include enough hash/correlation metadata to detect duplicate
  command execution attempts and out-of-order results.

### Supply-Chain Tampering

Threat:

- A dependency, generated contract, host binary, updater, Blender add-on, Unreal
  plugin, browser extension, TURN server, tunnel agent, or CI artifact is
  modified to exfiltrate data or bypass policy.

Controls:

- Preserve pnpm lockfile integrity and avoid adding unmanaged package managers
  or lockfiles.
- Generate protocol/OpenAPI/Proto/JSON Schema artifacts through checked commands
  with drift checks.
- Sign/notarize host binaries and macOS helpers before production use.
- Hash and register Blender add-on, Unreal plugin, and host package artifacts.
- Run dependency and secret scanning before release gates where available.
- Updates require signed artifacts, rollback controls, and auditable version
  changes.

## Non-Negotiable Prohibitions

- Do not expose Blender, Unreal, Chrome/CDP, desktop fallback, or local engine
  bridge ports directly to LAN or internet.
- Do not implement production remote-control authority with memory-only session,
  command, approval, audit, or subscription state.
- Do not grant real browser profile access by default.
- Do not implement arbitrary shell, arbitrary Blender Python, Unreal console,
  arbitrary JavaScript evaluation, desktop input, or broad file writes before
  protocol risk classes, policy, approvals, audit, evidence, and kill switch
  exist.
- Do not let MCP, Control Room, Codex, Claude, Browser Use, Playwright, or any
  other client bypass the Bellona Gateway/Host policy and audit path.
- Do not mark real macOS, Blender, Unreal, browser profile, WebRTC, or
  cross-network behavior checked without hardware/manual evidence.

## Acceptance Criteria for Later Implementation

- Protocol schemas include identity, session, device, command, risk, approval,
  idempotency, nonce/timestamp, audit, evidence, stream, adapter, and version
  fields needed by this ADR.
- Gateway tests cover auth failures, scope denial, policy denial, approval
  required/granted/denied/expired, duplicate idempotency, replayed nonce, stale
  command, host disconnect, audit emission, and emergency stop.
- Host tests cover handshake validation, unknown command deny, local policy
  preflight, command lifecycle, timeout/cancel, adapter failure, permission
  missing, and gateway disconnect.
- Browser/desktop fallback tests include prompt injection, real-profile denial,
  cookie/storage denial, download/upload path grants, screenshot redaction, and
  malicious-page containment.
- Engine adapter tests cover safe read-only operations, safe fixture mutations,
  arbitrary script/console denial, destructive operation approval, timeout,
  cancel, crash/restart, and evidence capture.
- Release gates include signing/provenance checks for host binaries, helpers,
  Blender add-ons, Unreal plugins, generated contracts, and critical
  dependencies where applicable.

## Consequences

Positive consequences:

- Later implementation has explicit security gates rather than implicit
  intuition.
- The host remains a local enforcement boundary even if a gateway or agent is
  compromised.
- Browser and desktop fallback are intentionally slower to enable, but safer
  when they arrive.
- Audit, replay resistance, and approval semantics become protocol primitives
  instead of UI-only features.

Negative consequences:

- Gateway, host, protocol, adapter, and fallback scaffolding will take longer
  before visible remote control is possible.
- Some useful automation paths remain blocked until policy and approvals exist.
- Hardware/manual verification becomes mandatory for important surfaces that CI
  cannot prove.

## Related Decisions

- `docs/domains/bellona/extras/remote-control/adr/ADR-0001-standalone-remote-gateway-and-host.md`
- `docs/domains/bellona/extras/remote-control/compatibility-matrix.md`
- `docs/domains/bellona/extras/remote-control/external-implementation-research-2026-04-21.md`
- Future protocol compatibility and deprecation rules in
  `libs/bellona/remote-protocol`.

## References

- Microsoft Threat Modeling and STRIDE:
  <https://learn.microsoft.com/en-us/azure/security/develop/threat-modeling-tool-threats>
- OWASP Top 10 for LLM Applications:
  <https://owasp.org/www-project-top-10-for-large-language-model-applications/>
- OWASP Prompt Injection Prevention Cheat Sheet:
  <https://cheatsheetseries.owasp.org/cheatsheets/LLM_Prompt_Injection_Prevention_Cheat_Sheet.html>
- NIST SP 800-46 Rev. 1, Guide to Enterprise Telework, Remote Access, and BYOD
  Security: <https://csrc.nist.gov/pubs/sp/800/46/r1/final>
- CISA remote desktop restriction countermeasure:
  <https://www.cisa.gov/eviction-strategies-tool/info-countermeasures/CM0042>
- Chrome remote debugging security change:
  <https://developer.chrome.com/blog/remote-debugging-port>
- Model Context Protocol security best practices:
  <https://modelcontextprotocol.io/specification/2025-06-18/basic/security_best_practices>
