This repository contains a complete formal verification of the capability-based security model used in the Zircon microkernel (the foundation of Google's Fuchsia OS). Using the interactive theorem prover Isabelle/HOL, we provide a mathematically rigorous model of Zircon's handle-based permission system and prove its fundamental security properties.
Formal Model: A complete Isabelle/HOL specification of Zircon's kernel objects, handles, and rights system
- Monotonicity of rights (rights can only decrease, never increase)
- No privilege escalation
- Preservation of object references during handle transfer
- Idempotence of rights reduction
- Practical Example: A working example demonstrating the creation and transfer of a VMO (Virtual Memory Object) with proper rights reduction
- System Call Model: Formal specification of Zircon's system call permission checking mechanism
- Basic Types
- Handle IDs: 32-bit identifiers for kernel object references
- Kernel Object Types: Process, Thread, Channel, VMO, etc.
- Rights: Atomic permissions (READ, WRITE, EXECUTE, MAP, TRANSFER, DUPLICATE, SIGNAL)
- Core Definitions
- Kernel Objects: Records containing type and unique identifier
- Handles: References to kernel objects with associated rights
- Handle Tables: Partial mappings from handle IDs to handles
- Key Operations
- create_object: Creates new kernel objects with initial rights
- transfer_handle: Transfers handles between processes with rights reduction
- zircon_syscall: Models Zircon's system call permission checking
Theorem 1: No Rights Escalation
theorem no_rights_escalation:
assumes "transfer_handle src_hid new_rights ht = (ht', Some new_hid)"
assumes "ht' new_hid = Some new_handle"
assumes "ht src_hid = Some src_handle"
shows "¬(∃r. r ∈ h_rights new_handle ∧ r ∉ h_rights src_handle)"
Theorem 2: Transfer Preserves Object Reference
lemma transfer_preserves_object:
assumes "transfer_handle src_hid new_rights ht = (ht', Some new_hid)"
assumes "ht src_hid = Some src_handle"
assumes "ht' new_hid = Some new_handle"
shows "h_obj new_handle = h_obj src_handle"
Proof: Handle transfer only changes rights, not the underlying kernel object.
Theorem 3: Rights Reduction is Idempotent
"reduce_rights R1 (reduce_rights R2 R) = reduce_rights (R1 ∩ R2) R"
Proof: Multiple rights reductions are equivalent to a single intersection.
The model includes a practical example demonstrating Zircon's security properties:
- Create a VMO with READ and WRITE rights
- Transfer the VMO handle to another process, requesting only READ rights
- Verify that the receiving process gets READ but not WRITE access
This example is formally proved correct in the example_scenario_true lemma.
This work builds upon and contributes to several areas:
- Formal Methods for OS Kernels: Following the tradition of seL4, Verve, and CertiKOS
- Capability-Based Security: Extends formal models of capability systems
- Zircon/Fuchsia Security: Provides formal foundations for Google's Fuchsia OS security model
- Isabelle/HOL Applications: Demonstrates practical use of interactive theorem proving for real-world systems
- Higher-Order Logic: For expressing complex security properties
- Record Types: For modeling kernel objects and handles
- Partial Functions: For handle table representation
- Set Theory: For rights and permissions modeling
- SMT Integration: For automated proof assistance
- Simplified handle ID generation (sequential)
- Abstract representation of kernel objects
- Focus on permission system rather than full kernel functionality
This formal model can be used for:
- Security Analysis: Rigorous verification of Zircon's security properties
- Education: Teaching capability-based security and formal methods
- Extension: Basis for modeling other aspects of Zircon/Fuchsia
- Cross-Verification: Comparison with other capability systems
Potential extensions to this model include:
- Concurrency: Modeling multi-threaded access to handles
- Full Kernel API: Formalizing more Zircon system calls
- Refinement: Connecting to lower-level implementation details
- Composition: Verifying properties of complex capability chains
- Zircon Documentation: https://fuchsia.dev/fuchsia-src/concepts/kernel
- Isabelle/HOL: https://isabelle.in.tum.de/
- Formal Verification of seL4: Klein et al., "seL4: Formal verification of an OS kernel"
- Capability Theory: Levy, "Capability-Based Computer Systems"
redbeardster@gmail.com - Formal modeling and verification
This work is provided for educational and research purposes. See individual files for specific licensing information.
- The Isabelle/HOL community for the excellent proof assistant
- Google Fuchsia team for the Zircon microkernel design
- Researchers in formal methods and OS verification for foundational work
"In mathematics you don't understand things. You just get used to them." – John von Neumann
This formal verification brings us one step closer to understanding – and proving – the security of modern operating systems.