Browser Security Guarantees through Formal Shim Verification Zachary Tatlock Dongseok Jang Sorin Lerner UC San Diego
Browsers: Critical Infrastructure Ubiquitous: many platforms, sensitive apps Vulnerable: Pwn2Own, just a click to exploit Reactive Defenses: many ad hoc, bug triage, regressions
Fully Formal Verification Code in language that eases reasoning Develop correctness proof in synch Fully formal, machine checkable proof
Fully Formal Verification Success story: CompCert C compiler Compiler Bugs Found GCC 122 LLVM 181 0 CompCert [Yang et al. PLDI 11 ] OS (seL4), RDBMS & HTTPD (YNot) realistic implementations guaranteed bug free
Fully Formal Verification Success story: CompCert C compiler The Catch Compiler Bugs Found Throw away all your code GCC 100 Rewrite in unfamiliar language LLVM 150 Formally specify correctness 0 CompCert ? [Yang et al. PLDI 11 ] Prove every detail correct OS (seL4), DB, HTTPD (YNot) Heroic effort realistic implementations guaranteed bug free
Formally Verify a Browser?! Resources Complex parts Subtle interactions JPEG Loose access policy HTML Decoder Renderer Constant evolution JavaScript Interpreter
Formal Shim Verification Formally Verify a Browser?! Resources Isolate sandbox untrusted code ✔ Shim Insert shim guards resource access JPEG HTML Decoder Renderer Verify shim prove security props JavaScript Interpreter
Formal Shim Verification Formally Verify a Browser?! Q UARK Resources formally verified browser ✔ Shim Security Props 1. Tab isolation 2. Cookie integrity JPEG HTML Decoder Renderer 3. Addr bar correctness Prove code correct JavaScript Interpreter machine checkable proof
Fully Formal Verification
Fully Formal Verification Code in language supporting reasoning
Fully Formal Verification Code Spec logical properties characterizing correctness
Fully Formal Verification Coq Theorem Prover Code Proof Assistant Spec
Fully Formal Verification Coq Theorem Prover Code Proof Assistant Spec interactively show code satisfies specification
Fully Formal Verification Code Proof ML x86 Assistant compile down to Spec machine code
Fully Formal Verification Code Proof ML x86 Assistant Spec Extremely strong guarantees about actual system!
Fully Formal Verification Rewrite entire system! Code Proof ML x86 Assistant Spec
Fully Formal Verification Rewrite entire system! Code Proof ML x86 Assistant Spec Prove every detail correct
Formal Shim Verification Resources ✔ Shim JPEG HTML Decoder Renderer JavaScript Interpreter
Formal Shim Verification Adapt to sandbox Resources request access via shim ✔ Write shim Shim design effective interface Sandbox.. Formally verify shim Untrusted ensure accesses secure Code
Formal Shim Verification Adapt to sandbox Resources request access via shim Key Insight Guarantee sec props for entire system ✔ Write shim Shim design effective interface Only reason about small shim Sandbox.. Radically ease verification burden Formally verify shim Untrusted ensure accesses secure Prove actual code correct Code
Quark: Verified Browser Resources ✔ Shim Sandbox.. Untrusted Code
Quark: Verified Browser Resources ✔ Shim Sandbox.. Untrusted Code
Quark: Verified Browser Resources Net network persistent storage ✔ Shim user interface Sandbox.. Untrusted Code
Quark: Verified Browser Resources Net ✔ Shim Sandbox.. Untrusted Code
Quark: Verified Browser Resources Shim Net Quark browser kernel Quark Kernel ✔ ✔ code, spec, proof in Coq Sandbox.. Untrusted Code
Quark: Verified Browser Resources Shim Net Quark Kernel ✔ ✔ Sandbox.. Untrusted Code
Quark: Verified Browser Resources Shim Net Untrusted Code Quark Kernel ✔ ✔ browser components run as separate procs Sandbox.. strictly sandboxed Untrusted Code
Quark: Verified Browser Resources Shim Net Untrusted Code Quark Kernel ✔ ✔ browser components run as separate procs Sandbox.. strictly sandboxed Untrusted Code talk to kernel over pipe
Quark: Verified Browser Resources Shim Net Untrusted Code Quark Kernel ✔ ✔ two component types Sandbox.. Untrusted Code
Quark: Verified Browser Resources Shim Net Untrusted Code Quark Kernel ✔ ✔ two component types WebKit modified WebKit, Tab intercept accesses
Quark: Verified Browser Resources Shim Net Untrusted Code Quark Kernel ✔ ✔ two component types WebKit Tab
Quark: Verified Browser Resources Shim Net Untrusted Code Quark Kernel ✔ ✔ two component types written in Python, WebKit Cookie manages single domain Manager Tab
Quark: Verified Browser Resources Shim Net Untrusted Code Quark Kernel ✔ ✔ two component types WebKit tabs cookie managers WebKit Cookie Tab Manager
Quark: Verified Browser Resources Shim Net Untrusted Code Quark Kernel ✔ ✔ two component types WebKit tabs cookie managers WebKit Cookie WebKit Cookie WebKit Tab Manager Tab Manager Tab several instances each
Quark: Verified Browser Net Quark Kernel ✔ ✔ WebKit Cookie WebKit Cookie WebKit Tab Manager Tab Manager Tab
Quark Kernel: Code, Spec, Proof Quark Kernel ✔
Quark Kernel: Code , Spec, Proof
Quark Kernel: Code , Spec, Proof Definition kstep ...
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := ... kernel state
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); ... Unix-style select to find a component pipe ready to read
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); match f with case: f is user input | Stdin => ... | Tab t => case: f is tab pipe ...
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); match f with | Stdin => cmd <- read_cmd(stdin); ... read command from user over stdin | Tab t => ...
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); match f with | Stdin => cmd <- read_cmd(stdin); match cmd with | AddTab => ... user wants to create and focus a new tab | ... | Tab t => ...
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); match f with | Stdin => cmd <- read_cmd(stdin); match cmd with | AddTab => t <- mk_tab(); ... create a new tab | ... | Tab t => ...
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); match f with | Stdin => cmd <- read_cmd(stdin); match cmd with | AddTab => t <- mk_tab(); write_msg(t, Render); ... | ... tell new tab to | Tab t => render itself ...
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); match f with | Stdin => cmd <- read_cmd(stdin); match cmd with | AddTab => t <- mk_tab(); write_msg(t, Render); return (t, t::tabs) | ... | Tab t => return updated state ...
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); match f with | Stdin => cmd <- read_cmd(stdin); match cmd with | AddTab => t <- mk_tab(); write_msg(t, Render); return (t, t::tabs) | ... handle other | Tab t => user commands ...
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); match f with | Stdin => cmd <- read_cmd(stdin); match cmd with | AddTab => t <- mk_tab(); write_msg(t, Render); return (t, t::tabs) handle requests | ... from tabs | Tab t => ...
Quark Kernel: Code , Spec, Proof Definition kstep(focused_tab, tabs) := f <- select(stdin, tabs); match f with | Stdin => cmd <- read_cmd(stdin); match cmd with | AddTab => t <- mk_tab(); write_msg(t, Render); return (t, t::tabs) | ... | Tab t => ...
Quark Kernel: Code, Spec , Proof
Quark Kernel: Code, Spec , Proof Specify correct behavior wrt syscall seqs read(), write(), open(), write(), ...
Quark Kernel: Code, Spec , Proof Specify correct behavior wrt syscall seqs trace: all syscalls made by Quark kernel during execution
Quark Kernel: Code, Spec , Proof Specify correct behavior wrt syscall seqs kstep() kstep() kstep() kstep()
Quark Kernel: Code, Spec , Proof Specify correct behavior wrt syscall seqs structure of produceable traces supports spec & proof
Quark Kernel: Code, Spec , Proof Specify correct behavior wrt syscall seqs structure of produceable traces supports spec & proof Example: address bar correctness
Quark Kernel: Code, Spec , Proof Specify correct behavior wrt syscall seqs structure of produceable traces supports spec & proof Example: address bar correctness forall trace tab domain, ... for any trace, tab, where trace is a and domain sequence of syscalls
Recommend
More recommend