Securing Java applets Erik Poll Security of Systems (SOS) group University of Nijmegen www.cs.kun.nl/~erikpoll.

Slides:



Advertisements
Similar presentations
Challenges in increasing tool support for programming K. Rustan M. Leino Microsoft Research, Redmond, WA, USA 23 Sep 2004 ICTAC Guiyang, Guizhou, PRC joint.
Advertisements

.NET Technology. Introduction Overview of.NET What.NET means for Developers, Users and Businesses Two.NET Research Projects:.NET Generics AsmL.
Security of JavaCard smart card applets Erik Poll University of Nijmegen
Automata-Based Programming Technology Extension for Generation of JML Annotated Java Card Code Andrey Klebanov, CTD, SPb SU ITMO supervised by Anatoly.
New Security Issues Raised by Open Cards Pierre GirardJean-Louis Lanet GERMPLUS R&D.
Configuration management
Mobile Code Security Yurii Kuzmin. What is Mobile Code? Term used to describe general-purpose executables that run in remote locations. Web browsers come.
Ensuring Operating System Kernel Integrity with OSck By Owen S. Hofmann Alan M. Dunn Sangman Kim Indrajit Roy Emmett Witchel Kent State University College.
Java Applet Security Diana Dong CS 265 Spring 2004.
Mobile Code Security Aviel D. Rubin, Daniel E. Geer, Jr. MOBILE CODE SECURITY, IEEE Internet Computing, 1998 Minkyu Lee
The Java Modeling Language JML Erik Poll Digital Security Radboud University Nijmegen.
JML and ESC/Java2: An Introduction Karl Meinke School of Computer Science and Communication, KTH.
H Apr-01 Clark Thomborson Software Security CompSci 725 Handout 28: Report Writing #2 (Sample Titles & Abstracts) Clark Thomborson University of.
Gemplus and OSGI Benjamin Maury Gemplus Introduction  World Leader for Smart Card Solutions  Smart Solutions in Telecommunications  Beyond.
Using Programmer-Written Compiler Extensions to Catch Security Holes Authors: Ken Ashcraft and Dawson Engler Presented by : Hong Chen CS590F 2/7/2007.
The Design and Implementation of a Certifying Compiler [Necula, Lee] A Certifying Compiler for Java [Necula, Lee et al] David W. Hill CSCI
Lab#1 (14/3/1431h) Introduction To java programming cs425
Formal Methods of Systems Specification Logical Specification of Hard- and Software Prof. Dr. Holger Schlingloff Institut für Informatik der Humboldt.
Attacking Malicious Code: A Report to the Infosec Research Council Kim Sung-Moo.
Java: History and Introduction (Lecture # 1). History… Java – Based on C and C++ – Developed in 1991 for intelligent consumer electronic devices – Green.
Introduction to Java Kiyeol Ryu Java Programming Language.
An overview of JML tools and applications Lilian Burdy Gemplus Yoonsik Cheon, Gary Leavens Iowa Univ. David Cok Kodak Michael Ernst MIT Rustan Leino Microsoft.
Slides prepared by Rose Williams, Binghamton University Chapter 1 Getting Started 1.1 Introduction to Java.
Programmability with Proof-Carrying Code George C. Necula University of California Berkeley Peter Lee Carnegie Mellon University.
Software Reliability Methods Sorin Lerner. Software reliability methods: issues What are the issues?
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.
JML TOOLS REVIEW & EVALUATION Chris Grosshans Mark Lewis-Prazen.
1 Advanced Material The following slides contain advanced material and are optional.
Extensible Untrusted Code Verification Robert Schneck with George Necula and Bor-Yuh Evan Chang May 14, 2003 OSQ Retreat.
Cormac Flanagan University of California, Santa Cruz Hybrid Type Checking.
Java Security Updated May Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security.
TGDC Meeting, December 2011 Michael Kass National Institute of Standards and Technology Update on SAMATE Automated Source Code Conformance.
Unit Testing & Defensive Programming. F-22 Raptor Fighter.
CSC 142 A 1 CSC 142 Introduction to Java [Reading: chapter 0]
Introduction to Java CSIS 3701: Advanced Object Oriented Programming.
Java Security. Topics Intro to the Java Sandbox Language Level Security Run Time Security Evolution of Security Sandbox Models The Security Manager.
Towards Scalable Modular Checking of User-defined Properties Thomas Ball, MSR Brian Hackett, Mozilla Shuvendu Lahiri, MSR Shaz Qadeer, MSR Julien Vanegue,
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
Software Engineering Prof. Dr. Bertrand Meyer March 2007 – June 2007 Chair of Software Engineering Static program checking and verification Slides: Based.
Proof Carrying Code Zhiwei Lin. Outline Proof-Carrying Code The Design and Implementation of a Certifying Compiler A Proof – Carrying Code Architecture.
University of Houston-Clear Lake Proprietary© 1997 Evolution of Programming Languages Basic cycle of improvement –Experience software difficulties –Theory.
1.8History of Java Java –Based on C and C++ –Originally developed in early 1991 for intelligent consumer electronic devices Market did not develop, project.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Java 2 security model Valentina Casola. Components of Java the development environment –development lifecycle –Java language features –class files and.
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.
CHAPTER 3 GC Java Fundamentals. 2 BASICS OF JAVA ENVIRONMENT  The environment  The language  Java applications programming Interface API  Various.
Extended Static Checking for Java  ESC/Java finds common errors in Java programs: null dereferences, array index bounds errors, type cast errors, race.
Formal specification of Gemplus’ electronic purse case study Néstor Cataño & Marieke Huisman INRIA Sophia-Antipolis {ncatano,
© Andrew IrelandDependable Systems Group Static Analysis and Program Proof Andrew Ireland School of Mathematical & Computer Sciences Heriot-Watt University.
Computer Programming 2 Why do we study Java….. Java is Simple It has none of the following: operator overloading, header files, pre- processor, pointer.
J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition Second Edition D.S. Malik D.S. Malik.
1 CSCD 326 Data Structures I Software Design. 2 The Software Life Cycle 1. Specification 2. Design 3. Risk Analysis 4. Verification 5. Coding 6. Testing.
Spec# Andreas Vida. Motivation Correct and maintainable software Correct and maintainable software Cost effective software production Cost effective software.
Concurrency Properties. Correctness In sequential programs, rerunning a program with the same input will always give the same result, so it makes sense.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
PROGRAMMING PRE- AND POSTCONDITIONS, INVARIANTS AND METHOD CONTRACTS B MODULE 2: SOFTWARE SYSTEMS 13 NOVEMBER 2013.
Institute for Applied Information Processing and Communications (IAIK) – Secure & Correct Systems 1 Static Checking  note for.
Introduction to Programming 1 1 2Introduction to Java.
Programming 2 Intro to Java Machine code Assembly languages Fortran Basic Pascal Scheme CC++ Java LISP Smalltalk Smalltalk-80.
Cs498dm Software Testing Darko Marinov January 24, 2012.
Jeremy Nimmer, page 1 Automatic Generation of Program Specifications Jeremy Nimmer MIT Lab for Computer Science Joint work with.
Lecture 1: Introduction to JAVA
Accessible Formal Methods A Study of the Java Modeling Language
Introduction Enosis Learning.
State your reasons or how to keep proofs while optimizing code
Introduction Enosis Learning.
Introduction CSC 111.
Hoare-style program verification
Java Modeling Language (JML)
Presentation transcript:

Securing Java applets Erik Poll Security of Systems (SOS) group University of Nijmegen

Erik PollSecuring Java applets2 Overview Security problems of Java Card applets or any other piece of software, for that matter Work in the EU-IST project VerifiCard Work on formal techniques for applet verification in Nijmegen

Erik PollSecuring Java applets3 Java applet Java application (piece of software) that is deployed independently on some platform, with some operating system (OS), eg –Java Card smart card applet –mobile phone (eg midlet on MIDP phone) –PDA –web browser –PC –airplane

Erik PollSecuring Java applets4 Old vs new smart cards one program (applet) written in machine-code, specific to chip and OS burnt into ROM Applet written in high-level language (Java Card) compiled into bytecode stored in EEPROM interpreted on card Options: multi-application: several applets on one card post-issuance: adding or deleting applets on card

Erik PollSecuring Java applets5 Java Card platform (JCRE) - miniature OS Java Card platform (JCRE) - miniature OS Java Card architecture smart card hardware applet JC Virtual Machine JC API Global Platform

Erik PollSecuring Java applets6 Production of a Java Card applet byte code source code cap file compiler cap generator download Options: only pre-loaded applets only digitally signed applets (using Global Platform) Remaining issue: how do we certify these pre-loaded or signed applets? bytecode verifier

Erik PollSecuring Java applets7 Security questions 1.Is my applet correct and secure? “correct” is necessary precondition for “secure” 2.Is the platform correct and secure ? 3.Is someone else’s applet is not malicious ie. will it not –annoy users, –interfere with other applets, or –damage the platform ?

Erik PollSecuring Java applets8 Java applet security 1.language level security –basic guarantees (no buffer overflows) 2.platform level security –imposes additional restrictions to protect platform & other applets (firewall/sandbox) 3.application level security –applet responsible for own specific correctness & security needs

Erik PollSecuring Java applets9 Buffer overflows Example Application asks for 4-digit PIN code User supplies a 5-digit PIN code What happens in the memory ? 00 kire

Erik PollSecuring Java applets10 Buffer overflows Single biggest cause of bugs & security holes –30-70% of all security alerts –36% of all bugs at Microsoft Possible - and frequent - in C, C++ although there are good tools to detect them... Impossible in modern languages: Java, C# Conclusion: don’t use C(++), use Java or C#

Erik PollSecuring Java applets11 Java applet security 1.language level security –basic guarantees (no buffer overflows) 2.platform level security –imposes additional restrictions to protect platform & other applets (firewall/sandbox) 3.application level security –applet responsible for own specific correctness & security needs

Erik PollSecuring Java applets12 Security questions 1.Is my applet correct and secure? “correct” is necessary precondition for “secure” 2.Is the platform correct and secure ? 3.Is someone else’s applet is not malicious ie. will it not –annoy users, –interfere with other applets, or –damage the platform ? Security evaluations must answer these questions

Erik PollSecuring Java applets13 NB Even perfectly secure applet running on perfectly secure platform may suffer from malicious applets For example –a malicious applet on mobile phone could simply ask user to type in the PIN code Protection against such Trojan Horses will require human source code inspection of untrusted, potentially hostile, applets ?

Erik PollSecuring Java applets14 How do we certify software ? 1.testing but testing that applet does what it should do is easier than testing that applet does not do what it should not do 2.coding standards, design standards 3.code reviews 4.formal methods...

Erik PollSecuring Java applets15 VerifiCard

Erik PollSecuring Java applets16 VerifiCard EU-funded project for developing and applying formal methods for the specification and verification of the Java Card –platform and –applets Partners: universities, research institutes, smart card manufacturers

Erik PollSecuring Java applets17 Why formal methods ? (I) required by highest levels of certification in Common Criteria and there are increasing demands for higher levels of CC security evaluation

Erik PollSecuring Java applets18 Why formal methods ? (II) Central problem in ensuring that software is correct or secure: –We have long documents in English giving functional specs, security requirements,... –How to ensure that these specs are consistent & complete ? our implementations actually meet them ? –If we can express parts of these documents in formal languages, we have more options...

Erik PollSecuring Java applets19 Work on platform level At INRIA & TUM Formalisation of Java Card Virtual Machine Development of a provably correct byte code verifier This relies on the use of mechanical theorem provers

Erik PollSecuring Java applets20 Work on applet level At INRIA, SICS, Kaiserslautern, Nijmegen Formal specification and verification of Java Card applets, in particular using JML

Erik PollSecuring Java applets21 Java Card applet specification and verification using JML

Erik PollSecuring Java applets22 JML (Gary Leavens et al) Formal specification language for Java –JML specs added as annotations is Java source code files Easy to learn –small extension of Java syntax Supported by a range of tools

Erik PollSecuring Java applets23 JML Example requires amount >= 0; public void debit(int amount) {.... } Java compiler ignores this line but JML tools will parse it 19% of bugs are due to lack of input validation this precondition makes an assumption explicit

Erik PollSecuring Java applets24 JML Example requires amount >= 0; ensures balance == \old(balance) – amount; signals (PurseException) balanace == public void debit(int amount) {.... } 19% of bugs are due to lack of input validation this precondition makes an assumption explicit

Erik PollSecuring Java applets25 JML Example private int balance; final static int MAX_BALANCE; invariant 0 <= balance && balance <

Erik PollSecuring Java applets26 JML Example private byte[] pin; invariant pin != null && pin.length == 4 && (\forall int i; 0 <= i && i < 4 ; 0 <= pin[i] && pin[i] <=

Erik PollSecuring Java applets27 JML Example private byte appletState; constraint \old(appletState) == BLOCKED ==> appletState == BLOCKED; constraint \old(appletState) != PERSONALISED ==> appletState !=

Erik PollSecuring Java applets28 Using JML Many “soundness/safety” properties of Java (Card) program can be easily specified in JML Such properties help in understanding code For such properties we can use tools to check that implementations satisfy them There are different tools, offering different levels of assurance at different costs...

Erik PollSecuring Java applets29 Tools for JML parser & type-checker –no typos in specs runtime assertion checker (Iowa State, Gary Leavens) –tests if any specs are violated at runtime static checker ESC/Java (Compaq, Rustan Leino et al.) –automatic verification of simple properties interactive program verifier LOOP (Nijmegen) –interactive verification of any property

Erik PollSecuring Java applets30 Testing & verification Testing considers a limited set of inputs Verification covers all possible inputs Testing is easier with a formal (JML) spec that we can test against

Erik PollSecuring Java applets31 Applet verification: achievements Verification of real industrial smart card applet (EMV applet) Verification revealed uncaught exceptions that were not detected during normal testing Gemplus has developed JACK tool supporting JML, integrated in IDE their developers use

Erik PollSecuring Java applets32 Conclusions about applet verification Formal specification languages and tools can help when doing a code review Interactive program verification probably still too costly, but automated program verification seems to provide good return-on-investment How far can we push level of automation ? –Will Moore’s law rescue us here ?

Erik PollSecuring Java applets33 Conclusions

Erik PollSecuring Java applets34 Old vs new generation smart cards Some points to note: some security concerns are the same, eg –is the smart card OS correct and secure ? –is our application correct and secure ? possible advantages of Java Card: –Java Card OS better studied than others –our knowledge of and tools for Java may allow better & cheaper security evaluations

Erik PollSecuring Java applets35 Conclusions Java Card interesting opportunity to apply state-of-the-art formal methods developed in academia for Java. Increasing need about (security) certification of software. Central challenge: How can we express security requirements in a (semi)-formal way ?