JFlow: Practical Mostly-Static Information Flow Control Andrew C. Myers.

Slides:



Advertisements
Similar presentations
Sml2java a source to source translator Justin Koser, Haakon Larsen, Jeffrey Vaughan PLI 2003 DP-COOL.
Advertisements

Java™ How to Program, 9/e Presented by: Dr. José M. Reyes Álamo © Copyright by Pearson Education, Inc. All Rights Reserved.
Liang, Introduction to Java Programming, Eighth Edition, (c) 2011 Pearson Education, Inc. All rights reserved Inheritance and Polymorphism.
6/10/2015C++ for Java Programmers1 Pointers and References Timothy Budd.
Owned Policies for Information Security Hubie Chen Stephen Chong Cornell University.
Java Generics.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
1 Chapter 4 Language Fundamentals. 2 Identifiers Program parts such as packages, classes, and class members have names, which are formally known as identifiers.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
1 Enforcing Confidentiality in Low-level Programs Andrew Myers Cornell University.
Advanced Programming Handout 9 Qualified Types (SOE Chapter 12)
Polyglot: An Extensible Compiler Framework for Java Nathaniel Nystrom, Michael R. Clarkson, and Andrew C. Myers Presentation by Aaron Kimball & Ben Lerner.
1 Inheritance and Polymorphism. 2 Motivations Suppose you will define classes to model circles, rectangles, and triangles. These classes have many common.
An Approach to Safe Object Sharing Ciaran Bryce & Chrislain Razafimahefa University of Geneva, Switzerland.
Data Abstraction and Object- Oriented Programming CS351 – Programming Paradigms.
Type-Based Distributed Access Control Tom Chothia, Dominic Duggan, and Jan Vitek Presented by Morgan Kleene.
Chapter 12 Qualified Types. Motivation  What should the principal type of (+) be? Int -> Int -> Int-- too specific a -> a -> a-- too general  It seems.
Automatic Implementation of provable cryptography for confidentiality and integrity Presented by Tamara Rezk – INDES project - INRIA Joint work with: Cédric.
CSE341: Programming Languages Lecture 11 Type Inference Dan Grossman Winter 2013.
Exceptions. Many problems in code are handled when the code is compiled, but not all Some are impossible to catch before the program is run  Must run.
Day 4 Objectives Constructors Wrapper Classes Operators Java Control Statements Practice the language.
Java Methods By J. W. Rider. Java Methods Modularity Declaring methods –Header, signature, prototype Static Void Local variables –this Return Reentrancy.
Comp 248 Introduction to Programming Chapter 4 - Defining Classes Part A Dr. Aiman Hanna Department of Computer Science & Software Engineering Concordia.
1 Inheritance and Polymorphism Chapter 9. 2 Polymorphism, Dynamic Binding and Generic Programming public class Test { public static void main(String[]
Object Oriented Programming
CISC6795: Spring Object-Oriented Programming: Polymorphism.
Chapter 9 Defining New Types. Objectives Explore the use of member functions when creating a struct. Introduce some of the concepts behind object-oriented.
Names Variables Type Checking Strong Typing Type Compatibility 1.
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
CMSC 202 Exceptions. Aug 7, Error Handling In the ideal world, all errors would occur when your code is compiled. That won’t happen. Errors which.
Containment and Integrity for Mobile Code Security policies as types Andrew Myers Fred Schneider Department of Computer Science Cornell University.
JAVA SERVER PAGES. 2 SERVLETS The purpose of a servlet is to create a Web page in response to a client request Servlets are written in Java, with a little.
A Bipartite Graph Model of Information Flow IFIP WG 2.3, May 2014 Gary T. Leavens (with John L. Singleton) University of Central Florida Orlando Florida.
APCS Java AB 2004 Review of CS1 and CS2 Review for AP test #1 Sources: 2003 Workshop notes from Chris Nevison (Colgate University) AP Study Guide to go.
CSE 425: Data Types I Data and Data Types Data may be more abstract than their representation –E.g., integer (unbounded) vs. 64-bit int (bounded) A language.
SECURE WEB APPLICATIONS VIA AUTOMATIC PARTITIONING S. Chong, J. Liu, A. C. Myers, X. Qi, K. Vikram, L. Zheng, X. Zheng Cornell University.
An Object-Oriented Approach to Programming Logic and Design Chapter 3 Using Methods and Parameters.
Visual C# 2012 for Programmers © by Pearson Education, Inc. All Rights Reserved.
Inter-Type Declarations in AspectJ Awais Rashid Steffen Zschaler © Awais Rashid, Steffen Zschaler 2009.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Chapter 9 Inheritance and.
Chapter 8 Class Inheritance and Interfaces F Superclasses and Subclasses  Keywords: super F Overriding methods  The Object Class  Modifiers: protected,
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
SOEN 343 Software Design Section H Fall 2006 Dr Greg Butler
Functions Math library functions Function definition Function invocation Argument passing Scope of an variable Programming 1 DCT 1033.
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Fall, Privacy&Security - Virginia Tech – Computer Science Click to edit Master title style Decentralized Information Flow A paper by Myers/Liskov.
Quick Review of OOP Constructs Classes:  Data types for structured data and behavior  fields and methods Objects:  Variables whose data type is a class.
Subclassing, pt. 2 Method overriding, virtual methods, abstract classes/methods COMP 401, Fall 2014 Lecture 9 9/16/2014.
 Static  Example for Static Field  Example for Static Method  Math class methods  Casting  Scope of Declaration  Method Overloading  Constructor.
© 2006 Pearson Addison-Wesley. All rights reserved 1-1 Chapter 1 Review of Java Fundamentals.
Recap Introduction to Inheritance Inheritance in C++ IS-A Relationship Polymorphism in Inheritance Classes in Inheritance Visibility Rules Constructor.
C Part 1 Computer Organization I 1 August 2009 © McQuain, Feng & Ribbens A History Lesson Development of language by Dennis Ritchie at Bell.
And other languages…. must remember to check return value OR, must pass label/exception handler to every function Caller Function return status Caller.
Language-Based Information- Flow Security (Sabelfeld and Myers) “Practical methods for controlling information flow have eluded researchers for some time.”
Fall, Privacy&Security - Virginia Tech – Computer Science Click to edit Master title style JFlow: Practical Mostly-Static Information Flow Control.
CONDITIONALS CITS1001. Scope of this lecture if statements switch statements Source ppts: Objects First with Java - A Practical Introduction using BlueJ,
Dr. M. Al-Mulhem Introduction 1 Chapter 6 Type Systems.
Exceptions in the Java programming language J. W. Rider.
CSE341: Programming Languages Lecture 11 Type Inference
Java Primer 1: Types, Classes and Operators
Java Programming Language
Chapter 9 Inheritance and Polymorphism
CSE341: Programming Languages Lecture 11 Type Inference
CSE341: Programming Languages Lecture 11 Type Inference
Java Programming Language
CSE341: Programming Languages Lecture 11 Type Inference
CSE341: Programming Languages Lecture 11 Type Inference
CSE341: Programming Languages Lecture 11 Type Inference
Presentation transcript:

JFlow: Practical Mostly-Static Information Flow Control Andrew C. Myers

Don’t cross the streams!

Disallow A from affecting B unless B’s security classification is at least as restrictive as A’s!

Motivation Privacy protection is increasingly critical Static information-flow checking is a good solution –Compromise between security and performance Several languages exist on paper that allow static information-flow checking, but… –None are practical; too limited and/or restrictive Goal of JFlow: support static information-flow checking and be practical

Background Builds on existing work: –Java –Lattice model of information flow [Bell, Denning] –Subtype/parametric polymorphism –Dependent types [Cardelli] –Decentralized label model [Myers] Related to ORAC [McCollum] and “originator-controlled release” used by DoD –Fast lattice constraint-solving algorithm [Rehof]

Innovations Novel work solving practical problems: –Mutable objects –Declassification –Dynamic granting/revoking of authority –Label polymorphism –Automatic label inference –Exceptions

Design.jif JFlow.jif.java Source-to-source compiler for Java Statically-checked constructs are simply removed –“For the most part, translation involves removal of the static annotations in the JFlow program (after checking them, of course). There is little code space, data space, or run time overhead…” Non-statically-checked constructs (labels, principals, actsFor, switch label ) are converted to runtime checks

Labels Labels are type annotations that allow label checking Label checking = statically determining that the label of every expression is at least as restrictive as the label of any value it might produce JFLow’s labeling scheme comes from decentralized label model explored by Myers and Liskov “Label” = set of 0 or more Policies “Policy” = 1 owner and 0 or more readers L = { o 1 : r 1, r 2 ; o 2 : r 2, r 3 } owner readers policy label

Labels L = { o 1 : r 1, r 2 ; o 2 : r 2, r 3 } “o 1 allows r 1 and r 2 to read and o 2 allows r 2 and r 3 to read” { } is the fully permissive label “No principal has expressed a security interest” Owner automatically included as reader L = { o 1 : } “o 1 allows only his/herself to read” Owners and readers are drawn from the set of “principals”

Labels Data may only be read by a principal if all of the policies in its label list that principal as a reader –The “effective policy” of a label is the intersection of all its policies Labels form lattices –Let A B be join/LUB –Let A ≤ B be A “can be relabeled as” B For each policy in A, there is a policy at least as restrictive in B –Let ≈ be shorthand for A ≤ B and B ≤ A ∏

Labels Example lattice where only principals are Alice and Bob { } ≈ { Alice : Bob ; Bob : Alice } { Alice : } ≈ { Alice : ; Bob : Alice }{ Bob : } ≈ { Alice : Bob ; Bob : } { Alice : ; Bob : }

Labels A principal may choose to relax (add readers to) a policy that it owns; this is declassification –“Safe” because other policies are not affected Some principals are allowed to act for other principles –There is a “principal hierarchy” that can be updated dynamically –Not a key detail

Labeled Types Every variable is statically bound to a static label A label is denoted by a label expression, which is a set of component expressions (much like we saw) –However, a component expression may take other forms; e.g., it may be a variable name: –Policy of “x” means “copy variable x’s policies to here” –Effective readers for x, y, z are Alice, Alice, Nobody int { Alice : } x; int { x } y; int { Bob : ; y } z;

Labeled Types The programmer may omit labels, in which case JFlow will either infer the label or assign a default –“If omitted, the label of a local variable is inferred automatically based on its uses. In other contexts where a label is omitted, a context-dependent default label is generated. For example, for default label of an instance variable is the public label { }.” Other cases of default label assignment will be noted later

Implicit Flows All guarded expressions’ labels are forced to be at least as restrictive as the guard’s label Type system uses variable pc to hold the join-of-all- guard-labels at all points This example will fail label checking: secret ≤ public int { public } x; // pc = {} boolean { secret } b; // pc = {} … x = 0; // pc = {} if (b) { // pc = {} x = 1; // pc = { secret } }

Runtime Labels New primitive type label Needed when a label is relevant but is not known a priori Only thing you can do with a label is switch on it: Example is an attempt to transfer value of x to y “The statement executed is the first whose associated label is at least as restrictive as the expression label.” label { L } lb; int { *lb } x; int { p: } y; switch label(x) { case ( int { y } z ) y = z; else throw new UnsafeTransfer(); }

Runtime Labels label s also allow methods with dependent type signatures: label s may be used in label expressions only if they are immutable (final) after initialization –(As we’ll see later, method args are implicitly final) We’ll see this in the Protected example static float {*lb} compute(int x {*lb}, label lb)

Runtime Principals New primitive type principal Needed if a principal is relevant but not known a priori “Run-time principals are needed in order to model systems that are heterogenous with respect to the principals in the system, without resorting to declassification.”

Authority and Declassification We mentioned that a principal may declassify (weaken) policies that he or she owns – but where’s the principal? At a given point, the program is operating on behalf of some set of principals (called the static authority) Static authority at a given point depends on annotations made by the programmer on the class and method levels Only purpose of static authority is to statically determine whether declassifications are legal (as far as I can tell!) Declassification syntax: –declassify(e, L) : relabels expression e with L We’ll see this in the Password example

Classes Classes may be parameterized to make them generic with respect to some number of labels and/or principals Parameterized classes are simple dependent types “To ensure that these dependent types have a well- defined meaning only immutable (final) variables may be used as parameters”

Classes If { secret } ≤ { public }, does it follow that Vector[{secret}] ≤ Vector[{public}]? –No! Programmer may allow this in cases where it is sound by declaring label parameter covariant label covariant imposes additional constraints: no method argument or mutable instance variable may be labeled using the parameter

Classes A class always has one implicit label parameter: the label {this}, representing the label on an object of the class In the case of {this}, L1 ≤ L2 should imply that C{L1} acts as a subtype of C{L2}, so {this} must be a covariant label

Classes A class may have some authority granted to its objects by adding an authority clause to the class header –class passwordFile authority(root) { … } If the authority clause names “external principals,” the process that installs the class into the system must have the authority of the named principals “If the authority clause names principals that are parameters of the class, the code that creates an object of the class must have the authority of the actual principal parameters used in the call to the constructor.”

Methods The return value, arguments, and exceptions may each be individually labeled Arguments are always implicitly final There is also an optional begin-label and end-label –If begin-label is specified then pc must be at least as restrictive as begin-label at time of call –If end-label is specified then no termination of the method may leak more information than end-label specifies (end-label is at least as sensitive as the leaked information)

Methods When labels are omitted from parameters, those parameters use implicit label polymorphism –The argument labels become implicit parameters to the function –Without label polymorphism, libraries are intractable (need one method for every possible labeling of the parameters)

Methods If begin-label is omitted, it too becomes an implicit parameter to the function –“Because the pc within the method contains an implicit parameter, this method is prevented from causing real side effects…” If a return-value label is omitted, it defaults to the join of all argument labels and the end-label

Methods static int {x;y} add(int x, int y) { return x + y; } boolean compare_str(String name, String pwd) : {name; pwd} throws(NullPointerException) {…} boolean store{L} (int{} x) throws(NotFound) {…} Return value label End-label Parameter label Explicit label parameter?

Password Example Establish static authority Declassify (removes root: policy) Runtime exceptions in JFlow must be explicitly caught root: policy added to label of match via pc

Protected Example “The default label for a return value is the end-label, joined with the labels of all the arguments.” ???

Typed Label Checking Some rules for type and label checking are given in the paper; complete set in a journal paper The checking subsystem generates a system of constraints that are solved by a fast constraint solver –Solver algorithm based on previous work by Rehof, Mogensen Theoretical argument for why it’s fast “The observed behavior of the JFlow compiler is that constraint solving is a negligible part of run time.”

Translation The vast majority of annotations are simply removed Uses of the new primitive label and authority types are translated to jflow.lang.Label and jflow.lang.Principal “Only two constructs translate to interesting code: the actsFor and switch label statement, which dynamically test principals and labels, respectively.” Dynamic tests translate to optimized method calls on Label and Principal classes –Memoize for speed

Mission Accomplished? The goal was to build a practical system; is it practical? Not backward-compatible with Java –“…since existing Java libraries are not flow-checked and do not provide flow annotations. However, in many cases, a Java library can be wrapped in a JFlow library that provides reasonable annotations.” –No static fields –No Threads –No unchecked exceptions

Mission Accomplished? Only large projects in JFlow/Jif I found were Civitas and JPMail JPMail: “an experiment in security programming” –“Software engineering: Developing an application in Jif was complex and time-consuming. Just the edit/compile/repair cycle was tedious because of the surprisingly large number of possible information leaks in typical programs. Jif prevents all possible leaks, forcing very particular programming styles.. There are also opportunities for other refactorings to aid the programmer in labeling and re-labeling data. These developments are still in progress.” –“We concluded that Jif holds great promise for building provably secure, distributed applications, but more development is needed before this goal may be realized.