Johannes Lerch, Ben Hermann, Eric Bodden, and Mira Mezini

Slides:



Advertisements
Similar presentations
Runtime Prevention & Recovery Protect existing applications Advantages: Prevents vulnerabilities from doing harm Safe mode for Web application execution.
Advertisements

Copyright 2008 Sun Microsystems, Inc Better Expressiveness for HTM using Split Hardware Transactions Yossi Lev Brown University & Sun Microsystems Laboratories.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
On the Privacy of Private Browsing Kiavash Satvat, Matt Forshaw, Feng Hao, Ehsan Toreini Newcastle University DPM’13.
1 InTroToJCL Introduction to Java Class Loaders. 2 class loader l ia an object responsible for loading classes. The class ClassLoader is an abstract class.
ITEC113 Algorithms and Programming Techniques
Using Programmer-Written Compiler Extensions to Catch Security Holes Authors: Ken Ashcraft and Dawson Engler Presented by : Hong Chen CS590F 2/7/2007.
Lecture 27 Exceptions COMP1681 / SE15 Introduction to Programming.
Common Sub-expression Elim Want to compute when an expression is available in a var Domain:
16-Jun-15 Exceptions. Errors and Exceptions An error is a bug in your program dividing by zero going outside the bounds of an array trying to use a null.
ReferencesReferences DiscussionDiscussion Vulnerability Example: SQL injection Auditing Tool for Eclipse LAPSE: a Security Auditing Tool for Eclipse IntroductionIntroductionResultsResults.
Recap from last time: live variables x := 5 y := x + 2 x := x + 1 y := x y...
Direction of analysis Although constraints are not directional, flow functions are All flow functions we have seen so far are in the forward direction.
1 Exception and Event Handling (Based on:Concepts of Programming Languages, 8 th edition, by Robert W. Sebesta, 2007)
A Conservative Algorithm for Computing the Flow of Permissions in Java Programs Gleb Naumovich Polytechnic University Brooklyn, USA Presented by David.
VEX: VETTING BROWSER EXTENSIONS FOR SECURITY VULNERABILITIES XIANG PAN.
Secure Web Applications via Automatic Partitioning Stephen Chong, Jed Liu, Andrew C. Meyers, Xin Qi, K. Vikram, Lantian Zheng, Xin Zheng. Cornell University.
Memory organization - storing variables efficiently in the RAM memory.
Computer Security and Penetration Testing
CSC-682 Cryptography & Computer Security Sound and Precise Analysis of Web Applications for Injection Vulnerabilities Pompi Rotaru Based on an article.
Effective Real-time Android Application Auditing
Java 2 security model Valentina Casola. Components of Java the development environment –development lifecycle –Java language features –class files and.
Consider the following Java code Race Conditions public class Shared { private int data; public Shared() { data = 0; } public void setData(int r) { data.
Java Software Solutions Lewis and Loftus Chapter 14 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Advanced Flow of Control --
Module 2 – User Safety Privacy Attacks on end users Browser vulnerabilities.
CMP-MX21: Lecture 5 Repetitions Steve Hordley. Overview 1. Repetition using the do-while construct 2. Repetition using the while construct 3. Repetition.
Buffer Overflow Attack Proofing of Code Binary Gopal Gupta, Parag Doshi, R. Reghuramalingam, Doug Harris The University of Texas at Dallas.
Privilege Escalation Two case studies. Privilege Escalation To better understand how privilege escalation can work, we will look at two relatively recent.
MOPS: an Infrastructure for Examining Security Properties of Software Authors Hao Chen and David Wagner Appears in ACM Conference on Computer and Communications.
CS223: Software Engineering Lecture 21: Unit Testing Metric.
Software Security. Bugs Most software has bugs Some bugs cause security vulnerabilities Incorrect processing of security related data Incorrect processing.
Constraint Framework, page 1 Collaborative learning for security and repair in application communities MIT site visit April 10, 2007 Constraints approach.
Content Coverity Static Analysis Use cases of Coverity Examples
Application Communities
CMSC 345 Defensive Programming Practices from Software Engineering 6th Edition by Ian Sommerville.
Protecting Memory What is there to protect in memory?
World Wide Web policy.
Protecting Memory What is there to protect in memory?
Protecting Memory What is there to protect in memory?
AUDACIOUS: USER DRIVEN ACCESS CONTROL WITH UNMODIFIED OPERATING SYSTEM
Handling Exceptionally Sticky Problems
Java Programming Language
Harry Xu University of California, Irvine & Microsoft Research
Secure Software Development: Theory and Practice
Topic: Java Security Models
Static Analysis of Java and Soot
Exceptions 10-Nov-18.
EE422C Software Implementation II
Exception Handling Chapter 9.
Johannes Lerch and Ben Hermann
Improving Security Using Extensible Lightweight Static Analysis
AdaCore Technologies for Cyber Security
Johannes Lerch, Johannes Späth, Eric Bodden, and Mira Mezini
All You Ever Wanted to Know About Dynamic Taint Analysis & Forward Symbolic Execution (but might have been afraid to ask) Edward J. Schwartz, Thanassis.
CMSC 202 Exceptions 2nd Lecture.
CMSC 202 Exceptions 2nd Lecture.
Coding Concepts (Basics)
Stacks Abstract Data Types (ADTs) Stacks
Exceptions 19-Feb-19.
CSC-682 Advanced Computer Security
CMSC 202 Exceptions 2nd Lecture.
Exceptions 25-Apr-19.
Exceptions 22-Apr-19.
Handling Exceptionally Sticky Problems
Exceptions 10-May-19.
rePLay: A Hardware Framework for Dynamic Optimization
Exceptions 5-Jul-19.
Vulnerability in an Android App I Found last November - Attack and Countermeasure - Ken Okuyama Sony Digital Network Applications.
CMSC 202 Exceptions 2nd Lecture.
The Heartbleed Bug and Attack
Presentation transcript:

FlowTwist: Efficient Context-Sensitive Inside-Out Taint Analysis for Large Codebases Johannes Lerch, Ben Hermann, Eric Bodden, and Mira Mezini {lastname}@cs.tu-darmstadt.de https://github.com/johanneslerch/FlowTwist @stg_darmstadt 30. November 2018 | Software Technology Group

Oracle pushed out new Java update to patch security holes Released Friday, the latest critical patch update contains fixes for 50 different security flaws. Feb 04, 2013 Java flaw draws Web attacks, reports say A vulnerability in the Java software has the potential to affect a wide swath of computer users, and researchers warn that it‘s already being exploited “in the wild”. Jan 10, 2013 Oracle patches Java 7 vulnerability Breaking its quarterly update schedule, Oracle has released a new Java runtime that addresses recent security flaws. Aug 30, 2012 New vulnerabilities found in latest Java update Following ist latest updates, more vulnerabilities have been uncovered in Oracle‘s Java 7 runtime. Aug 31, 2012 Oracle issues emergency Java update to patch vulnerabilities After hackers attack a new flaw in Java, “Oracle decided to release a fix for this vulnerability and another closely related bug as soon as possible”. Mar 04, 2013 Oracle releases software update to fix Java vulnerability Emergency software update repairs vulnerability that could allow remote attackers to execute arbitrary code. Jan 13, 2013 In August 2012 we could read about Java vulnerabilities And the day after and this kept going on curious -> looked at vulnerability to understand, first concepts of security model A new Java vulnerability has surfaces that apparently affects all Java runtimes and therefore puts close to a billion users at risk. New Java flaw could hit 1 billion users Sep 26, 2012 Homeland Security still advises disabling Java, even after update DHS says an unpatched vulnerability may still put Web browsers using the plugin at risk of remote attack. Jan 14, 2013 30. November 2018 | Software Technology Group

Theory: Stack-based Access Control SecurityManager.checkPermission FilePermission, SocketPermission, ... SecurityManager.checkWrite FileOutputStream.<init> Attacker.doEvil Ø MyApplet.init Scenario: writing a file checkPermission call before writing 1) code has permissions 2) computes intersection checks should be done like this ∩ = Ø 30. November 2018 | Software Technology Group

Theory: Stack-based Access Control “ ” Reality: public static Class<?> forName(String className) throws ClassNotFoundException { return forName0(className, true, ClassLoader.getCallerClassLoader()); } Implicit Permission Check reality is different Example: Class.forName References to arbitrary classes sun.misc.Unsafe: copyMemory No permission check 1) implicit check through class loader 2) only immediate caller checked Class.forName Privileged ClassLoader Attacker.doEvil Unprivileged ClassLoader MyApplet.init 30. November 2018 | Software Technology Group

Leak in sun.beans.finder.ClassFinder (CVE-2012-4681) public static Class<?> findClass(String className) { try ClassLoader cl = ... ... return Class.forName(className, false, cl); } catch (ClassNotFoundException e) catch (SecurityException e) return Class.forName(className); throws SecurityException Introduced in Java 7 Retrieves ClassLoader -> passes to Class.forName 1) Check successful -> SecurityException 2) „handled“ Class.forName called “handled” here 30. November 2018 | Software Technology Group

Leak in sun.beans.finder.ClassFinder (CVE-2012-4681) public static Class<?> findClass(String className) { try ClassLoader cl = ... ... return Class.forName(className, false, cl); } catch (ClassNotFoundException e) catch (SecurityException e) return Class.forName(className); Class.forName Privileged ClassLoader ClassFinder.findClass Attacker.doEvil Unprivileged ClassLoader MyApplet.init throws SecurityException ClassFinder is checked “handled” here 30. November 2018 | Software Technology Group

Deriving the Static Program Analysis Problem Caller Sensitive Track the return value Private Method Class.forName Privileged ClassLoader ClassFinder.findClass Attacker.doEvil Unprivileged ClassLoader MyApplet.init Private Method 1 ignore attacker code 2 ignore (un-)privileged 3 any public method to caller sensitive 4 private methods 5 track parameter 6 track return value -> taint analysis problem Track the parameter Public Method 30. November 2018 | Software Technology Group

Two Independent Analyses Source Sink Caller Sensitive Track the return value Private Method Private Method Paramter 1) Return value Track the parameter Public Method Sink Source 30. November 2018 | Software Technology Group

Two Independent Analyses: Not Context-Sensitive Caller Sensitive Track the return value Private Method Private Method Private Method May result in false warnings Two analyses: not context-sensitive Track the parameter Public Method Public Method 30. November 2018 | Software Technology Group

Pure Forward Context-Sensitive Approach Caller Sensitive Private Method Private Method Private Method Pure forward Source & sink public method 1) Track return 2) Dont report Source Public Method Public Method Sink 30. November 2018 | Software Technology Group

Results – only Class.forName Executions with different max heap works 30. November 2018 | Software Technology Group

Results – all Caller Sensitive Methods Did not Terminate All caller sensitive methods 1) Did not terminate 30. November 2018 | Software Technology Group

Scale of the Problem Caller Sensitive Private Method Private Method Understand the scale of the problem Can we reduce something? 1) More public methods (one) 2) 45k more Public Method Public Method Public Method ~45,000 methods 30. November 2018 | Software Technology Group

Scale of the Problem 64 methods Private Method Caller Sensitive 3,656 call sites Private Method Private Method Private Method Private Method Private Method Private Method Called methods have to be analyzed 1) 64 caller sensitives; 3,500 call sites -> low chance to hit -> Idea: exploit this imbalance Public Method Public Method Public Method ~45,000 methods 30. November 2018 | Software Technology Group

Exploit Imbalance to Improve Scalability 64 methods Private Method Caller Sensitive Private Method 3,656 call sites Private Method Private Method Private Method Private Method Private Method Private Method Reverse Analysis Back to two analyses Higher hit chance for return value Not for parameter 1) reverse problem 2) not context-sensitive 3) Solve issue -> match results based on IFDS algorithm No path information Public Method Public Method Public Method ~45,000 methods 30. November 2018 | Software Technology Group

IFDS Algorithm [17,19] Reports Leaks Caller Sensitive ? Only outputs if there is a leak Extend IFDS algorithm Public Method 30. November 2018 | Software Technology Group

IFDS Algorithm: Computing Summaries foo(a) { b = a c = b return c } a {a} 1: 2: 3: a {a, b} a {a, b} computes summary edge for each method 1) initial edge to all start points 2) flow function 3) Concatenated edge 30. November 2018 | Software Technology Group

IFDS Algorithm: Computing Summaries foo(a) { b = a c = b return c } 1: 2: 3: a {a, b} a {a} b {b, c} a {a, b, c} 1) Concatenated edge 30. November 2018 | Software Technology Group

IFDS Algorithm: Computing Summaries foo(a) { b = a c = b return c } 1: 2: 3: a {a, b, c} Final summary Callers can immediately apply summary 30. November 2018 | Software Technology Group

Path Construction foo(a) { b = a c = b return c } pred(b) = a stmt(b) = #1 1: 2: 3: a {a, b} a {a} b {b, c} pred(c) = b stmt(c) = #2 a {a, b, c} 1) Store predecessor & stmt line 1 2) Store predecessor & stmt line 2 predecessor chain -> reconstruct path afterwards 30. November 2018 | Software Technology Group

Path Construction: Merge at Branches bar(a) { if (...) { b = a } else { return b pred(b1) = a stmt(b1) = #1 1: 2: 3: a {a, b1} pred(b2) = a stmt(b2) = #2 a {a, b2} Complicated for branches Different example 1) Summary edge & preds Decision at merge: keep both miss one branch --> evaluation a {a, b1, b2} 30. November 2018 | Software Technology Group

Results – only Class.forName Faster Less memory 30. November 2018 | Software Technology Group

Results – all Caller Sensitive Methods Did not Terminate Did not Terminate Did not terminate as well But: IFDS algorithm terminated Unable to enumerate all paths required to match results 30. November 2018 | Software Technology Group

Two Synchronized/Dependent Analyses Private Method Caller Sensitive Private Method Private Method Private Method Private Method Private Method Private Method Private Method Idea: synchronize analyses -> reduce amount of paths 1) initial seeds 2) pause edge 3) continue edge 4) call 5) context-sensitive return no pause -> balanced / unbalanced Public Method Public Method Public Method 30. November 2018 | Software Technology Group

Two Synchronized/Dependent Analyses Private Method Caller Sensitive Private Method Private Method Private Method Private Method Balanced Return Private Method Private Method Private Method As extension to IFDS algorithm Unbalanced Return Public Method Public Method Public Method 30. November 2018 | Software Technology Group

Results – only Class.forName Slightly faster than before 30. November 2018 | Software Technology Group

Results – all Caller Sensitive Methods Did not Terminate Did not Terminate Terminates! 30. November 2018 | Software Technology Group

Summary 1) Derived the analysis problem 2) Single analysis solution 3) two analyses may scale better 4) path construction for IFDS 5) synchronized analyses 6) evaluated 30. November 2018 | Software Technology Group