Extensible Untrusted Code Verification Robert Schneck with George Necula and Bor-Yuh Evan Chang May 14, 2003 OSQ Retreat.

Slides:



Advertisements
Similar presentations
Automated Theorem Proving Lecture 1. Program verification is undecidable! Given program P and specification S, does P satisfy S?
Advertisements

Compositional Verifiers for Mobile Code Safety Bor-Yuh Evan Chang Adam Chlipala George C. Necula May 12, 2005 OSQ Retreat Santa Cruz, California.
Automated Verification with HIP and SLEEK Asankhaya Sharma.
Comparing Semantic and Syntactic Methods in Mechanized Proof Frameworks C.J. Bell, Robert Dockins, Aquinas Hobor, Andrew W. Appel, David Walker 1.
Certified Typechecking in Foundational Certified Code Systems Susmit Sarkar Carnegie Mellon University.
Chapter 10- Instruction set architectures
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 20: Total Correctness; Proof-
1 Mooly Sagiv and Greta Yorsh School of Computer Science Tel-Aviv University Modern Compiler Design.
March 4, 2005Susmit Sarkar 1 A Cost-Effective Foundational Certified Code System Susmit Sarkar Thesis Proposal.
Programming Languages Marjan Sirjani 2 2. Language Design Issues Design to Run efficiently : early languages Easy to write correctly : new languages.
David Evans CS655: Programming Languages University of Virginia Computer Science Lecture 19: Minding Ps & Qs: Axiomatic.
Time Bounds for General Function Pointers Robert Dockins and Aquinas Hobor (Princeton University) (NUS) TexPoint fonts used in EMF. Read the TexPoint manual.
The Design and Implementation of a Certifying Compiler [Necula, Lee] A Certifying Compiler for Java [Necula, Lee et al] David W. Hill CSCI
Coolaid: Debugging Compilers with Untrusted Code Verification Bor-Yuh Evan Chang with George Necula, Robert Schneck, and Kun Gao May 14, 2003 OSQ Retreat.
HCSSAS Capabilities and Limitations of Static Error Detection in Software for Critical Systems S. Tucker Taft CTO, SofCheck, Inc., Burlington, MA, USA.
Extensible Verification of Untrusted Code Bor-Yuh Evan Chang, Adam Chlipala, Kun Gao, George Necula, and Robert Schneck May 14, 2004 OSQ Retreat Santa.
Strength Through Typing: A more powerful dependently-typed assembly language Matt Harren George Necula OSQ 2004.
Typed Assembly Languages COS 441, Fall 2004 Frances Spalding Based on slides from Dave Walker and Greg Morrisett.
Under the Hood of the Open Verifier Bor-Yuh Evan Chang, Adam Chlipala, Kun Gao, George Necula, and Robert Schneck October 21, 2003 OSQ Group Meeting.
1 Enforcing Confidentiality in Low-level Programs Andrew Myers Cornell University.
Programmability with Proof-Carrying Code George C. Necula University of California Berkeley Peter Lee Carnegie Mellon University.
Copyright © 2006 Addison-Wesley. All rights reserved.1-1 ICS 410: Programming Languages Chapter 3 : Describing Syntax and Semantics Operational Semantics.
Modular Verification of Assembly Code with Stack-Based Control Abstractions Xinyu Feng Yale University Joint work with Zhong Shao, Alexander Vaynberg,
Language-Based Security Proof-Carrying Code Greg Morrisett Cornell University Thanks to G.Necula & P.Lee.
A Type System for Expressive Security Policies David Walker Cornell University.
From last time S1: l := new Cons p := l S2: t := new Cons *p := t p := t l p S1 l p tS2 l p S1 t S2 l t S1 p S2 l t S1 p S2 l t S1 p L2 l t S1 p S2 l t.
Chapter 2: Impact of Machine Architectures What is the Relationship Between Programs, Programming Languages, and Computers.
Advanced Type Systems for Low-Level Languages Greg Morrisett Cornell University.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
Extensible Code Verification Kun Gao (Senior EECS) with Professor George Necula, Evan Chang, Robert Schneck, Adam Chlipala An individual receives code.
1 CHAPTER 4 LANGUAGE/SOFTWARE Hardware Hardware is the machine itself and its various individual equipment. It includes all mechanical, electronic.
Language Evaluation Criteria
Security in Java Sunesh Kumra S
Containment and Integrity for Mobile Code Security policies as types Andrew Myers Fred Schneider Department of Computer Science Cornell University.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
Proof-Carrying Code & Proof-Carrying Authentication Stuart Pickard CSCI 297 June 2, 2005.
An overview of Coq Xinyu Feng USTC Erasmus Mundus NordSecMob Scholar at DTU.
Refinements to techniques for verifying shape analysis invariants in Coq Kenneth Roe GBO Presentation 9/30/2013 The Johns Hopkins University.
Module : Algorithmic state machines. Machine language Machine language is built up from discrete statements or instructions. On the processing architecture,
Virtual Machines, Interpretation Techniques, and Just-In-Time Compilers Kostis Sagonas
Certifying Intermediate Programming Zhaopeng Li
MAL 3 - Procedures Lecture 13. MAL procedure call The use of procedures facilitates modular programming. Four steps to transfer to and return from a procedure:
3.2 Semantics. 2 Semantics Attribute Grammars The Meanings of Programs: Semantics Sebesta Chapter 3.
Secure Compiler Seminar 4/11 Visions toward a Secure Compiler Toshihiro YOSHINO (D1, Yonezawa Lab.)
Verification & Validation By: Amir Masoud Gharehbaghi
Automated tactics for separation logic VeriML Reconstruct Z3 Proof Safe incremental type checker Certifying code transformation Proof carrying hardware.
Concurrency Properties. Correctness In sequential programs, rerunning a program with the same input will always give the same result, so it makes sense.
Introduction Program File Authorization Security Theorem Active Code Authorization Authorization Logic Implementation considerations Conclusion.
SASI Enforcement of Security Policies : A Retrospective* PSLab 오민경.
SAFE KERNEL EXTENSIONS WITHOUT RUN-TIME CHECKING George C. Necula Peter Lee Carnegie Mellon U.
Fundamentals of Informatics Lecture 12 The Halting Problem Bas Luttik.
CSE 60641: Operating Systems George C. Necula and Peter Lee, Safe Kernel Extensions Without Run-Time Checking, OSDI ‘96 –SIGOPS Hall of fame citation:
Prof. Necula CS 164 Lecture 171 Operational Semantics of Cool ICOM 4029 Lecture 10.
Instruction Set Architectures Continued. Expanding Opcodes & Instructions.
Mostly-Automated Verification of Low-Level Programs in Computational Separation Logic Adam Chlipala Harvard University PLDI 2011.
COSC 5V90 Functional Programming and Interactive Theorem Proving
Before You Begin Nahla Abuel-ola /WIT.
Lecture 1: Introduction to JAVA
Low-Level Program Verification
Modularity and Memory Clearly, programs must have access to memory
Jared Davis The University of Texas at Austin April 6, 2006
Real-time Software Design
State your reasons or how to keep proofs while optimizing code
MIPS Instructions.
An overview of Coq Xinyu Feng USTC.
CMP 131 Introduction to Computer Programming
A Trustworthy Proof Checker
The Design & Implementation of Hyperupcalls
Principles of Programming Languages
An overview of Coq.
Presentation transcript:

Extensible Untrusted Code Verification Robert Schneck with George Necula and Bor-Yuh Evan Chang May 14, 2003 OSQ Retreat

2 7/12/2015 Flexibility for Code Producers A host receives code from an untrusted agent Before executing the code, the host wants to verify certain properties (e.g. memory safety) The host does not want to restrict the code producer…... to a particular type system... to particular software conventions code ? untrustedtrusted Then how do we verify the code?

3 7/12/2015 An Untrusted Verifier The code producer supplies the verifier along with the code code ? untrustedtrusted verifier Too hard to prove correctness of the verifier...

4 7/12/2015 An Untrusted Verifier The code producer supplies the verifier along with the code code untrustedtrusted verifier Too hard to prove correctness of the verifier... extension OpenVer Embed the untrusted verifier as an extension in a trusted framework (the Open Verifier )

5 7/12/2015 Decoder instruction at state s safe if P holds proceed to next states D The Open Verifier Core Extension code trusted untrusted state s a proof of P proceed to next states E and a proof that E covers D next states E

6 7/12/2015 The decoder is the canonical symbolic evaluator Examples of decoding a state (pc = 5 Æ A) The Decoder r 1 Ã r 2 + 1Truepc = 6 Æ r 1 = r Æ 9 x. A[r 1  x] r 1 Ã read r 2 addr r 2 pc = 6 Æ r 1 = (sel m r 2 ) Æ 9 x. A[r 1  x] jump FTruepc = F Æ A if Q then jump F Truepc = F Æ A Æ Q, pc = 6 Æ A Æ : Q jump *raTruepc = ra Æ A instruction 5 local safetynext states The decoder only handles hardware conventions

7 7/12/2015 Soundness and Trustworthiness We have proven the soundness of the algorithm used by the core of the Open Verifier The trusted code base (core, decoder, proof checker) could be small and simple –thus easy to trust We need to ensure the extension is memory safe –Use the extension to verify itself---this one time, run it in a separate address space What about the extensions? –What does it take to write an extension? –How much can extensions do?

8 7/12/2015 A Type System of Lists Code producer uses accessible memory for lists –“1” is a list (the empty list) –any even address containing a list is a list –nothing else is a list 1.store a à 1 2.s à read b 3.if odd(s) then jump 5 4.store s à a 5.halt a s 1 b Consider the program:

9 7/12/2015 Informal Proof Obligations Proof obligations (informal): “ a and b are accessible addresses and if the contents of b after storing 1 at a is even then it is an accessible address ” –Too low level Code producer would prefer instead: “ a and b are non-empty lists ” –Simpler and easier to prove (using the definition of lists) How can the code producer achieve this effect ? 1.store a à 1 2.s à read b 3.if odd(s) then jump 5 4.store s à a 5.halt a s 1 b

10 7/12/2015 Typing Rules list 1 list a even a nelist a list a inv m nelist a list b inv (upd m a b) nelist a inv m list (sel m a) nelist a addr a 1.store a à 1 2.s à read b 3.if odd(s) then jump 5 4.store s à a 5.halt Initial state: pc = 1 Æ nelist a Æ nelist b Æ inv m Decoder local safety: addr a Decoder next state: pc = 2 Æ nelist a Æ nelist b Æ 9 m’. inv m’ Æ m = (upd m’ a 1) Extension next state: pc = 2 Æ nelist a Æ nelist b Æ inv m

11 7/12/2015 Typing Rules list 1 list a even a nelist a list a inv m nelist a list b inv (upd m a b) nelist a inv m list (sel m a) nelist a addr a 1.store a à 1 2.s à read b 3.if odd(s) then jump 5 4.store s à a 5.halt Initial state: pc = 2 Æ nelist a Æ nelist b Æ inv m Decoder local safety: addr b Decoder next state: pc = 3 Æ nelist a Æ nelist b Æ inv m Æ s = (sel m b) Extension next state: pc = 3 Æ nelist a Æ nelist b Æ inv m Æ list s

12 7/12/2015 Producing Proofs Using the typing lemmas is completely automatizable –We use a Prolog interpreter where the Prolog program consists of the typing rules: nelist a :- list a, even a –Each individual program is then handled automatically Proving the typing rules is hard –They become lemmas to be proven by hand in Coq Definition nelist [a:val] := (addr a) /\ (even a). Definition list [a:val] := (a = 1) \/ (nelist a). Lemma rule : (a:val)(list a) ! (even a) ! (nelist a). Proof... –But only need to proven once

13 7/12/2015 How to Construct an Extension Type Checker OpenVer Wrapper Theorem Prover Proofs of Lemmas Could simply import an existing type checker (e.g. a bytecode verifier) Package the type-checker state into a logical predicate — requires recognizing invariants which may be implicit in the type-checker Use the typing rules in an automated theorem prover Instantiate all the typing predicates and rules as definitions and lemmas

14 7/12/2015 What can extensions do? Software conventions of stacks and function calls –The program had better use the stack safely A low-level extension to prove run-time functions –allocator, garbage collector Working on an extension for the simple object- oriented language Cool

15 7/12/2015 Experience so far... We have built a prototype implementation –5500 lines of ML in the trusted framework 1000 lines to parse Mips assembly code 2000 lines in the logic and proof checker 120 lines in the decoder An extension for the lists example –which also handles the stack and allocation 1000 lines in the “standard” type checker 900 lines to package for the OpenVer and tie it all together 600 lines for the Prolog interpreter 250 lines for the Prolog rules ??? lines of Coq proof –compare 4000 lines of Coq script for Java native-code

Extensible Untrusted Code Verification Robert Schneck with George Necula and Bor-Yuh Evan Chang May 13, 2003 OSQ Retreat

17 7/12/2015 The extension produces different next states... 1.generalization –Only need that memory satisfies an invariant, not its contents 2.re-use of states –loop invariants –A program to effect y à y 0 + x 0 (for positive x) 1.while (x > 0) do { 2. x à x y à y } –Invariant on line 1: (x ¸ 0 Æ x + y = x 0 + y 0 ) 3.“indirect” states –The decoder can’t handle a state without a literal pc –An indirect jump could implement function return, method dispatch, switch statement, exception handling...