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

a type system for checking applet isolation in java card
SMART_READER_LITE
LIVE PREVIEW

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


slide-1
SLIDE 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

slide-2
SLIDE 2

Peter Müller – CASSIS 2004 2

Applet Isolation

Applet Context 2 Applet Context 1

Firewall SIO

JCRE Context

Firewall TEP PEP

A Type System for Checking Applet Isolation in Java Card

slide-3
SLIDE 3

Peter Müller – CASSIS 2004 3

Example

class Status { … 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 } } interface Service extends Shareable { Status doService( ); }

A Type System for Checking Applet Isolation in Java Card

slide-4
SLIDE 4

Peter Müller – CASSIS 2004 4

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

A Type System for Checking Applet Isolation in Java Card

slide-5
SLIDE 5

Peter Müller – CASSIS 2004 5

Approach

! Use type system to classify references to

  • Objects in the

same context

  • Objects in any

contexts

  • Entry points

! Perform static checks to enforce applet isolation

JCRE Context Applet Context 2 Applet Context 1 Firewall Firewall SIO PEP

A Type System for Checking Applet Isolation in Java Card

slide-6
SLIDE 6

Peter Müller – CASSIS 2004 6

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

A Type System for Checking Applet Isolation in Java Card

slide-7
SLIDE 7

Peter Müller – CASSIS 2004 7

Type Rules

! intern and pep types are subtypes of the corresponding any types ! Type rules for tagged types follow Java’s type rules

A Type System for Checking Applet Isolation in Java Card

any T tep T pep T intern T

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( ) ) { … } }

slide-8
SLIDE 8

Peter Müller – CASSIS 2004 8

any Service service = …; ?? Status status = service.doService( );

Method Invocations

! Tag intern specifies context relatively to the current context ! For method invocations, parameter and result types have to be interpreted relatively to the tag

  • f the target

interface Service extends Shareable { intern Status doService( ); } Firewall service any Service service = …; any Status status = service.doService( );

A Type System for Checking Applet Isolation in Java Card

slide-9
SLIDE 9

Peter Müller – CASSIS 2004 9

! Type combinator * ! Type rule for method invocations

Type Combinations

(any,S) if H ≠ intern and G = intern (G,S) otherwise (H,T)*(G,S) ={

| e1 :: (H,T) , | e2 :: (G,S) , (H,T)*(G,S) <: (FP,TP) | e1.m( e2 ) :: (H,T)*(FR,TR)

A Type System for Checking Applet Isolation in Java Card

slide-10
SLIDE 10

Peter Müller – CASSIS 2004 10

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

A Type System for Checking Applet Isolation in Java Card

slide-11
SLIDE 11

Peter Müller – CASSIS 2004 11

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

A Type System for Checking Applet Isolation in Java Card

slide-12
SLIDE 12

Peter Müller – CASSIS 2004 12

Example Revisited

class Status { … 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 } } interface Service extends Shareable { intern Status doService( ); }

A Type System for Checking Applet Isolation in Java Card

slide-13
SLIDE 13

Peter Müller – CASSIS 2004 13

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)

A Type System for Checking Applet Isolation in Java Card

slide-14
SLIDE 14

Peter Müller – CASSIS 2004 14

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

A Type System for Checking Applet Isolation in Java Card

slide-15
SLIDE 15

Peter Müller – CASSIS 2004 15

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 JIVE (Java Interactive Verification

Environment)

A Type System for Checking Applet Isolation in Java Card