Compilation Cache builds up over time Boot times are faster Cache is built at first boot Rebooting device takes significantly longer Apps compiled when executed Stores Compiled Apps Consumes much more internal storage space Settings>Developer options>Select runtime
ID(gid) Gets own dedicated process and dedicated dalvik VM Applications are "self-signed" with certificate signed by Developer Apps can share the data with other apps using content providers Permissions determine the capacity for communication components The App Data gets stored in /data/data/<app process> accessible only by UID and GID (root exceptional)
APIs Access to content providers Inter- and intra-application communication Protection mechanism to interact with other applications Location (GPS), Camera, Bluetooth, Telephony, SMS/MMS, Network/data AndroidManifest.xml
some application to check permissions Disable automatic updates and check application permissions manually each time an application wants to be installed or updated
granted dangerous: Higher-Risk permission for access to private data. Requires user approval. SEND_SMS,ACCESS_FINE_LOCATION signature Matching signature key. Two apps signed with the same certificate system, signatureOrSystem:Same as signature, but also system apps pre- installed like Google Play Services
apps that request few permissions 33% apps request more permissions that they need Get Camera Pic need android.permission.CAMERA? ContentValues contentValues = new ContentValues(); contentValues.put(MediaStore.Images.Media.DESCRIPTION, "Image capture"); contentValues.put(MediaStore.Images.Media.TITLE, "new image"); Uri uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues); Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); intent.putExtra(MediaStore.EXTRA_OUTPUT, uri); intent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1); startActivityForResult(intent, 1);
a camera pic <uses-permission android:name="android.permission.CAMERA" /> Where is the permission? In the Google Camera Application GoogleCamera.apk
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="19" /> </manifest> $ adb shell $ pm set-install-location 2 0 [auto]: Let system decide the best location1 [internal]: Install on internal device storage2 [external]: Install on external media
during installation / upgrade • Review comments from users • Update the operating system and applications. • Disable automatic connection to WiFi networks and avoid connecting to free WiFi • Disable BlueTooth when not in use Recommendations to avoid malware
distinguish application authors Android won't allow application to be upgraded unless signed with same certificate the applications are signed with the same key. Android allows applications that are signed with the same certificate to run in the same processes All applications must be signed with a digital certificate
236 Sun Feb 02 15:08:10 CET 2014 javamail.pop3.provider X.509, CN=Android Debug, O=Android, C=US [certificate is valid from 3/04/13 18:13 to 27/03/43 17:13] 54226 Sun Feb 02 15:08:10 CET 2014 META-INF/MANIFEST.MF 54279 Sun Feb 02 15:08:10 CET 2014 META-INF/CERT.SF 1203 Sun Feb 02 15:08:10 CET 2014 META-INF/CERT.RSA s = signature was verified m = entry is listed in manifest k = at least one certificate was found in keystore i = at least one certificate was found in identity scope jar verified. Signing applications $ jarsigner -verify -certs -verbose testing.apk $ jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore mykeystore testing.apk <alias_name>
in Android to standardize access and manipulation of stored data Browser: bookmarks, browse history CallLog: missed calls, call details Contacts: Contact details MediaStore: Media files
be limited to your own application or exported to allow access by other applications. android:exported =“false" android:exported ="true" Versions >= 4.2 exported=“false” by default <provider android:name=".data.DataProvider" android:multiprocess="true" android:authorities="myapp.data.DataProvider" android:readPermission="myapp.permission.READ" android:writePermission="myapp.permission.WRITE" />
android.permission.WRITE_EXTERNAL_STORAGE Internal storage Better than external since permissions not required Sqlite3 File DataBase with extension *.db stored in /data/data/[package_name]/databases Cloud Google Cloud Messaging(GCM) ROOT
/data/data/com.your.package/shared_prefs/preferences.xml Used by an application in order to save small sets of data for the application Storing sensitive information in shared preferences is not recommended Library for securing shared preferences Encrypt the key-value pairs AES symmetric key https://github.com/scottyab/secure-preferences ROOT
{ return sensitiveInformation; } } WebView webview = new WebView(this); setContentView(webview); webView.loadUrl("http://website.com"); webView.addJavascriptInterface(new WebAppInterface(this), "injectedObject"); Vulnerability in version 4.1.2(API 16) Jelly Bean in Cross-site scripting (XSS), Cross-site Request Forgery (CSRF) attacks With JavaScript and Java Reflection can access any of the public methods of the WebAppInterface setJavascriptEnabled(true);
they are not needed. Disable local file access. Restricts access to the app’s resource and asset directory. Prevent loading content from 3rd party hosts. Activate SSL in activity using HTTPS In 4.2 @JavascriptInterface method annotation for limit access methods from javascript. Avoid exposing protected data in javascript interface @JavascriptInterface public void method() { dostuff(); }
the entire device with AES 128. Based on dm-crypt implementation PBKDF2 algorithm for password Takes at Least 1 h for Encryption of Data. Denoted to reduce in performance.
public class * extends android.app.Activity -keep public class * extends android.app.Application -keep public class * extends android.app.Service -keep public class * extends android.content.BroadcastReceiver -keep public class * extends android.content.ContentProvider -keep public class * extends android.app.backup.BackupAgentHelper -keep public class * extends android.preference.Preference -keep public class com.android.vending.licensing.ILicensingService -keepclasseswithmembernames class * { native <methods>; } -keepclasseswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet); } -keepclasseswithmembernames class * { public <init>(android.content.Context, android.util.AttributeSet, int); } -keepclassmembers enum * { public static **[] values(); public static ** valueOf(java.lang.String); } -keep class * implements android.os.Parcelable { public static final android.os.Parcelable$Creator *; }
app, such as its network communication, the UI, but also its internal function calls and Java code that is executed. Emulates a few actions, such as user interaction, incoming calls and SMS messages, etc. - this will reveal most malicious intents of an app.