Scalable and Precise Taint Analysis for Android
Wei Huang12, Yao Dong1, Ana Milanova1, Julian Dolby3
1Rensselaer Polytechnic Institute 2Google 3IBM Research
1
Scalable and Precise Taint Analysis for Android Wei Huang 12 , Yao - - PowerPoint PPT Presentation
Scalable and Precise Taint Analysis for Android Wei Huang 12 , Yao Dong 1 , Ana Milanova 1 , Julian Dolby 3 1 Rensselaer Polytechnic Institute 2 Google 3 IBM Research 1 Taint Analysis for Android Tracks flow of private data Controlled at
1Rensselaer Polytechnic Institute 2Google 3IBM Research
1
2
3
4
5
6
Unified Typing Rules Set-Based Solver Extract Best Typing Type Checking Parameters Instantiated Rules Set-based Solution Concrete Typing
Immutability (ReIm) Universe Types (UT) Ownership Types (OT) SFlow
DFlow
AJ EnerJ More?
Program Source
7
Annotated Libraries
8
9
(TWRITE) T ( ) ( ) ( ) : q q typeof q q q q
x y f x y f
x y f y.f x
(TREAD) ( ) ( ) ( ) : q q typeof q q q q
x y f y f x
x y f x y.f T (TCALL) ( ) ( ) ( ) ( ) , : : : ( )
i i i i
q q q typeof q q q q q q q q q q q q
x y z this p ret y this z p ret x
x y z m x y.m z T
10
public class Data { { p
y , t a i n t e d } String f; { s a f e , p
y , t a i n t e d } String get({ s a f e , p
y , t a i n t e d } Data this) {return this.f;} void set({ s a f e , p
y , t a i n t e d } Data this, { s a f e , p
y , t a i n t e d } String p) {this.f = p;} } public class FieldSensitivity3 { protected void onCreate(Bundle b) { { s a f e , p
y , t a i n t e d } Data dt = new Data(); { s a f e , p
y , t a i n t e d } String sim = tm.getSimSerialNumber(); // source dt.set(sim); { s a f e , p
y , t a i n t e d } String sg = dt.get(); sms.sendTextMessage(…,sg,…); // sink } }
11
public class Data { { p
y , t a i n t e d } String f; { s a f e , p
y , t a i n t e d } String get({ s a f e , p
y , t a i n t e d } Data this) {return this.f;} void set({ s a f e , p
y , t a i n t e d } Data this, { s a f e , p
y , t a i n t e d } String p) {this.f = p;} } public class FieldSensitivity3 { protected void onCreate(Bundle b) { { s a f e , p
y , t a i n t e d } Data dt = new Data(); { s a f e , p
y , t a i n t e d } String sim = tm.getSimSerialNumber(); // source dt.set(sim); { s a f e , p
y , t a i n t e d } String sg = dt.get(); sms.sendTextMessage(…,sg,…); // sink } } sg <: 𝑟 ⊳ safe
12
public class Data { { p
y , t a i n t e d} String f; { s a f e , p
y , t a i n t e d } String get({ s a f e , p
y , t a i n t e d } Data this) {return this.f;} void set({ s a f e , p
y , t a i n t e d } Data this, { s a f e , p
y , t a i n t e d } String p) {this.f = p;} } public class FieldSensitivity3 { protected void onCreate(Bundle b) { { s a f e, p
y , t a i n t e d } Data dt = new Data(); { s a f e, p
y , t a i n t e d } String sim = tm.getSimSerialNumber(); // source dt.set(sim); { s a f e , p
y , t a i n t e d } String sg = dt.get(); sms.sendTextMessage(…,sg,…); // sink } }
dt <: sg
13
14
]𝐠 ret
[𝐠 this
15
(𝟑 thisget
)𝟑 sg
16
(𝟓 p [𝐠 thisset )𝟓 dt (𝟑
]𝐠 retget )𝟑 sg sink
17
18
19
20
Library source:
Type library method as:
21
22
23
24
public class SmsReceiver extends BroadcastReceiver { public void onReceiver(Context c, Intent i) { tainted String s = …; // source Intent it = new Intent(c, TaskService.class); it.putExtra(“data”, s); startService(i); } } public class TaskService exennds Service { public void onStart(Intent it, int d) { String body = it.getSerializableExtra(“data”); list.add(body); Entity e = new UrlEncodedFormEntity(list, “UTF8”); post.setEntity(e); // sink } }
25
public class SmsReceiver extends BroadcastReceiver { public void onReceiver(Context c, Intent i) { tainted String s = …; // source TaskService_Intent it = new TaskService_Intent(); TaskService_Intent.data = s; // it.putExtra(“data”, s); startService(i); } } public class TaskService exennds Service { public void onStart(Intent it, int d) { String body = TaskService_Intent.data; // list.add(body); //it.getSerializableExtra(“data”); Entity e = new UrlEncodedFormEntity(list, “UTF8”); post.setEntity(e); // sink } }
26
27
28
29
30
Total Containing Sources/Sinks With Type Errors With Leaks to Network
31
32
source: getDeviceId r2
)i
ret r73 r75 r77
toString append
r12
toString
r277
append
ret List: r5 Iterator: r25 Object: r3
iterator
Sting: r28 (k p0
<init>URL: r30
sink: URL.openConnection
)j
r4
add next Method FiksuDeviceManager.getDeviceId Method EventUploader.buildURL Method EventUploader.uploadToTracking Method EventUploader.doUpload
33
200 400 600 800 1000 1200 1400 Running Time (sec) 139 average
34
35