# CAIN-42 Sovereign Extension Containment: Residual Risk Register

**Document Reference:** `CAIN42-RISK-SOVEREIGN-EXT-v1`  
**Classification:** Risk Governance & Security Assurance  
**Status:** ACTIVE AUDIT REGISTER  
**Invariant:** *NEVER CLAIM ZERO RISK OR UNIVERSAL SECURITY.*  

---

## 1. Governance Statement

No software sandboxing architecture or containment runtime provides 100% impenetrable security against all hypothetical adversaries. Real security assurance requires transparent identification of residual attack vectors, acknowledging physical and architectural limits, and establishing concrete defense-in-depth mitigations.

The **CAIN-42 Sovereign Extension Containment Architecture** reduces the attack surface of third-party plugins by multiple orders of magnitude compared to traditional unsandboxed runtimes, but operators must understand and manage the residual risks documented below.

---

## 2. Risk Register

| Risk ID | Threat Description | Inherent Severity | Likelihood | Impact | Residual Severity | Countermeasures & Operational Mitigations |
|:---|:---|:---:|:---:|:---:|:---:|:---|
| **RISK-01** | **Host Kernel 0-Day in User Namespaces**<br>Flaw in Linux kernel namespace handling or vfs subsystems allowing container breakout. | **HIGH** | LOW | HIGH | **MEDIUM** | 1. Strict Seccomp-BPF filter blocking namespace/mount syscalls (`unshare`, `setns`, `mount`, `pivot_root`).<br>2. `PR_SET_NO_NEW_PRIVS` enforced prior to execve.<br>3. Continuous automated kernel patch tracking and distribution. |
| **RISK-02** | **Microarchitectural CPU Side-Channels**<br>Spectre-v2, MDS, or cache-timing attacks leaking memory from co-located processes across CPU hyperthreads. | **HIGH** | LOW | MEDIUM | **MEDIUM** | 1. Software sandboxing cannot fully isolate CPU cache lines without hardware enclaves (Intel SGX / AMD SEV).<br>2. Operator recommendation: disable SMT/hyperthreading or bind sovereign extensions to dedicated CPU cores (`cpuset.cpus`). |
| **RISK-03** | **Host System Clock Manipulation**<br>Local attacker alters host RTC/system clock backwards to delay expiration of offline validity windows. | **MEDIUM** | LOW | MEDIUM | **LOW** | 1. SovereignSyncDaemon checks relative monotonicity and hash sequence count.<br>2. Operator recommendation: configure NTP with authenticated symmetric keys or use hardware monotonic counters / TPM NVRAM. |
| **RISK-04** | **Host Root Privilege Compromise**<br>An adversary already possessing host `root` access bypasses daemon policies or truncates filesystem files. | **CRITICAL** | LOW | CRITICAL | **HIGH** | 1. Host root is the root-of-trust for local enforcement.<br>2. Remote replication of the SQLite WAL hash-chain to remote WORM or distributed PBFT validators provides unfalsifiable forensic proof of tampering. |
| **RISK-05** | **Wasm JIT / Engine Compiler Vulnerability**<br>Flaw in the Wasm engine (Wasmedge/Wazero) JIT compiler enabling memory escape. | **HIGH** | LOW | HIGH | **LOW** | 1. Wasm modules run capability-restricted without raw filesystem or network host imports.<br>2. Hypervisor process running the Wasm engine is itself subject to execution timeouts, memory limits, and process-tree destruction. |
| **RISK-06** | **Covert Storage Channel via Ephemeral `/tmp`**<br>Extensions sharing ephemeral scratch directories attempting covert timing or lockfile signaling. | **LOW** | MEDIUM | LOW | **LOW** | 1. Every native extension run receives a unique, isolated ephemeral scratch directory (`/workspace`) cleaned up upon termination.<br>2. Private tmpfs mounts prevent cross-execution contamination. |

---

## 3. Residual Risk Sign-Off

The above risks represent the accepted residual risk baseline for local sovereign container execution. In accordance with CAIN-42 doctrine, any feature claiming complete elimination of kernel risks without hardware attestation is formally rejected.
