a type system for checking applet isolation in java card
play

A Type System for Checking Applet Isolation in Java Card Peter - PowerPoint PPT Presentation

A Type System for Checking Applet Isolation in Java Card Peter Mller ETH Zrich Joint work with Werner Dietl and Arnd Poetzsch-Heffter 2 A Type System for Checking Applet Isolation in Java Card Applet Isolation Firewall Applet Context 1


  1. A Type System for Checking Applet Isolation in Java Card Peter Müller ETH Zürich Joint work with Werner Dietl and Arnd Poetzsch-Heffter

  2. 2 A Type System for Checking Applet Isolation in Java Card Applet Isolation Firewall Applet Context 1 Applet Context 2 SIO Firewall PEP TEP JCRE Context Peter Müller – CASSIS 2004

  3. 3 A Type System for Checking Applet Isolation in Java Card Example class Status { interface Service extends Shareable { … Status doService( ); boolean isSuccess( ) { … } } } class Client extends Applet { … void process( APDU apdu ) { AID server = …; Shareable s = JCSystem.getAppletShareableInterfaceObject( server, ( byte ) 0 ); Service service = ( Service ) s; Status status = service.doService( ); if ( status.isSuccess( ) ) { … } // SecurityException raised } } Peter Müller – CASSIS 2004

  4. 4 A Type System for Checking Applet Isolation in Java Card Motivation ! Formal program verification - Prove absence of SecurityExceptions for many kinds of expressions - Firewall property causes significant overhead for specifications and proofs ! Objective - Check applet isolation statically - Develop a solution for source programs - Build on experience with ownership and the Universe Type System Peter Müller – CASSIS 2004

  5. 5 A Type System for Checking Applet Isolation in Java Card Approach ! Use type system Firewall Applet Context 1 Applet Context 2 to classify references to - Objects in the same context SIO - Objects in any contexts - Entry points Firewall ! Perform static checks to PEP enforce applet isolation JCRE Context Peter Müller – CASSIS 2004

  6. 6 A Type System for Checking Applet Isolation in Java Card Tagged Types ! Tags - intern : References within a context - any : References to any context - pep : References to permanent entry points - tep : References to temporary entry points and global arrays ! Tagged types specify the context a reference may point into - Tagged types are tuples: Tag × Type, e.g., intern T Peter Müller – CASSIS 2004

  7. 7 A Type System for Checking Applet Isolation in Java Card Type Rules ! intern and pep types are any T tep T subtypes of the corresponding any types intern T pep T ! Type rules for tagged types follow Java’s type rules void process( tep APDU apdu ) { intern AID server = …; any Shareable s = JCSystem.getAppletShareableInterfaceObject( server, ( byte ) 0 ); any Service service = ( any Service ) s; ?? Status status = service.doService( ); if ( status.isSuccess( ) ) { … } } Peter Müller – CASSIS 2004

  8. 8 A Type System for Checking Applet Isolation in Java Card Method Invocations ! Tag intern specifies interface Service extends Shareable { context relatively to intern Status doService( ); } the current context ! For method any Service service = …; any Service service = …; ?? Status status = service.doService( ); any Status status = service.doService( ); invocations, parameter and result types have to Firewall be interpreted relatively to the tag service of the target Peter Müller – CASSIS 2004

  9. 9 A Type System for Checking Applet Isolation in Java Card Type Combinations ! Type combinator * (H,T)*(G,S) = { ( any ,S) if H ≠ intern and G = intern (G,S) otherwise ! Type rule for method invocations | e1 :: (H,T) , | e2 :: (G,S) , (H,T)*(G,S) <: (F P ,T P ) | e1.m( e2 ) :: (H,T)*(F R ,T R ) Peter Müller – CASSIS 2004

  10. 10 A Type System for Checking Applet Isolation in Java Card Dynamic Type Checks ! Casts - Downcasts from any types to corresponding intern and pep types require dynamic checks - In practice only necessary for static fields (no intern tag) - Casts may throw SecurityException ! Covariant arrays - intern T[ ] and pep T[ ] are not subtypes of any T[ ] - Avoid dynamic check for assignments to array slots Peter Müller – CASSIS 2004

  11. 11 A Type System for Checking Applet Isolation in Java Card Static Firewall Checks ! Method invocation e.m(…) - (H,T) is the static tagged type of e - If H is any , T has to be an interface that extends Shareable ! Field access e1.f = e2 - Static type of e1 must have tag intern - Static type of e2 must not have tag tep Peter Müller – CASSIS 2004

  12. 12 A Type System for Checking Applet Isolation in Java Card Example Revisited class Status { interface Service extends Shareable { … intern Status doService( ); boolean isSuccess( ) { … } } } class Client extends Applet { … void process( tep APDU apdu ) { intern AID server = …; any Shareable s = JCSystem.getAppletShareableInterfaceObject( server, ( byte ) 0 ); any Service service = ( any Service ) s; any Status status = service.doService( ); if ( status.isSuccess( ) ) { … } // Static type error } } Peter Müller – CASSIS 2004

  13. 13 A Type System for Checking Applet Isolation in Java Card Results ! Type Safety - All references are correctly tagged - Proof by rule induction based on operational semantics ! Applet Isolation - Lemma: Each Java Card program with tagged types that passes the static checks behaves like the corresponding program with dynamic checks - Every Java Card program that can be correctly tagged does not throw SecurityExceptions (except for casts) - Proof by rule induction with two operational semantics (with and without dynamic checks) Peter Müller – CASSIS 2004

  14. 14 A Type System for Checking Applet Isolation in Java Card Conclusions ! Presented approach supports program verification - Absence of SecurityException does not have to be shown during verification (except for some casts) - Static checking is modular ! Security requires - Type system on bytecode level - Adapted VM / Bytecode verifier - Forbidding downcasts from any to intern or pep Peter Müller – CASSIS 2004

  15. 15 A Type System for Checking Applet Isolation in Java Card Future Work ! Extension of presented work - Support for missing language features (exceptions) - Annotation of Java Card API ! Formal verification - Integration of type system with Universe Type System - Implementation in J IVE (Java Interactive Verification Environment) Peter Müller – CASSIS 2004

Recommend


More recommend