Modelgen:
Mining Explicit Information Flow Specifications from Concrete Executions
Lazaro Clapp, Saswat Anand, Alex Aiken
Stanford University
Modelgen: Mining Explicit Information Flow Specifications from - - PowerPoint PPT Presentation
Modelgen: Mining Explicit Information Flow Specifications from Concrete Executions Lazaro Clapp, Saswat Anand, Alex Aiken Stanford University I Why mine specifications? Whole-program static analysis Application Whole-program static
Mining Explicit Information Flow Specifications from Concrete Executions
Lazaro Clapp, Saswat Anand, Alex Aiken
Stanford University
Application
Application
Static Analysis
Malware? Bugs? Documentation
Application
Platform
(e.g. Android)
Application
Static Analysis
Platform
(e.g. Android)
Application
Static Analysis
Platform
(e.g. Android)
Application
Static Analysis
Platform
(e.g. Android)
Application
Static Analysis
Platform
(e.g. Android)
Application
Static Analysis
Platform
(e.g. Android)
Application
Static Analysis
Platform
(e.g. Android)
Application Platform
(e.g. Android) Static Analysis Under-approximation (Very) Unsound False negatives
Application Platform
(e.g. Android) Static Analysis Over-approximation (Very) Imprecise False positives
Application Platform
(e.g. Android)
* Our system (STAMP): Models for 1,116 methods, written over 2 years
Application Platform
(e.g. Android)
Application Platform
(e.g. Android)
dynamic analysis
Application Platform
(e.g. Android) Dynamic Analysis Specifications
Application Platform
(e.g. Android) Static Analysis Malware? Bugs? Documentation Dynamic Analysis Specifications
S.T.A.M.P. Static Analysis
#LOCATION -> ! INTERNET #CONTACTS -> ! INTERNET #PHONE_NUM -> !INTERNET
Information Flow Report Human Auditor
// Set-up
SocketChannel socket = ...; CharBuffer buffer = ...; CharsetEncoder encoder = ...; TelephonyManager tMgr = ...;
// Leak phone number // ( #PHONE_NUM -> !INTERNET ) String mPhoneNumber = tMgr.getLine1Number(); CharBuffer b1 = buffer.put(mPhoneNumber,0,10); ByteBuffer bytebuffer = encoder.encode(b1); socket.write(bytebuffer);
// Set-up
SocketChannel socket = ...; CharBuffer buffer = ...; CharsetEncoder encoder = ...; TelephonyManager tMgr = ...;
// Leak phone number // ( #PHONE_NUM -> !INTERNET ) String mPhoneNumber = tMgr.getLine1Number(); CharBuffer b1 = buffer.put(mPhoneNumber,0,10); ByteBuffer bytebuffer = encoder.encode(b1); socket.write(bytebuffer); #PHONE_NUM ->
// Set-up
SocketChannel socket = ...; CharBuffer buffer = ...; CharsetEncoder encoder = ...; TelephonyManager tMgr = ...;
// Leak phone number // ( #PHONE_NUM -> !INTERNET ) String mPhoneNumber = tMgr.getLine1Number(); CharBuffer b1 = buffer.put(mPhoneNumber,0,10); ByteBuffer bytebuffer = encoder.encode(b1); socket.write(bytebuffer); #PHONE_NUM -> ... -> ... -> ... -> !INTERNET
// Set-up
SocketChannel socket = ...; CharBuffer buffer = ...; CharsetEncoder encoder = ...; TelephonyManager tMgr = ...;
// Leak phone number // ( #PHONE_NUM -> !INTERNET ) String mPhoneNumber = tMgr.getLine1Number(); CharBuffer b1 = buffer.put(mPhoneNumber,0,10); ByteBuffer bytebuffer = encoder.encode(b1); socket.write(bytebuffer);
// Set-up
SocketChannel socket = ...; CharBuffer buffer = ...; CharsetEncoder encoder = ...; TelephonyManager tMgr = ...;
// Leak phone number // ( #PHONE_NUM -> !INTERNET ) String mPhoneNumber = tMgr.getLine1Number(); CharBuffer b1 = buffer.put(mPhoneNumber,0,10); ByteBuffer bytebuffer = encoder.encode(b1); socket.write(bytebuffer); TelephonyManager.getLine1Number() #PHONE_NUM -> return #PHONE_NUM -> mPhoneNumber
// Set-up
SocketChannel socket = ...; CharBuffer buffer = ...; CharsetEncoder encoder = ...; TelephonyManager tMgr = ...;
// Leak phone number // ( #PHONE_NUM -> !INTERNET ) String mPhoneNumber = tMgr.getLine1Number(); CharBuffer b1 = buffer.put(mPhoneNumber,0,10); ByteBuffer bytebuffer = encoder.encode(b1); socket.write(bytebuffer); TelephonyManager.getLine1Number() #PHONE_NUM -> return CharBuffer.put(String,int,int) arg#1 -> this arg#1 -> return this -> return #PHONE_NUM -> mPhoneNumber -> b1
// Set-up
SocketChannel socket = ...; CharBuffer buffer = ...; CharsetEncoder encoder = ...; TelephonyManager tMgr = ...;
// Leak phone number // ( #PHONE_NUM -> !INTERNET ) String mPhoneNumber = tMgr.getLine1Number(); CharBuffer b1 = buffer.put(mPhoneNumber,0,10); ByteBuffer bytebuffer = encoder.encode(b1); socket.write(bytebuffer); TelephonyManager.getLine1Number() #PHONE_NUM -> return CharBuffer.put(String,int,int) arg#1 -> this arg#1 -> return this -> return CharsetEncoder.encode(CharBuffer) arg#1 -> return #PHONE_NUM -> mPhoneNumber -> b1 -> bytebuffer
// Set-up
SocketChannel socket = ...; CharBuffer buffer = ...; CharsetEncoder encoder = ...; TelephonyManager tMgr = ...;
// Leak phone number // ( #PHONE_NUM -> !INTERNET ) String mPhoneNumber = tMgr.getLine1Number(); CharBuffer b1 = buffer.put(mPhoneNumber,0,10); ByteBuffer bytebuffer = encoder.encode(b1); socket.write(bytebuffer); TelephonyManager.getLine1Number() #PHONE_NUM -> return CharBuffer.put(String,int,int) arg#1 -> this arg#1 -> return this -> return CharsetEncoder.encode(CharBuffer) arg#1 -> return SocketChannel.write(ByteBuffer) arg#1 -> !INTERNET #PHONE_NUM -> mPhoneNumber -> b1 -> bytebuffer -> !INTERNET
Instrument Run Analyze
Instrument Run Analyze
Instrument Run Analyze
Instrument Run Analyze
Instrument Run Analyze
Definition:
Definition:
method entry and return.
Definition:
method entry and return.
t = arg1 ⊗ arg2
return o
Initialization
t = arg1 ⊗ arg2
return o
Initialization
t = arg1 ⊗ arg2
return o
Initialization
t = arg1 ⊗ arg2
return o
Initialization
t = arg1 ⊗ arg2
return o
Initialization
arg1->this
Spec:
arg2->this
t = arg1 ⊗ arg2
return o
Initialization
arg1->this
Spec:
arg2->this this->return
t = arg1 ⊗ arg2
return o
Initialization
arg1->this
Spec:
arg2->this this->return arg1->return arg2-> return
t = arg1 ⊗ arg2
return o
Initialization
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
ret = o . m ( arg1 , arg2 ) t
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
this <- arg2 this <- arg1
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
this <- arg2 this <- arg1
! : Information flow goes in the opposite direction
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
this <- arg2 this <- arg1
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
this <- arg2 this <- arg1
ret = o . m ( arg1 , arg2 )
t = arg1 ⊗ arg2
return o
Initialization
return <- arg1 return <- arg2 return <- this this <- arg2 this <- arg1
ret = o . m ( arg1 , arg2 )
Initialization
arg1->this
Spec:
arg2->this this->return arg1->return arg2-> return
r = max (arg1 , arg2 )
r = max ( 5 , 3 )
return <- arg1
Trace 1
r = max ( 5 , 3 )
return <- arg1
r = max ( 2 , 7 )
return <- arg2
Trace 1 Trace 1I
r = max ( 5 , 3 )
return <- arg1
r = max ( 2 , 7 )
return <- arg2
r = max (arg1 , arg2 )
return <- arg1 return <- arg2
Trace 1 Trace 1I
309 methods, 51 classes
309 methods, 51 classes 440 TP / 2 FP
99.55% Precision 99.63% Precision
540 TP / 2 FP
309 methods, 51 classes
96.36% Recall vs Manual
309 methods, 51 classes
97.12% Recall vs Total (TP) 79.14% Recall vs Total (TP)
3.08 flows (x app)
4.07 flows (x app)
3.08 flows (x app)
4.07 flows (x app)
Flows Apps
Flows Apps
Flows w/ Manual specs (TP+FP)
Flows Apps
Flows w/ Manual specs (TP+FP) New TP
Flows Apps
Flows w/ Manual specs (TP+FP) New TP New Unknown
Dynamic techniques for generating API specifications
2013
Dynamic / Static taint analysis
system for realtime privacy monitoring on smartphones. OSDI 2010
flow, field, object-sensitive and lifecycle-aware taint analysis for Android apps. PLDI 2014
https://bitbucket.org/lazaro_clapp/droidrecord
https://bitbucket.org/lazaro_clapp/droidrecord
Questions?