Extensible Verification of Untrusted Code Bor-Yuh Evan Chang, Adam Chlipala, Kun Gao, George Necula, and Robert Schneck May 14, 2004 OSQ Retreat Santa.

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.
Objects and Classes David Walker CS 320. Advanced Languages advanced programming features –ML data types, exceptions, modules, objects, concurrency,...
Type Analysis and Typed Compilation Stephanie Weirich Cornell University.
Comparing Semantic and Syntactic Methods in Mechanized Proof Frameworks C.J. Bell, Robert Dockins, Aquinas Hobor, Andrew W. Appel, David Walker 1.
8. Code Generation. Generate executable code for a target machine that is a faithful representation of the semantics of the source code Depends not only.
Foundational Certified Code in a Metalogical Framework Karl Crary and Susmit Sarkar Carnegie Mellon University.
Current Techniques in Language-based Security David Walker COS 597B With slides stolen from: Steve Zdancewic University of Pennsylvania.
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.
Type-Based Verification of Assembly Language for Compiler Debugging Bor-Yuh Evan ChangAdam Chlipala George C. NeculaRobert R. Schneck University of California,
Ashish Kundu CS590F Purdue 02/12/07 Language-Based Information Flow Security Andrei Sabelfield, Andrew C. Myers Presentation: Ashish Kundu
CS 355 – Programming Languages
An Introduction to Proof-Carrying Code David Walker Princeton University (slides kindly donated by George Necula; modified by David Walker)
The Design and Implementation of a Certifying Compiler [Necula, Lee] A Certifying Compiler for Java [Necula, Lee et al] David W. Hill CSCI
Ross Tate, Juan Chen, Chris Hawblitzel. Typed Assembly Languages Compilers are great but they make mistakes and can introduce vulnerabilities Typed assembly.
Coolaid: Debugging Compilers with Untrusted Code Verification Bor-Yuh Evan Chang with George Necula, Robert Schneck, and Kun Gao May 14, 2003 OSQ Retreat.
Intermediate Representation I High-Level to Low-Level IR Translation EECS 483 – Lecture 17 University of Michigan Monday, November 6, 2006.
CPSC Compiler Tutorial 8 Code Generator (unoptimized)
The Future of Correct Software George Necula. 2 Software Correctness is Important ► Where there is software, there are bugs ► It is estimated that software.
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.
Typed Memory Management in a Calculus of Capabilities David Walker (with Karl Crary and Greg Morrisett)
1 Enforcing Confidentiality in Low-level Programs Andrew Myers Cornell University.
CS 536 Spring Code generation I Lecture 20.
1 A Dependently Typed Assembly Language Hongwei Xi University of Cincinnati and Robert Harper Carnegie Mellon University.
Proofs, Types, and Safe Mobile Code CoS 598E David Walker.
Programmability with Proof-Carrying Code George C. Necula University of California Berkeley Peter Lee Carnegie Mellon University.
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
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.
Polyglot: An Extensible Compiler Framework for Java Nathaniel Nystrom, Michael R. Clarkson, and Andrew C. Myers Presentation by Aaron Kimball & Ben Lerner.
A Type System for Expressive Security Policies David Walker Cornell University.
The Practice of Type Theory in Programming Languages Robert Harper Carnegie Mellon University August, 2000.
Extensible Untrusted Code Verification Robert Schneck with George Necula and Bor-Yuh Evan Chang May 14, 2003 OSQ Retreat.
1 © 1999 Citrix Systems Inc Java on Nemesis Tim Harris.
COMP 14: Intro. to Intro. to Programming May 23, 2000 Nick Vallidis.
1 The Problem o Fluid software cannot be trusted to behave as advertised unknown origin (must be assumed to be malicious) known origin (can be erroneous.
Extensible Code Verification Kun Gao (Senior EECS) with Professor George Necula, Evan Chang, Robert Schneck, Adam Chlipala An individual receives code.
Cormac Flanagan University of California, Santa Cruz Hybrid Type Checking.
IB Computer Science II Paul Bui
1 Chapter-01 Introduction to Computers and C++ Programming.
Language Evaluation Criteria
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
Typed Assembly Languages and Security Automatons Ben Watson The George Washington University CS 297 Security and Programming Languages June 2, 2005.
Java Virtual Machine Java Virtual Machine A Java Virtual Machine (JVM) is a set of computer software programs and data structures that use.
Java Programming Introduction & Concepts. Introduction to Java Developed at Sun Microsystems by James Gosling in 1991 Object Oriented Free Compiled and.
Introduction to Java August 14, 2008 Mrs. C. Furman.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
1 Introduction to JVM Based on material produced by Bill Venners.
CPRG 215 Introduction to Object-Oriented Programming with Java Module 1-Introduction to Java Topic 1.1 Basics of Java Produced by Harvey Peters, 2008 Copyright.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Writing Systems Software in a Functional Language An Experience Report Iavor Diatchki, Thomas Hallgren, Mark Jones, Rebekah Leslie, Andrew Tolmach.
Compressed Abstract Syntax Trees as Mobile Code Christian H. Stork Vivek Haldar University of California, Irvine.
Virtual Machines, Interpretation Techniques, and Just-In-Time Compilers Kostis Sagonas
Secure Compiler Seminar 4/11 Visions toward a Secure Compiler Toshihiro YOSHINO (D1, Yonezawa Lab.)
Programming Languages
SAFE KERNEL EXTENSIONS WITHOUT RUN-TIME CHECKING George C. Necula Peter Lee Carnegie Mellon U.
Introduction to Programming 1 1 2Introduction to Java.
Software Engineering Algorithms, Compilers, & Lifecycle.
LLVM IR, File - Praakrit Pradhan. Overview The LLVM bitcode has essentially two things A bitstream container format Encoding of LLVM IR.
Credible Compilation With Pointers Martin Rinard and Darko Marinov Laboratory for Computer Science Massachusetts Institute of Technology.
A Single Intermediate Language That Supports Multiple Implemtntation of Exceptions Delvin Defoe Washington University in Saint Louis Department of Computer.
Proof Carrying Code and Proof Preserving Program Transformations
Low-Level Program Verification
TALx86: A Realistic Typed Assembly Language
State your reasons or how to keep proofs while optimizing code
Lecture 5 Floyd-Hoare Style Verification
A Trustworthy Proof Checker
Presentation transcript:

Extensible Verification of Untrusted Code Bor-Yuh Evan Chang, Adam Chlipala, Kun Gao, George Necula, and Robert Schneck May 14, 2004 OSQ Retreat Santa Cruz, California

2 5/14/2004 Type Safety as an Assurance Mechanism Type safety is an accepted assurance mechanism Today –Good:Type check source code in a strongly-typed high-level language (e.g. ML, C#, Java) –Better:Type check intermediate code (e.g., MS-CLI, JVML) OR code untrustedtrusted type checker

3 5/14/2004 Type Systems Today (JVML,MS-CLI,TAL) Hard-wired in the verifier High-level and tailored to particular source languages –E.g, built-in object-oriented features Hard to compile other source languages –Unnatural, loss of performance or expressiveness –E.g, ML ! JVML or Java ! TAL Under constant pressure to become more complex –To handle more source languages –To be able to check more complex code (e.g. optimizations)

4 5/14/2004 Generality by Customization MS-CLI is designed for a multiple languages, but –quite complex (e.g. 6-9 versions of function call) –not complex enough (the ILX project adds more calls) Still not general enough! –JVML: native code interface –MS-CLI: unverifiable subset of the language Proposal: Allow multiple type systems and other verification methods (e.g. PCC) to co-exist –Fix only the safety policy (e.g. memory safety) –Not the enforcement mechanism (e.g. a type system)

5 5/14/2004 Design Goals of the Open Verifier Should be easy to develop “verifier extensions” –Only incrementally more complicated than a conventional verifier for the same language –Be able to retrofit existing compilers or conventional verifiers Client should have complete control over the type system or other conventions –Calling conventions, exceptions, stack usage, data layout

6 5/14/2004 Bytecode Verification Example 2 r arg = 0 3 r rv à r rv r arg à m[r arg ] 1 r rv à 0 5 jump [r ra ] T F 0  ::= int | list | nelist len : list ! int

7 5/14/2004 Bytecode Verification Example 2 r arg = 0 3 r rv à r rv r arg à m[r arg ] 1 r rv à 0 5 jump [r ra ] arg : list arg : list Æ rv : int T F Why? arg : list Æ rv: int arg : nelist Æ rv : int

8 5/14/2004 Bytecode Verifier Correctness How do we know the verifier didn’t forget any checks? –Should not need to provide proofs involving the model of the machine semantics Use strongest post-condition generation to eliminate proof obligations about machine transitions –Show at each program point i with next states N, post(I i ) ) Ç j 2 N I j

9 5/14/2004 Verified Bytecode Verification 2 r arg = 0 3 r rv à r rv r arg à m[r arg ] 1 r rv à 0 5 jump [r ra ] I 1 = arg : list I 2 = arg : list Æ rv : int Why? pc = 2 Æ arg : list Æ rv = 0 post(I 1 )post(I 1 ) ) I 2 new I 2 = post(I 1 ) with add (rv : int) by imm_int with drop (rv = 0) T F

10 5/14/2004 Branch 2 r arg = 0 3 r rv à r rv r arg à m[r arg ] 1 r rv à 0 5 jump [r ra ] arg : list I 2 = arg : list Æ rv : int I 5 = arg : list Æ rv: int Why? pc = 3 Æ arg : list Æ rv : int Æ arg  0 Ç pc = 5 Æ arg : list Æ rv : int Æ arg = 0 post(I 2 ) case post(I 2 ) of I false where (pc = 3) ) new I 3 = I false with let h,h’ = find (arg : list), find (arg  0) in add (arg : nelist) by (cons h h’) with drop (arg : list) with drop (arg  0) | I true where (pc = 5) ) new I 5 = I true with drop (arg = 0) post(I 2 ) ) I 3 Ç I 5 T F I 3 = arg : nelist Æ rv : int

11 5/14/2004 Arithmetic 2 r arg = 0 3 r rv à r rv r arg à m[r arg ] 1 r rv à 0 5 jump [r ra ] arg : list arg : list Æ rv : int arg : list Æ rv: int I 3 = arg : nelist Æ rv : int Why? 9 rv 3. pc = 4 Æ arg : nelist Æ rv 3 : int Æ rv = rv post(I 3 ) new I 4 = post(I 3 ) with let h = find (rv 3 : int) in add (rv : int) by (plus h (imm_int)) with drop (rv 3 : int) with drop (rv = rv 3 + 1) post(I 3 ) ) I 4 T F I 4 = arg : nelist Æ rv : int

12 5/14/2004 Memory Read 2 r arg = 0 3 r rv à r rv r arg à m[r arg ] 1 r rv à 0 5 jump [r ra ] arg : list I 2 = arg : list Æ rv : int arg : list Æ rv: int arg : nelist Æ rv : int I 4 = arg : nelist Æ rv : int Why? 9 arg 4. pc = 2 Æ arg 4 : nelist Æ rv : int Æ addr arg 4 Æ arg = m[arg 4 ] Ç pc = err Æ arg : nelist Æ rv : int Æ : (addr arg) post(I 4 ) case post(I 4 ) of I ok where _ ) I ok with let h = find (arg 4 : nelist) in add (arg : list) by (lem2 h) with … | I err where : (addr arg) by bad ) I err with let h = … in add ? by (bad (lem1 h)) with … post(I 4 ) ) I 2 Ç F T F lem1: If (arg : nelist) then (addr arg) lem2: If (arg : nelist) then (m[arg] : list) F = pc = err Æ ?

13 5/14/2004 Customizability Yields Controlled Trust Trust Meter Trust Any Binary (*.exe) Trust Specialized Verifiers (JVM) Trust Compilers (javac) Trust Typing Rules Trust Model of Machine Semantics

14 5/14/2004 Summary Provide a “natural” language for the verifier to describe in a checkable form the reasoning it makes –Close to conventional type-based verifiers –Amenable to other safety enforcement mechanisms, such as PCC PCC –Most of the time, just goes along with post( ¢ ) –When proof is required, give the proof attached with the code –Proof representation can be chosen by the client

15 5/14/2004 type checker Summary Towards practical extensible verification of untrusted code –Ask only for reasoning already done by conventional verifiers OR untrustedtrusted type checker code post( ¢ ) “preservation and progress”

16 5/14/2004 Conclusion We have verifier extensions for –Cool (“mini-Java”) [Aiken et al.] can verify output of existing Cool compilers –TAL (functional typed assembly language) retrofitted TALx86 [Morrisett et al.] –PCC Philosophy: –To verify complete software systems, not a general, super-expressive type system rather a framework to allow existing ones to work together

18 5/14/2004 Return 2 r arg = 0 3 r rv à r rv r arg à m[r arg ] 1 r rv à 0 5 jump [r ra ] arg : list arg : list Æ rv : int I 5 = arg : list Æ rv: int arg : nelist Æ rv : int Why? pc = ra 0 Æ arg : list Æ rv : int post(I 5 ) post(I 5 ) with drop (arg : list) post(I 5 ) ) R T F R = pc = ra 0 Æ rv : int