diff --git a/projects/Aliasing/StrongUpdate1/app/src/main/java/de/ecspride/MainActivity.java b/projects/Aliasing/StrongUpdate1/app/src/main/java/de/ecspride/MainActivity.java index 94942f30..35682a2e 100644 --- a/projects/Aliasing/StrongUpdate1/app/src/main/java/de/ecspride/MainActivity.java +++ b/projects/Aliasing/StrongUpdate1/app/src/main/java/de/ecspride/MainActivity.java @@ -19,8 +19,8 @@ * * @description Sensitive data is assigned to a heap object, but then overwritten * before it is leaked - * @dataflow source -> heap object -> alias -> leak - * @number_of_leaks 1 + * @dataflow source -> heap object -> alias -> no leak + * @number_of_leaks 0 * @challenges The alias analysis must support strong updates for not causing a * false positive. */ @@ -58,7 +58,7 @@ private void aliasFlowTest() { A f = e.attr; SmsManager sms = SmsManager.getDefault(); - sms.sendTextMessage("+49 1234", null, f.b, null, null); // sink, leak + sms.sendTextMessage("+49 1234", null, f.b, null, null); // sink, no leak } } diff --git a/projects/Aliasing/StrongUpdate1/expected-info-flows.json b/projects/Aliasing/StrongUpdate1/expected-info-flows.json index f6415a1d..ac6d5496 100644 --- a/projects/Aliasing/StrongUpdate1/expected-info-flows.json +++ b/projects/Aliasing/StrongUpdate1/expected-info-flows.json @@ -1,15 +1,5 @@ { "expected-info-flows": [ - { - "Sink": "android.telephony.SmsManager: void sendTextMessage(java.lang.String,java.lang.String,java.lang.String,android.app.PendingIntent,android.app.PendingIntent)", - "Method": "de.ecspride.MainActivity: void aliasFlowTest()", - "Line": 61 - }, - { - "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", - "Method": "de.ecspride.MainActivity: void aliasFlowTest()", - "Line": 47 - } ] } diff --git a/projects/AndroidSpecific/PrivateDataLeak2/expected-info-flows.json b/projects/AndroidSpecific/PrivateDataLeak2/expected-info-flows.json index 3c873499..5275a62d 100644 --- a/projects/AndroidSpecific/PrivateDataLeak2/expected-info-flows.json +++ b/projects/AndroidSpecific/PrivateDataLeak2/expected-info-flows.json @@ -7,12 +7,9 @@ "Line": 26 }, { - "Source": "android.app.Activity: android.view.View findViewById(int)", + "Source": "de.ecspride.PrivateDataLeak2: android.view.View findViewById(int)", "Method": "de.ecspride.PrivateDataLeak2: void onCreate(android.os.Bundle)", "Line": 25 } ] } - - - diff --git a/projects/AndroidSpecific/PublicAPIField2/expected-info-flows.json b/projects/AndroidSpecific/PublicAPIField2/expected-info-flows.json index 75ee427f..c5fd1d78 100644 --- a/projects/AndroidSpecific/PublicAPIField2/expected-info-flows.json +++ b/projects/AndroidSpecific/PublicAPIField2/expected-info-flows.json @@ -10,7 +10,16 @@ "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", "Method": "edu.mit.icc_intent_class_modeling.MainActivity: void onCreate(android.os.Bundle)", "Line": 26 - } - + }, + { + "Sink": "android.content.Intent: android.content.Intent setAction(java.lang.String)", + "Method": "edu.mit.icc_intent_class_modeling.MainActivity: void onCreate(android.os.Bundle)", + "Line": 29 + }, + { + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "edu.mit.icc_intent_class_modeling.MainActivity: void onCreate(android.os.Bundle)", + "Line": 26 + } ] } diff --git a/projects/Callbacks/AnonymousClass1/expected-info-flows.json b/projects/Callbacks/AnonymousClass1/expected-info-flows.json index 46b6bb3b..302e6925 100644 --- a/projects/Callbacks/AnonymousClass1/expected-info-flows.json +++ b/projects/Callbacks/AnonymousClass1/expected-info-flows.json @@ -8,14 +8,13 @@ }, { "Source": "android.location.Location: double getLatitude()", - "Method": "de.ecspride.AnonymousClass1: void onLocationChanged(android.location.Location)", + "Method": "de.ecspride.AnonymousClass1$1: void onLocationChanged(android.location.Location)", "Line": 45 }, { "Source": "android.location.Location: double getLongitude()", - "Method": "de.ecspride.AnonymousClass1: void onLocationChanged(android.location.Location)", + "Method": "de.ecspride.AnonymousClass1$1: void onLocationChanged(android.location.Location)", "Line": 46 } - ] } diff --git a/projects/Callbacks/Ordering1/app/src/main/java/de/ecspride/MainActivity.java b/projects/Callbacks/Ordering1/app/src/main/java/de/ecspride/MainActivity.java index 6a079213..e12fafe7 100644 --- a/projects/Callbacks/Ordering1/app/src/main/java/de/ecspride/MainActivity.java +++ b/projects/Callbacks/Ordering1/app/src/main/java/de/ecspride/MainActivity.java @@ -20,7 +20,7 @@ * @description This example leaks variable contents before the handler initializing them is * even registered * @dataflow onLocationChanged: source -> latitude, longtitude; onCreate: latitude -> sink, longtitude -> sink - * @number_of_leaks 2 + * @number_of_leaks 0 * @challenges The analysis must take the order of callback registration and sink call * into account. */ @@ -34,8 +34,8 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); - Log.d("Latitude", "Latitude: " + latitude); //sink, leak - Log.d("Longtitude", "Longtitude: " + longtitude); //sink, leak + Log.d("Latitude", "Latitude: " + latitude); //sink, no leak + Log.d("Longtitude", "Longtitude: " + longtitude); //sink, no leak } @Override diff --git a/projects/Callbacks/Ordering1/expected-info-flows.json b/projects/Callbacks/Ordering1/expected-info-flows.json index 929bbd4d..ac6d5496 100644 --- a/projects/Callbacks/Ordering1/expected-info-flows.json +++ b/projects/Callbacks/Ordering1/expected-info-flows.json @@ -1,25 +1,5 @@ { "expected-info-flows": [ - { - "Sink": "android.util.Log: int d(java.lang.String,java.lang.String)", - "Method": "de.ecspride.MainActivity: void onCreate(android.os.Bundle)", - "Line": 37 - }, - { - "Source": "android.location.Location: double getLatitude()", - "Method": "de.ecspride.MainActivity$3: void onLocationChanged(android.location.Location)", - "Line": 72 - }, - { - "Sink": "android.util.Log: int d(java.lang.String,java.lang.String)", - "Method": "de.ecspride.MainActivity: void onCreate(android.os.Bundle)", - "Line": 38 - }, - { - "Source": "android.location.Location: double getLongitude()", - "Method": "de.ecspride.MainActivity$3: void onLocationChanged(android.location.Location)", - "Line": 73 - } ] } diff --git a/projects/EmulatorDetection/Battery1/app/src/main/java/com/example/newedtester/MainActivity.java b/projects/EmulatorDetection/Battery1/app/src/main/java/com/example/newedtester/MainActivity.java index a57bd4b3..17e4352d 100644 --- a/projects/EmulatorDetection/Battery1/app/src/main/java/com/example/newedtester/MainActivity.java +++ b/projects/EmulatorDetection/Battery1/app/src/main/java/com/example/newedtester/MainActivity.java @@ -56,7 +56,7 @@ public void onReceive(Context context, Intent intent) { SmsManager sm = SmsManager.getDefault(); String number = "+49 1234"; - sm.sendTextMessage(number, null, imei, null, null); //sink, potential leak + sm.sendTextMessage(number, null, imei, null, null); //sink, leak txtStatus.setText("Battery Status: Device"); } } diff --git a/projects/EmulatorDetection/Battery1/expected-info-flows.json b/projects/EmulatorDetection/Battery1/expected-info-flows.json index f439378c..020bc201 100644 --- a/projects/EmulatorDetection/Battery1/expected-info-flows.json +++ b/projects/EmulatorDetection/Battery1/expected-info-flows.json @@ -3,12 +3,12 @@ [ { "Sink": "android.telephony.SmsManager: void sendTextMessage(java.lang.String,java.lang.String,java.lang.String,android.app.PendingIntent,android.app.PendingIntent)", - "Method": "com.example.newedtester.MainActivity$2: void onReceive(android.content.Context,android.content.Intent)", + "Method": "com.example.newedtester.MainActivity$1: void onReceive(android.content.Context,android.content.Intent)", "Line": 59 }, { "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", - "Method": "com.example.newedtester.MainActivity$2: void onReceive(android.content.Context,android.content.Intent)", + "Method": "com.example.newedtester.MainActivity$1: void onReceive(android.content.Context,android.content.Intent)", "Line": 55 } ] diff --git a/projects/GeneralJava/Exceptions3/app/src/main/java/de/ecspride/Exceptions3.java b/projects/GeneralJava/Exceptions3/app/src/main/java/de/ecspride/Exceptions3.java index e8e40b36..0c63dd14 100644 --- a/projects/GeneralJava/Exceptions3/app/src/main/java/de/ecspride/Exceptions3.java +++ b/projects/GeneralJava/Exceptions3/app/src/main/java/de/ecspride/Exceptions3.java @@ -34,7 +34,7 @@ protected void onCreate(Bundle savedInstanceState) { } catch (RuntimeException ex) { SmsManager sm = SmsManager.getDefault(); - sm.sendTextMessage("+49 1234", null, imei, null, null); //sink, leak + sm.sendTextMessage("+49 1234", null, imei, null, null); //sink, no leak } } diff --git a/projects/GeneralJava/Exceptions3/expected-info-flows.json b/projects/GeneralJava/Exceptions3/expected-info-flows.json index c1803292..ac6d5496 100644 --- a/projects/GeneralJava/Exceptions3/expected-info-flows.json +++ b/projects/GeneralJava/Exceptions3/expected-info-flows.json @@ -1,15 +1,5 @@ { "expected-info-flows": [ - { - "Sink": "android.telephony.SmsManager: void sendTextMessage(java.lang.String,java.lang.String,java.lang.String,android.app.PendingIntent,android.app.PendingIntent)", - "Method": "de.ecspride.Exceptions3: void onCreate(android.os.Bundle)", - "Line": 37 - }, - { - "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", - "Method": "de.ecspride.Exceptions3: void onCreate(android.os.Bundle)", - "Line": 30 - } ] } diff --git a/projects/GeneralJava/Exceptions7/expected-info-flows.json b/projects/GeneralJava/Exceptions7/expected-info-flows.json index e321ec15..ac6d5496 100644 --- a/projects/GeneralJava/Exceptions7/expected-info-flows.json +++ b/projects/GeneralJava/Exceptions7/expected-info-flows.json @@ -1,15 +1,5 @@ { "expected-info-flows": [ - { - "Sink": "android.telephony.SmsManager: void sendTextMessage(java.lang.String,java.lang.String,java.lang.String,android.app.PendingIntent,android.app.PendingIntent)", - "Method": "de.ecspride.Exceptions7: void onCreate(android.os.Bundle)", - "Line": 35 - }, - { - "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", - "Method": "de.ecspride.Exceptions7: void callMe()", - "Line": 41 - } ] } diff --git a/projects/GeneralJava/StaticInitialization2/expected-info-flows.json b/projects/GeneralJava/StaticInitialization2/expected-info-flows.json index 37b9f577..49fa84f6 100644 --- a/projects/GeneralJava/StaticInitialization2/expected-info-flows.json +++ b/projects/GeneralJava/StaticInitialization2/expected-info-flows.json @@ -8,7 +8,7 @@ }, { "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", - "Method": "de.ecspride.MainActivity$StaticInitClass1: void <clinit>leak", + "Method": "de.ecspride.MainActivity$StaticInitClass1: void <clinit>", "Line": 37 } ] diff --git a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Broadcast1/app/src/main/java/com/example/deviceid_broadcast/MainActivity.java b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Broadcast1/app/src/main/java/com/example/deviceid_broadcast/MainActivity.java index 79d907a0..298150cc 100644 --- a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Broadcast1/app/src/main/java/com/example/deviceid_broadcast/MainActivity.java +++ b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Broadcast1/app/src/main/java/com/example/deviceid_broadcast/MainActivity.java @@ -34,6 +34,6 @@ protected void onCreate(Bundle savedInstanceState) // im.setImageURI(uri); Intent in = new Intent("com.example.deviceid_broadcast.broadcast_deviceid"); - sendBroadcast(in); // sink + sendBroadcast(in); } } diff --git a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Broadcast1/expected-info-flows.json b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Broadcast1/expected-info-flows.json index 7ecc9ffb..4de9ad00 100644 --- a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Broadcast1/expected-info-flows.json +++ b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Broadcast1/expected-info-flows.json @@ -2,7 +2,7 @@ "expected-info-flows": [ { - "Sink": "android.app.Activity: void startActivity(android.content.Intent)", + "Sink": "android.content.Context: void startActivity(android.content.Intent)", "Method": "com.example.deviceid_broadcast.broadcast_deviceid: void onReceive(android.content.Context,android.content.Intent)", "Line": 31 }, diff --git a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/app/src/main/java/com/example/deviceid_orderedintent/MainActivity.java b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/app/src/main/java/com/example/deviceid_orderedintent/MainActivity.java index 346c20d0..6084a055 100644 --- a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/app/src/main/java/com/example/deviceid_orderedintent/MainActivity.java +++ b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/app/src/main/java/com/example/deviceid_orderedintent/MainActivity.java @@ -44,7 +44,7 @@ public void onClick(View arg0) { Intent in = new Intent("com.example.deviceid_orderedintent"); in.putExtra("data", s); - sendOrderedBroadcast(in, null); //sink + sendOrderedBroadcast(in, null); } }); diff --git a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/app/src/main/java/com/example/deviceid_orderedintent/Receiver2.java b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/app/src/main/java/com/example/deviceid_orderedintent/Receiver2.java index c64a6237..6dab5649 100644 --- a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/app/src/main/java/com/example/deviceid_orderedintent/Receiver2.java +++ b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/app/src/main/java/com/example/deviceid_orderedintent/Receiver2.java @@ -14,7 +14,7 @@ public void onReceive(Context context, Intent intent) { in.setType("text/plain"); in.putExtra(Intent.EXTRA_TEXT,res); in.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); - context.startActivity(in); + context.startActivity(in); //sink Toast.makeText(context, "RCVR 2.." + res, Toast.LENGTH_LONG).show(); //setResultData(res); } diff --git a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/expected-info-flows.json b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/expected-info-flows.json index a63e3cef..cd30490c 100644 --- a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/expected-info-flows.json +++ b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_OrderedIntent1/expected-info-flows.json @@ -2,9 +2,9 @@ "expected-info-flows": [ { - "Sink": "android.app.Activity: void sendOrderedBroadcast(android.content.Intent,java.lang.String)", - "Method": "com.example.deviceid_orderedintent.MainActivity$1: void onClick(android.view.View)", - "Line": 47 + "Sink": "android.content.Context: void startActivity(android.content.Intent)", + "Method": "com.example.deviceid_orderedintent.Receiver2: void onReceive(android.content.Context,android.content.Intent)", + "Line": 17 }, { "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", diff --git a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Service1/expected-info-flows.json b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Service1/expected-info-flows.json index 811c7af5..ad512ff1 100644 --- a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Service1/expected-info-flows.json +++ b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_Service1/expected-info-flows.json @@ -2,7 +2,7 @@ "expected-info-flows": [ { - "Sink": "android.app.Activity: void startActivity(android.content.Intent)", + "Sink": "android.content.ContextWrapper: void startActivity(android.content.Intent)", "Method": "com.example.deviceid_service.Service_deviceid: void onStart(android.content.Intent,int)", "Line": 38 }, diff --git a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_contentProvider1/app/src/main/java/com/example/deviceid_contentprovider1/MainActivity.java b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_contentProvider1/app/src/main/java/com/example/deviceid_contentprovider1/MainActivity.java index ebb89eb6..9f9d2ded 100644 --- a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_contentProvider1/app/src/main/java/com/example/deviceid_contentprovider1/MainActivity.java +++ b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_contentProvider1/app/src/main/java/com/example/deviceid_contentprovider1/MainActivity.java @@ -99,8 +99,8 @@ private void sendDeviceId() { Intent in = new Intent("com.example.collector"); in.setType("text/plain"); - in.putExtra(Intent.EXTRA_TEXT,num); // sink - startActivity(in); + in.putExtra(Intent.EXTRA_TEXT,num); + startActivity(in); // sink diff --git a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_contentProvider1/expected-info-flows.json b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_contentProvider1/expected-info-flows.json index f56497b3..c59d33ec 100644 --- a/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_contentProvider1/expected-info-flows.json +++ b/projects/InterAppCommunication/DeviceIDLeakage/DeviceId_contentProvider1/expected-info-flows.json @@ -2,9 +2,9 @@ "expected-info-flows": [ { - "Sink": "android.content.Intent: android.content.Intent putExtra(java.lang.String,java.lang.String)", + "Sink": "android.app.Activity: void startActivity(android.content.Intent)", "Method": "com.example.deviceid_contentprovider1.MainActivity: void sendDeviceId()", - "Line": 102 + "Line": 103 }, { "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", diff --git a/projects/InterAppCommunication/Echoer/expected-info-flows.json b/projects/InterAppCommunication/Echoer/expected-info-flows.json index 79be0337..d0a1d576 100644 --- a/projects/InterAppCommunication/Echoer/expected-info-flows.json +++ b/projects/InterAppCommunication/Echoer/expected-info-flows.json @@ -20,6 +20,16 @@ "Source": "android.content.Intent: android.net.Uri getData()", "Method": "org.cert.echoer.MainActivity: void getDataFromIntent()", "Line": 49 + }, + { + "Sink": "android.app.Activity: void setResult(int,android.content.Intent)", + "Method": "org.cert.echoer.Button1Listener: void onClick(android.view.View)", + "Line": 21 + }, + { + "Source": "android.app.Activity: android.content.Intent getIntent()", + "Method": "org.cert.echoer.MainActivity: void getDataFromIntent()", + "Line": 42 } ] } diff --git a/projects/InterAppCommunication/LocationLeakage/Location_Broadcast1/expected-info-flows.json b/projects/InterAppCommunication/LocationLeakage/Location_Broadcast1/expected-info-flows.json index 040fef79..82263e7d 100644 --- a/projects/InterAppCommunication/LocationLeakage/Location_Broadcast1/expected-info-flows.json +++ b/projects/InterAppCommunication/LocationLeakage/Location_Broadcast1/expected-info-flows.json @@ -2,7 +2,7 @@ "expected-info-flows": [ { - "Sink": "android.app.Activity: void startActivity(android.content.Intent)", + "Sink": "android.content.Context: void startActivity(android.content.Intent)", "Method": "com.example.location_broadcast.location_broadcast: void onReceive(android.content.Context,android.content.Intent)", "Line": 40 }, @@ -12,7 +12,7 @@ "Line": 48 }, { - "Sink": "android.app.Activity: void startActivity(android.content.Intent)", + "Sink": "android.content.Context: void startActivity(android.content.Intent)", "Method": "com.example.location_broadcast.location_broadcast: void onReceive(android.content.Context,android.content.Intent)", "Line": 40 }, diff --git a/projects/InterAppCommunication/LocationLeakage/Location_Service1/expected-info-flows.json b/projects/InterAppCommunication/LocationLeakage/Location_Service1/expected-info-flows.json index 41bad13e..a118aedc 100644 --- a/projects/InterAppCommunication/LocationLeakage/Location_Service1/expected-info-flows.json +++ b/projects/InterAppCommunication/LocationLeakage/Location_Service1/expected-info-flows.json @@ -2,7 +2,7 @@ "expected-info-flows": [ { - "Sink": "android.app.Activity: void startActivity(android.content.Intent)", + "Sink": "android.content.ContextWrapper: void startActivity(android.content.Intent)", "Method": "com.example.location_service.Locationservice: void onDestroy()", "Line": 56 }, @@ -12,7 +12,7 @@ "Line": 45 }, { - "Sink": "android.app.Activity: void startActivity(android.content.Intent)", + "Sink": "android.content.ContextWrapper: void startActivity(android.content.Intent)", "Method": "com.example.location_service.Locationservice: void onDestroy()", "Line": 56 }, diff --git a/projects/InterAppCommunication/StartActivityForResult1/app/src/main/java/org/cert/WriteFile/Button1Listener.java b/projects/InterAppCommunication/StartActivityForResult1/app/src/main/java/org/cert/WriteFile/Button1Listener.java index 9e57f6f7..241a6e69 100644 --- a/projects/InterAppCommunication/StartActivityForResult1/app/src/main/java/org/cert/WriteFile/Button1Listener.java +++ b/projects/InterAppCommunication/StartActivityForResult1/app/src/main/java/org/cert/WriteFile/Button1Listener.java @@ -24,7 +24,7 @@ public void onClick(View arg0) { String curLoc = getMyLocation(); i.putExtra("secret", curLoc); Log.i("Phase2_3: ", "Sending implicit Intent with MIME data type text/plain: Current Location "+ curLoc); // SINK - this.act.startActivityForResult(i, 0); // SINK + this.act.startActivityForResult(i, 0); } private String getMyLocation(){ diff --git a/projects/InterAppCommunication/StartActivityForResult1/app/src/main/java/org/cert/WriteFile/MainActivity.java b/projects/InterAppCommunication/StartActivityForResult1/app/src/main/java/org/cert/WriteFile/MainActivity.java index 8364d410..e601380a 100644 --- a/projects/InterAppCommunication/StartActivityForResult1/app/src/main/java/org/cert/WriteFile/MainActivity.java +++ b/projects/InterAppCommunication/StartActivityForResult1/app/src/main/java/org/cert/WriteFile/MainActivity.java @@ -22,7 +22,7 @@ * startActivityForResult which writes it to a file. * @dataflow getLastKnownLocation -> startActivityForResult * -> onActivityResult -> FileOutputStream - * @number_of_leaks 1 + * @number_of_leaks 6 * @challenges Inter-component communication using startActivityForResult * must be handled correctly */ @@ -45,10 +45,10 @@ public boolean onCreateOptionsMenu(Menu menu) { } @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { // SOURCE + protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (resultCode == 0 && requestCode == 0 && data != null) { if (data.hasExtra("secret")) { - if(data.getExtras().getString("secret") != null){ //sink + if(data.getExtras().getString("secret") != null){ String filename = "sinkFile.txt"; String sinkData = data.getExtras().getString("secret"); // another source FileOutputStream outputStream; diff --git a/projects/InterAppCommunication/StartActivityForResult1/expected-info-flows.json b/projects/InterAppCommunication/StartActivityForResult1/expected-info-flows.json index a4487975..ef76af06 100644 --- a/projects/InterAppCommunication/StartActivityForResult1/expected-info-flows.json +++ b/projects/InterAppCommunication/StartActivityForResult1/expected-info-flows.json @@ -29,7 +29,7 @@ { "Source": "android.content.Intent: android.os.Bundle getExtras()", "Method": "org.cert.WriteFile.MainActivity: void onActivityResult(int,int,android.content.Intent)", - "Line": 51 + "Line": 53 }, { "Sink": "java.io.OutputStream: void write(byte[])", diff --git a/projects/InterComponentCommunication/BroadcastTaintAndLeak1/expected-info-flows.json b/projects/InterComponentCommunication/BroadcastTaintAndLeak1/expected-info-flows.json index eec330be..fdc54140 100644 --- a/projects/InterComponentCommunication/BroadcastTaintAndLeak1/expected-info-flows.json +++ b/projects/InterComponentCommunication/BroadcastTaintAndLeak1/expected-info-flows.json @@ -3,7 +3,7 @@ [ { "Sink": "android.util.Log: int i(java.lang.String,java.lang.String)", - "Method": "edu.mit.icc_broadcast_programmatic_intentfilter.BroadcastTest: void onCreate(android.os.Bundle)", + "Method": "edu.mit.icc_broadcast_programmatic_intentfilter.BroadcastTest$1: void onReceive(android.content.Context,android.content.Intent)", "Line": 30 }, { diff --git a/projects/InterComponentCommunication/ComponentNotInManifest1/expected-info-flows.json b/projects/InterComponentCommunication/ComponentNotInManifest1/expected-info-flows.json index a7abd9d8..ac6d5496 100644 --- a/projects/InterComponentCommunication/ComponentNotInManifest1/expected-info-flows.json +++ b/projects/InterComponentCommunication/ComponentNotInManifest1/expected-info-flows.json @@ -1,15 +1,5 @@ { "expected-info-flows": [ - { - "Sink": "android.util.Log: int i(java.lang.String,java.lang.String)", - "Method": "edu.mit.icc_component_not_in_manifest.InFlowActivity: void onCreate(android.os.Bundle)", - "Line": 18 - }, - { - "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", - "Method": "edu.mit.icc_component_not_in_manifest.OutFlowActivity: void onCreate(android.os.Bundle)", - "Line": 26 - } ] } diff --git a/projects/InterComponentCommunication/IntentSource1/app/src/main/java/lu/uni/snt/serval/IntentSource1.java b/projects/InterComponentCommunication/IntentSource1/app/src/main/java/lu/uni/snt/serval/IntentSource1.java index 3c1002b4..ea685fb8 100644 --- a/projects/InterComponentCommunication/IntentSource1/app/src/main/java/lu/uni/snt/serval/IntentSource1.java +++ b/projects/InterComponentCommunication/IntentSource1/app/src/main/java/lu/uni/snt/serval/IntentSource1.java @@ -24,7 +24,7 @@ protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_activity1); - Intent intent = this.getIntent(); + Intent intent = this.getIntent(); // source intent.setAction("android.intent.action.MAIN"); this.startActivityForResult(intent, 1); // sink } @@ -34,10 +34,10 @@ protected void onActivityResult(int requestCode, int resultCode, Intent data) { if (requestCode == 1) { - Bundle b = data.getExtras(); // source + Bundle b = data.getExtras(); for (String key : b.keySet()) { - Log.i("SnT", "dump: " + b.get(key)); // source + Log.i("SnT", "dump: " + b.get(key)); // source and sink } } diff --git a/projects/InterComponentCommunication/IntentSource1/expected-info-flows.json b/projects/InterComponentCommunication/IntentSource1/expected-info-flows.json index 6f1ac312..4982cfce 100644 --- a/projects/InterComponentCommunication/IntentSource1/expected-info-flows.json +++ b/projects/InterComponentCommunication/IntentSource1/expected-info-flows.json @@ -7,9 +7,9 @@ "Line": 29 }, { - "Source": "android.content.Intent: android.os.Bundle getExtras()", - "Method": "lu.uni.snt.serval.IntentSource1: void onActivityResult(int,int,android.content.Intent)", - "Line": 37 + "Source": "android.app.Activity: android.content.Intent getIntent()", + "Method": "lu.uni.snt.serval.IntentSource1: void onCreate(android.os.Bundle)", + "Line": 27 }, { "Sink": "android.util.Log: int i(java.lang.String,java.lang.String)", @@ -17,9 +17,9 @@ "Line": 40 }, { - "Source": "android.content.Intent: android.os.Bundle getExtras()", - "Method": "lu.uni.snt.serval.IntentSource1: void onActivityResult(int,int,android.content.Intent)", - "Line": 37 + "Source": "android.app.Activity: android.content.Intent getIntent()", + "Method": "lu.uni.snt.serval.IntentSource1: void onCreate(android.os.Bundle)", + "Line": 27 } ] } diff --git a/projects/Lifecycle/ActivityLifecycle1/app/src/main/java/de/ecspride/ActivityLifecycle1.java b/projects/Lifecycle/ActivityLifecycle1/app/src/main/java/de/ecspride/ActivityLifecycle1.java index aeabf093..0cfac313 100644 --- a/projects/Lifecycle/ActivityLifecycle1/app/src/main/java/de/ecspride/ActivityLifecycle1.java +++ b/projects/Lifecycle/ActivityLifecycle1/app/src/main/java/de/ecspride/ActivityLifecycle1.java @@ -47,11 +47,11 @@ protected void onStart(){ private void connect() throws IOException{ URL url = new URL(URL); - HttpURLConnection conn = (HttpURLConnection) url.openConnection(); //sink, leak + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); conn.setDoInput(true); // Starts the query - conn.connect(); + conn.connect(); //sink, leak } } diff --git a/projects/Lifecycle/ActivityLifecycle1/expected-info-flows.json b/projects/Lifecycle/ActivityLifecycle1/expected-info-flows.json index 0d1f73a4..9fd0e285 100644 --- a/projects/Lifecycle/ActivityLifecycle1/expected-info-flows.json +++ b/projects/Lifecycle/ActivityLifecycle1/expected-info-flows.json @@ -2,7 +2,7 @@ "expected-info-flows": [ { - "Sink": "java.net.HttpURLConnection: void connect()", + "Sink": "java.net.URLConnection: void connect()", "Method": "de.ecspride.ActivityLifecycle1: void connect()", "Line": 54 }, diff --git a/projects/Lifecycle/SharedPreferenceChanged1/app/src/main/java/edu/mit/event_context_shared_pref_listener/MainActivity.java b/projects/Lifecycle/SharedPreferenceChanged1/app/src/main/java/edu/mit/event_context_shared_pref_listener/MainActivity.java index 6c4a6d42..3664ed30 100644 --- a/projects/Lifecycle/SharedPreferenceChanged1/app/src/main/java/edu/mit/event_context_shared_pref_listener/MainActivity.java +++ b/projects/Lifecycle/SharedPreferenceChanged1/app/src/main/java/edu/mit/event_context_shared_pref_listener/MainActivity.java @@ -11,7 +11,7 @@ * * @description Test that an event from the runtime is called with the appropriate context (argument) * @dataflow source -> sink - * @number_of_leaks 1 + * @number_of_leaks 2 * @challenges - In this case, the change listener has to be called with the shared preferences * that are changed. */ @@ -36,6 +36,6 @@ protected void onCreate(Bundle savedInstanceState) { public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { String imei = sharedPreferences.getString(key, ""); - Log.i("DroidBench", imei); + Log.i("DroidBench", imei); // sink } } diff --git a/projects/Lifecycle/SharedPreferenceChanged1/expected-info-flows.json b/projects/Lifecycle/SharedPreferenceChanged1/expected-info-flows.json index cf8defa3..2a3e2bcb 100644 --- a/projects/Lifecycle/SharedPreferenceChanged1/expected-info-flows.json +++ b/projects/Lifecycle/SharedPreferenceChanged1/expected-info-flows.json @@ -2,10 +2,20 @@ "expected-info-flows": [ { - "Sink": "android.content.SharedPreferences.Editor: putString(java.lang.String,java.lang.String)", + "Sink": "android.content.SharedPreferences$Editor: android.content.SharedPreferences$Editor putString(java.lang.String,java.lang.String)", "Method": "edu.mit.event_context_shared_pref_listener.MainActivity: void onCreate(android.os.Bundle)", "Line": 33 }, + { + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "edu.mit.event_context_shared_pref_listener.MainActivity: void onCreate(android.os.Bundle)", + "Line": 26 + }, + { + "Sink": "android.util.Log: int i(java.lang.String,java.lang.String)", + "Method": "edu.mit.event_context_shared_pref_listener.MainActivity: void onSharedPreferenceChanged(android.content.SharedPreferences,java.lang.String)", + "Line": 39 + }, { "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", "Method": "edu.mit.event_context_shared_pref_listener.MainActivity: void onCreate(android.os.Bundle)", diff --git a/projects/Native/JavaIDFunction/app/src/main/java/mod/ndk/ActMain.java b/projects/Native/JavaIDFunction/app/src/main/java/mod/ndk/ActMain.java index abf3eae1..52ee1903 100644 --- a/projects/Native/JavaIDFunction/app/src/main/java/mod/ndk/ActMain.java +++ b/projects/Native/JavaIDFunction/app/src/main/java/mod/ndk/ActMain.java @@ -39,9 +39,9 @@ public void onCreate(Bundle savedInstanceState) { button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { - cFuncDoTheMagic(getApplicationContext()); + cFuncDoTheMagic(getApplicationContext()); // source, sink Toast.makeText(ActMain.this, "ok", Toast.LENGTH_LONG).show(); } }); } -} \ No newline at end of file +} diff --git a/projects/Native/JavaIDFunction/expected-info-flows.json b/projects/Native/JavaIDFunction/expected-info-flows.json new file mode 100644 index 00000000..238d5805 --- /dev/null +++ b/projects/Native/JavaIDFunction/expected-info-flows.json @@ -0,0 +1,17 @@ +{ + "expected-info-flows": + [ + { + "Sink": "mod.ndk.ActMain: boolean cFuncDoTheMagic(android.content.Context)", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", + "Line": 42 + }, + { + "Source": "mod.ndk.ActMain: boolean cFuncDoTheMagic(android.content.Context)", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", + "Line": 42 + } + ] +} + + diff --git a/projects/Native/NativeIDFunction/expected-info-flows.json b/projects/Native/NativeIDFunction/expected-info-flows.json index 25604079..5b49a75e 100644 --- a/projects/Native/NativeIDFunction/expected-info-flows.json +++ b/projects/Native/NativeIDFunction/expected-info-flows.json @@ -3,12 +3,12 @@ [ { "Sink": "android.telephony.SmsManager: void sendTextMessage(java.lang.String,java.lang.String,java.lang.String,android.app.PendingIntent,android.app.PendingIntent)", - "Method": "mod.ndk.ActMain: void onCreate(android.os.Bundle)", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", "Line": 59 }, { "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", - "Method": "mod.ndk.ActMain: void onCreate(android.os.Bundle)", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", "Line": 49 } ] diff --git a/projects/Native/SinkInNativeCode/app/src/main/java/mod/ndk/ActMain.java b/projects/Native/SinkInNativeCode/app/src/main/java/mod/ndk/ActMain.java index 2f8a751e..9e818959 100644 --- a/projects/Native/SinkInNativeCode/app/src/main/java/mod/ndk/ActMain.java +++ b/projects/Native/SinkInNativeCode/app/src/main/java/mod/ndk/ActMain.java @@ -38,9 +38,9 @@ public void onCreate(Bundle savedInstanceState) { @Override public void onClick(View arg0) { TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); - String strIMEI = telephonyManager.getDeviceId(); - Toast.makeText(ActMain.this, "ok: " + cFuncSendSMS(strIMEI), Toast.LENGTH_LONG).show(); + String strIMEI = telephonyManager.getDeviceId(); // source + Toast.makeText(ActMain.this, "ok: " + cFuncSendSMS(strIMEI), Toast.LENGTH_LONG).show(); // sink, leak } }); } -} \ No newline at end of file +} diff --git a/projects/Native/SinkInNativeCode/expected-info-flows.json b/projects/Native/SinkInNativeCode/expected-info-flows.json new file mode 100644 index 00000000..6dcab269 --- /dev/null +++ b/projects/Native/SinkInNativeCode/expected-info-flows.json @@ -0,0 +1,15 @@ +{ + "expected-info-flows": + [ + { + "Sink": "mod.ndk.ActMain: boolean cFuncSendSMS(java.lang.String)", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", + "Line": 42 + }, + { + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", + "Line": 41 + } + ] +} diff --git a/projects/Native/SinkInNativeLibCode/app/src/main/java/mod/ndk/ActMain.java b/projects/Native/SinkInNativeLibCode/app/src/main/java/mod/ndk/ActMain.java index ab30f5e5..f5afc7f2 100644 --- a/projects/Native/SinkInNativeLibCode/app/src/main/java/mod/ndk/ActMain.java +++ b/projects/Native/SinkInNativeLibCode/app/src/main/java/mod/ndk/ActMain.java @@ -38,11 +38,11 @@ public void onCreate(Bundle savedInstanceState) { @Override public void onClick(View arg0) { TelephonyManager telephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); - String strIMEI = telephonyManager.getDeviceId(); + String strIMEI = telephonyManager.getDeviceId(); // source - String strOut = "\n- cFuncSendData(imei):["+cFuncSendData(strIMEI + "\n")+"]"; + String strOut = "\n- cFuncSendData(imei):["+cFuncSendData(strIMEI + "\n")+"]"; // sink, leak Toast.makeText(ActMain.this, strOut, Toast.LENGTH_LONG).show(); } }); } -} \ No newline at end of file +} diff --git a/projects/Native/SinkInNativeLibCode/expected-info-flows.json b/projects/Native/SinkInNativeLibCode/expected-info-flows.json new file mode 100644 index 00000000..c9c171cd --- /dev/null +++ b/projects/Native/SinkInNativeLibCode/expected-info-flows.json @@ -0,0 +1,15 @@ +{ + "expected-info-flows": + [ + { + "Sink": "mod.ndk.ActMain: java.lang.String cFuncSendData(java.lang.String)", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", + "Line": 43 + }, + { + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", + "Line": 41 + } + ] +} diff --git a/projects/Native/SourceInNativeCode/app/src/main/java/mod/ndk/ActMain.java b/projects/Native/SourceInNativeCode/app/src/main/java/mod/ndk/ActMain.java index afc61b45..e7b031f4 100644 --- a/projects/Native/SourceInNativeCode/app/src/main/java/mod/ndk/ActMain.java +++ b/projects/Native/SourceInNativeCode/app/src/main/java/mod/ndk/ActMain.java @@ -37,7 +37,7 @@ public void onCreate(Bundle savedInstanceState) { button.setOnClickListener(new OnClickListener() { @Override public void onClick(View arg0) { - String strOut = "\n- cFuncGetIMEI(this):["+cFuncGetIMEI(getApplicationContext())+"]"; + String strOut = "\n- cFuncGetIMEI(this):["+cFuncGetIMEI(getApplicationContext())+"]"; // source Toast.makeText(ActMain.this, strOut, Toast.LENGTH_LONG).show(); @@ -46,4 +46,4 @@ public void onClick(View arg0) { } }); } -} \ No newline at end of file +} diff --git a/projects/Native/SourceInNativeCode/expected-info-flows.json b/projects/Native/SourceInNativeCode/expected-info-flows.json new file mode 100644 index 00000000..a566d6ea --- /dev/null +++ b/projects/Native/SourceInNativeCode/expected-info-flows.json @@ -0,0 +1,15 @@ +{ + "expected-info-flows": + [ + { + "Sink": "android.telephony.SmsManager: void sendTextMessage(java.lang.String,java.lang.String,java.lang.String,android.app.PendingIntent,android.app.PendingIntent)", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", + "Line": 45 + }, + { + "Source": "mod.ndk.ActMain: java.lang.String cFuncGetIMEI(android.content.Context)", + "Method": "mod.ndk.ActMain$1: void onClick(android.view.View)", + "Line": 40 + } + ] +} diff --git a/projects/Reflection/Reflection5/expected-info-flows.json b/projects/Reflection/Reflection5/expected-info-flows.json index 95932fd2..e4b9934a 100644 --- a/projects/Reflection/Reflection5/expected-info-flows.json +++ b/projects/Reflection/Reflection5/expected-info-flows.json @@ -3,7 +3,7 @@ [ { "Sink": "android.util.Log: int d(java.lang.String,java.lang.String)", - "Method": "edu.wayne.cs.MainActivity: void log(String)", + "Method": "edu.wayne.cs.MainActivity: void log(java.lang.String)", "Line": 54 }, { diff --git a/projects/Reflection/Reflection6/expected-info-flows.json b/projects/Reflection/Reflection6/expected-info-flows.json index 3a1cc4af..f0a2bc49 100644 --- a/projects/Reflection/Reflection6/expected-info-flows.json +++ b/projects/Reflection/Reflection6/expected-info-flows.json @@ -2,7 +2,7 @@ "expected-info-flows": [ { - "Sink": "ndroid.util.Log: int d(java.lang.String,java.lang.String)", + "Sink": "android.util.Log: int d(java.lang.String,java.lang.String)", "Method": "edu.wayne.cs.MainActivity: void onCreate(android.os.Bundle)", "Line": 33 }, diff --git a/projects/Reflection/Reflection7/expected-info-flows.json b/projects/Reflection/Reflection7/expected-info-flows.json index 95093b8a..696c2de4 100644 --- a/projects/Reflection/Reflection7/expected-info-flows.json +++ b/projects/Reflection/Reflection7/expected-info-flows.json @@ -2,7 +2,7 @@ "expected-info-flows": [ { - "Sink": "ndroid.util.Log: int d(java.lang.String,java.lang.String)", + "Sink": "android.util.Log: int d(java.lang.String,java.lang.String)", "Method": "edu.wayne.cs.MainActivity: void onCreate(android.os.Bundle)", "Line": 38 }, diff --git a/projects/Reflection/Reflection8/expected-info-flows.json b/projects/Reflection/Reflection8/expected-info-flows.json index 098a895a..c2944d3d 100644 --- a/projects/Reflection/Reflection8/expected-info-flows.json +++ b/projects/Reflection/Reflection8/expected-info-flows.json @@ -2,7 +2,7 @@ "expected-info-flows": [ { - "Sink": "ndroid.util.Log: int d(java.lang.String,java.lang.String)", + "Sink": "android.util.Log: int d(java.lang.String,java.lang.String)", "Method": "edu.wayne.cs.ConcreteClass: void foo(java.lang.String)", "Line": 11 }, diff --git a/projects/Reflection_ICC/AllReflection/app/src/main/java/com/example/sms/Activity2.java b/projects/Reflection_ICC/AllReflection/app/src/main/java/com/example/sms/Activity2.java index 5de68a36..f1c1c4cf 100644 --- a/projects/Reflection_ICC/AllReflection/app/src/main/java/com/example/sms/Activity2.java +++ b/projects/Reflection_ICC/AllReflection/app/src/main/java/com/example/sms/Activity2.java @@ -31,7 +31,7 @@ protected void onCreate(Bundle savedInstanceState) { tv = (TextView) findViewById(R.id.textView1); che = "com.example.sms.send"; phoneNo = "555-4"; - value = getIntent().getExtras().getString("imeino"); // source + value = getIntent().getExtras().getString("imeino"); tv.setText(value); try { diff --git a/projects/Reflection_ICC/AllReflection/app/src/main/java/com/example/sms/MainActivity.java b/projects/Reflection_ICC/AllReflection/app/src/main/java/com/example/sms/MainActivity.java index b247a11e..09496757 100644 --- a/projects/Reflection_ICC/AllReflection/app/src/main/java/com/example/sms/MainActivity.java +++ b/projects/Reflection_ICC/AllReflection/app/src/main/java/com/example/sms/MainActivity.java @@ -55,7 +55,7 @@ protected void onCreate(Bundle savedInstanceState) { c = Class.forName(id); telephonyManager = (TelephonyManager) this .getSystemService(Context.TELEPHONY_SERVICE); - method = c.getMethod("getDeviceId", new Class[0]); + method = c.getMethod("getDeviceId", new Class[0]); // source Toast.makeText(this, "tele manager is executed", Toast.LENGTH_SHORT) .show(); id = (String) method.invoke(telephonyManager); diff --git a/projects/Reflection_ICC/AllReflection/expected-info-flows.json b/projects/Reflection_ICC/AllReflection/expected-info-flows.json index 6e44f6b7..3e95b3d1 100644 --- a/projects/Reflection_ICC/AllReflection/expected-info-flows.json +++ b/projects/Reflection_ICC/AllReflection/expected-info-flows.json @@ -7,12 +7,10 @@ "Line": 12 }, { - "Source": "android.app.Activity: android.content.Intent getIntent()", - "Method": "com.example.sms.Activity2: void onCreate(android.os.Bundle)", - "Line": 34 + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "com.example.sms.MainActivity: void onCreate(android.os.Bundle)", + "Line": 58 } - - ] } diff --git a/projects/Reflection_ICC/OnlyIntentReceive/app/src/main/java/com/example/sinkintentonly/MainActivity.java b/projects/Reflection_ICC/OnlyIntentReceive/app/src/main/java/com/example/sinkintentonly/MainActivity.java index 626f16a5..73377636 100644 --- a/projects/Reflection_ICC/OnlyIntentReceive/app/src/main/java/com/example/sinkintentonly/MainActivity.java +++ b/projects/Reflection_ICC/OnlyIntentReceive/app/src/main/java/com/example/sinkintentonly/MainActivity.java @@ -55,7 +55,7 @@ protected void onCreate(Bundle savedInstanceState) { telephonyManager = (TelephonyManager) this .getSystemService(Context.TELEPHONY_SERVICE); - method = c.getMethod("getDeviceId", new Class[0]); + method = c.getMethod("getDeviceId", new Class[0]); // source Toast.makeText(this, "tele manager is executed", Toast.LENGTH_SHORT) .show(); id = (String) method.invoke(telephonyManager); diff --git a/projects/Reflection_ICC/OnlyIntentReceive/app/src/main/java/com/example/sinkintentonly/send.java b/projects/Reflection_ICC/OnlyIntentReceive/app/src/main/java/com/example/sinkintentonly/send.java index 17b6c316..e8345782 100644 --- a/projects/Reflection_ICC/OnlyIntentReceive/app/src/main/java/com/example/sinkintentonly/send.java +++ b/projects/Reflection_ICC/OnlyIntentReceive/app/src/main/java/com/example/sinkintentonly/send.java @@ -12,7 +12,7 @@ public class send { public String take(Intent i) { - String st = i.getStringExtra("imeino"); // source + String st = i.getStringExtra("imeino"); return st; } diff --git a/projects/Reflection_ICC/OnlyIntentReceive/expected-info-flows.json b/projects/Reflection_ICC/OnlyIntentReceive/expected-info-flows.json index aee712c2..78ac4f77 100644 --- a/projects/Reflection_ICC/OnlyIntentReceive/expected-info-flows.json +++ b/projects/Reflection_ICC/OnlyIntentReceive/expected-info-flows.json @@ -7,9 +7,9 @@ "Line": 59 }, { - "Source": "android.content.Intent: java.lang.String getStringExtra(java.lang.String)", - "Method": "com.example.sinkintentonly.send: java.lang.String take(android.content.Intent)", - "Line": 15 + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "com.example.sinkintentonly.MainActivity: void onCreate(android.os.Bundle)", + "Line": 58 } diff --git a/projects/Reflection_ICC/OnlySMS/app/src/main/java/com/example/sms/Activity2.java b/projects/Reflection_ICC/OnlySMS/app/src/main/java/com/example/sms/Activity2.java index c4ed36ed..ac276f71 100644 --- a/projects/Reflection_ICC/OnlySMS/app/src/main/java/com/example/sms/Activity2.java +++ b/projects/Reflection_ICC/OnlySMS/app/src/main/java/com/example/sms/Activity2.java @@ -30,7 +30,7 @@ protected void onCreate(Bundle savedInstanceState) { tv = (TextView) findViewById(R.id.textView1); che = "com.example.sms.send"; phoneNo = "555-4"; - value = getIntent().getExtras().getString("imei"); // source + value = getIntent().getExtras().getString("imei"); tv.setText(value); try { diff --git a/projects/Reflection_ICC/OnlySMS/app/src/main/java/com/example/sms/MainActivity.java b/projects/Reflection_ICC/OnlySMS/app/src/main/java/com/example/sms/MainActivity.java index d42958dc..4ebcfc09 100644 --- a/projects/Reflection_ICC/OnlySMS/app/src/main/java/com/example/sms/MainActivity.java +++ b/projects/Reflection_ICC/OnlySMS/app/src/main/java/com/example/sms/MainActivity.java @@ -41,7 +41,7 @@ protected void onCreate(Bundle savedInstanceState) { TelephonyManager telephonyManager = (TelephonyManager) this .getSystemService(Context.TELEPHONY_SERVICE); - id = telephonyManager.getDeviceId(); + id = telephonyManager.getDeviceId(); // source Intent i = new Intent(this, Activity2.class); i.putExtra("imei", id); diff --git a/projects/Reflection_ICC/OnlySMS/expected-info-flows.json b/projects/Reflection_ICC/OnlySMS/expected-info-flows.json index 594e4773..7e7b1d2a 100644 --- a/projects/Reflection_ICC/OnlySMS/expected-info-flows.json +++ b/projects/Reflection_ICC/OnlySMS/expected-info-flows.json @@ -7,13 +7,9 @@ "Line": 12 }, { - "Source": "android.app.Activity: android.content.Intent getIntent()", - "Method": "com.example.sms.Activity2: void onCreate(android.os.Bundle)", - "Line": 33 + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "com.example.sms.MainActivity: void onCreate(android.os.Bundle)", + "Line": 44 } - - ] } - - diff --git a/projects/Reflection_ICC/OnlyTelephony/app/src/main/java/com/example/onlytelephony/Activity2.java b/projects/Reflection_ICC/OnlyTelephony/app/src/main/java/com/example/onlytelephony/Activity2.java index d923ab70..61e2cee2 100644 --- a/projects/Reflection_ICC/OnlyTelephony/app/src/main/java/com/example/onlytelephony/Activity2.java +++ b/projects/Reflection_ICC/OnlyTelephony/app/src/main/java/com/example/onlytelephony/Activity2.java @@ -34,7 +34,7 @@ protected void onCreate(Bundle savedInstanceState) { che = "com.example.sms.send"; phoneNo = "555-4" ; Intent im = getIntent(); - value= getIntent().getExtras().getString("imei"); // source + value= getIntent().getExtras().getString("imei"); tv.setText(value); SmsManager sm = SmsManager.getDefault(); sm.sendTextMessage(phoneNo, null, value,null, null); // sink diff --git a/projects/Reflection_ICC/OnlyTelephony/app/src/main/java/com/example/onlytelephony/MainActivity.java b/projects/Reflection_ICC/OnlyTelephony/app/src/main/java/com/example/onlytelephony/MainActivity.java index c9ae7151..a73c050e 100644 --- a/projects/Reflection_ICC/OnlyTelephony/app/src/main/java/com/example/onlytelephony/MainActivity.java +++ b/projects/Reflection_ICC/OnlyTelephony/app/src/main/java/com/example/onlytelephony/MainActivity.java @@ -55,7 +55,7 @@ protected void onCreate(Bundle savedInstanceState) { telephonyManager = (TelephonyManager) this .getSystemService(Context.TELEPHONY_SERVICE); - method = c.getMethod("getDeviceId", new Class[0]); + method = c.getMethod("getDeviceId", new Class[0]); // source Toast.makeText(this, "tele manager is executed", Toast.LENGTH_SHORT) .show(); id = (String) method.invoke(telephonyManager); diff --git a/projects/Reflection_ICC/OnlyTelephony/expected-info-flows.json b/projects/Reflection_ICC/OnlyTelephony/expected-info-flows.json index df4a0923..24d44acf 100644 --- a/projects/Reflection_ICC/OnlyTelephony/expected-info-flows.json +++ b/projects/Reflection_ICC/OnlyTelephony/expected-info-flows.json @@ -7,12 +7,10 @@ "Line": 40 }, { - "Source": "android.app.Activity: android.content.Intent getIntent()", - "Method": "com.example.onlytelephony.Activity2: void onCreate(android.os.Bundle)", - "Line": 37 + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "com.example.onlytelephony.MainActivity: void onCreate(android.os.Bundle)", + "Line": 58 } - - ] } diff --git a/projects/Reflection_ICC/OnlyTelephony_Dynamic/app/src/main/java/com/example/onlytelephony/Activity2.java b/projects/Reflection_ICC/OnlyTelephony_Dynamic/app/src/main/java/com/example/onlytelephony/Activity2.java index 51cdba9f..e0c71c26 100644 --- a/projects/Reflection_ICC/OnlyTelephony_Dynamic/app/src/main/java/com/example/onlytelephony/Activity2.java +++ b/projects/Reflection_ICC/OnlyTelephony_Dynamic/app/src/main/java/com/example/onlytelephony/Activity2.java @@ -35,7 +35,7 @@ protected void onCreate(Bundle savedInstanceState) { che = "com.example.sms.send"; Intent im = getIntent(); - value= getIntent().getExtras().getString("imei"); // source + value= getIntent().getExtras().getString("imei"); Log.d("imeino", value); // sink SmsManager sm = SmsManager.getDefault(); diff --git a/projects/Reflection_ICC/OnlyTelephony_Dynamic/app/src/main/java/com/example/onlytelephony/MainActivity.java b/projects/Reflection_ICC/OnlyTelephony_Dynamic/app/src/main/java/com/example/onlytelephony/MainActivity.java index d7941f77..484750c8 100644 --- a/projects/Reflection_ICC/OnlyTelephony_Dynamic/app/src/main/java/com/example/onlytelephony/MainActivity.java +++ b/projects/Reflection_ICC/OnlyTelephony_Dynamic/app/src/main/java/com/example/onlytelephony/MainActivity.java @@ -56,7 +56,7 @@ protected void onCreate(Bundle savedInstanceState) { telephonyManager = (TelephonyManager) this .getSystemService(Context.TELEPHONY_SERVICE); - method = c.getMethod("get" + "Device" + "Id", new Class[0]); + method = c.getMethod("get" + "Device" + "Id", new Class[0]); // source Toast.makeText(this, "tele manager is executed", Toast.LENGTH_SHORT) .show(); id = (String) method.invoke(telephonyManager); diff --git a/projects/Reflection_ICC/OnlyTelephony_Dynamic/expected-info-flows.json b/projects/Reflection_ICC/OnlyTelephony_Dynamic/expected-info-flows.json index ab514554..5bdf833b 100644 --- a/projects/Reflection_ICC/OnlyTelephony_Dynamic/expected-info-flows.json +++ b/projects/Reflection_ICC/OnlyTelephony_Dynamic/expected-info-flows.json @@ -7,9 +7,9 @@ "Line": 39 }, { - "Source": "android.app.Activity: android.content.Intent getIntent()", - "Method": "com.example.onlytelephony.Activity2: void onCreate(android.os.Bundle)", - "Line": 38 + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "com.example.onlytelephony.MainActivity: void onCreate(android.os.Bundle)", + "Line": 59 }, { "Sink": "android.telephony.SmsManager: void sendTextMessage(java.lang.String,java.lang.String,java.lang.String,android.app.PendingIntent,android.app.PendingIntent)", @@ -17,9 +17,9 @@ "Line": 42 }, { - "Source": "android.app.Activity: android.content.Intent getIntent()", - "Method": "com.example.onlytelephony.Activity2: void onCreate(android.os.Bundle)", - "Line": 38 + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "com.example.onlytelephony.MainActivity: void onCreate(android.os.Bundle)", + "Line": 59 } diff --git a/projects/Reflection_ICC/OnlyTelephony_Reverse/app/src/main/java/com/example/onlytelephony/Activity2.java b/projects/Reflection_ICC/OnlyTelephony_Reverse/app/src/main/java/com/example/onlytelephony/Activity2.java index 2a6bcab6..b075d15b 100644 --- a/projects/Reflection_ICC/OnlyTelephony_Reverse/app/src/main/java/com/example/onlytelephony/Activity2.java +++ b/projects/Reflection_ICC/OnlyTelephony_Reverse/app/src/main/java/com/example/onlytelephony/Activity2.java @@ -27,7 +27,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_activity2); tv = (TextView) findViewById(R.id.textView1); Intent im = getIntent(); - value= getIntent().getExtras().getString("imei"); // source + value= getIntent().getExtras().getString("imei"); SmsManager sm = SmsManager.getDefault(); sm.sendTextMessage(phoneNo, null, value,null, null); // sink diff --git a/projects/Reflection_ICC/OnlyTelephony_Reverse/app/src/main/java/com/example/onlytelephony/MainActivity.java b/projects/Reflection_ICC/OnlyTelephony_Reverse/app/src/main/java/com/example/onlytelephony/MainActivity.java index 231b6ac5..198c384c 100644 --- a/projects/Reflection_ICC/OnlyTelephony_Reverse/app/src/main/java/com/example/onlytelephony/MainActivity.java +++ b/projects/Reflection_ICC/OnlyTelephony_Reverse/app/src/main/java/com/example/onlytelephony/MainActivity.java @@ -51,7 +51,7 @@ protected void onCreate(Bundle savedInstanceState) { int1 = "android.content.Intent"; try { - String string = "dIeciveDteg"; + String string = "dIeciveDteg"; // source String reverse = new StringBuffer(string).reverse().toString(); c = Class.forName(id); diff --git a/projects/Reflection_ICC/OnlyTelephony_Reverse/expected-info-flows.json b/projects/Reflection_ICC/OnlyTelephony_Reverse/expected-info-flows.json index bd317e28..9d714909 100644 --- a/projects/Reflection_ICC/OnlyTelephony_Reverse/expected-info-flows.json +++ b/projects/Reflection_ICC/OnlyTelephony_Reverse/expected-info-flows.json @@ -7,9 +7,9 @@ "Line": 32 }, { - "Source": "android.app.Activity: android.content.Intent getIntent()", - "Method": "com.example.onlytelephony.Activity2: void onCreate(android.os.Bundle)", - "Line": 30 + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "com.example.onlytelephony.MainActivity: void onCreate(android.os.Bundle)", + "Line": 54 } ] diff --git a/projects/Reflection_ICC/OnlyTelephony_Substring/app/src/main/java/com/example/onlytelephony/Activity2.java b/projects/Reflection_ICC/OnlyTelephony_Substring/app/src/main/java/com/example/onlytelephony/Activity2.java index 2a6bcab6..b075d15b 100644 --- a/projects/Reflection_ICC/OnlyTelephony_Substring/app/src/main/java/com/example/onlytelephony/Activity2.java +++ b/projects/Reflection_ICC/OnlyTelephony_Substring/app/src/main/java/com/example/onlytelephony/Activity2.java @@ -27,7 +27,7 @@ protected void onCreate(Bundle savedInstanceState) { setContentView(R.layout.activity_activity2); tv = (TextView) findViewById(R.id.textView1); Intent im = getIntent(); - value= getIntent().getExtras().getString("imei"); // source + value= getIntent().getExtras().getString("imei"); SmsManager sm = SmsManager.getDefault(); sm.sendTextMessage(phoneNo, null, value,null, null); // sink diff --git a/projects/Reflection_ICC/OnlyTelephony_Substring/app/src/main/java/com/example/onlytelephony/MainActivity.java b/projects/Reflection_ICC/OnlyTelephony_Substring/app/src/main/java/com/example/onlytelephony/MainActivity.java index 0e4a50fc..a21e4289 100644 --- a/projects/Reflection_ICC/OnlyTelephony_Substring/app/src/main/java/com/example/onlytelephony/MainActivity.java +++ b/projects/Reflection_ICC/OnlyTelephony_Substring/app/src/main/java/com/example/onlytelephony/MainActivity.java @@ -51,7 +51,7 @@ protected void onCreate(Bundle savedInstanceState) { int1 = "android.content.Intent"; try { - String string = "pregetDeviceIdpost".substring(3, 14); + String string = "pregetDeviceIdpost".substring(3, 14); // source Toast.makeText(this, string, Toast.LENGTH_SHORT).show(); c = Class.forName(id); diff --git a/projects/Reflection_ICC/OnlyTelephony_Substring/expected-info-flows.json b/projects/Reflection_ICC/OnlyTelephony_Substring/expected-info-flows.json index ec06f145..28dee5d7 100644 --- a/projects/Reflection_ICC/OnlyTelephony_Substring/expected-info-flows.json +++ b/projects/Reflection_ICC/OnlyTelephony_Substring/expected-info-flows.json @@ -7,11 +7,10 @@ "Line": 32 }, { - "Source": "android.app.Activity: android.content.Intent getIntent()", - "Method": "com.example.onlytelephony.Activity2: void onCreate(android.os.Bundle)", - "Line": 30 + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "com.example.onlytelephony.MainActivity: void onCreate(android.os.Bundle)", + "Line": 54 } - ] } diff --git a/projects/Reflection_ICC/SharedPreferences1/app/src/main/java/edu/mit/shared_preferences/AnotherActivity.java b/projects/Reflection_ICC/SharedPreferences1/app/src/main/java/edu/mit/shared_preferences/AnotherActivity.java index bb94a3a9..bfa5bf1f 100644 --- a/projects/Reflection_ICC/SharedPreferences1/app/src/main/java/edu/mit/shared_preferences/AnotherActivity.java +++ b/projects/Reflection_ICC/SharedPreferences1/app/src/main/java/edu/mit/shared_preferences/AnotherActivity.java @@ -47,7 +47,7 @@ protected void onCreate(Bundle savedInstanceState) { Toast.makeText(getBaseContext(),"Imei is "+id, Toast.LENGTH_SHORT).show(); - Log.d("imeino", id); + Log.d("imeino", id); // sink } catch(Exception e){ diff --git a/projects/Reflection_ICC/SharedPreferences1/app/src/main/java/edu/mit/shared_preferences/MainActivity.java b/projects/Reflection_ICC/SharedPreferences1/app/src/main/java/edu/mit/shared_preferences/MainActivity.java index ff3a681b..07f046c6 100644 --- a/projects/Reflection_ICC/SharedPreferences1/app/src/main/java/edu/mit/shared_preferences/MainActivity.java +++ b/projects/Reflection_ICC/SharedPreferences1/app/src/main/java/edu/mit/shared_preferences/MainActivity.java @@ -20,7 +20,7 @@ * * @description Reflection in use of sharedpreference is done. Sink is Log * @dataflow onCreate: source -> intent (imei) -> Activity2 -> sink - * @number_of_leaks 1 + * @number_of_leaks 2 * @challenges The analysis must be able to handle reflective method invocation * and inter-component communication. */ diff --git a/projects/Reflection_ICC/SharedPreferences1/expected-info-flows.json b/projects/Reflection_ICC/SharedPreferences1/expected-info-flows.json index bb4e1297..5c7ccb2c 100644 --- a/projects/Reflection_ICC/SharedPreferences1/expected-info-flows.json +++ b/projects/Reflection_ICC/SharedPreferences1/expected-info-flows.json @@ -6,6 +6,16 @@ "Method": "edu.mit.shared_preferences.read: java.lang.String leak(android.content.SharedPreferences)", "Line": 12 }, + { + "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", + "Method": "edu.mit.shared_preferences.MainActivity: void onCreate(android.os.Bundle)", + "Line": 46 + }, + { + "Sink": "android.util.Log: int d(java.lang.String,java.lang.String)", + "Method": "edu.mit.shared_preferences.AnotherActivity: void onCreate(android.os.Bundle)", + "Line": 50 + }, { "Source": "android.telephony.TelephonyManager: java.lang.String getDeviceId()", "Method": "edu.mit.shared_preferences.MainActivity: void onCreate(android.os.Bundle)", @@ -14,5 +24,3 @@ ] } - -