Engineering Mobile Security
Engineering Mobile Security
Engineering Mobile Security
Team
Threat models
Abstractions
3 security engineers
Threat models
Network attackers
startActivity(intent);
Malicious app
le scheme allows cross domain bypass in android webviews (old versions) Java => javascript bridges complicate matters
f = javascript:alert(1);
f = javascript:alert(1);
Content providers are not safe unless protected by a permission (older android versions) SQLLiteQueryBuilder is a SQL injection bug Permission stealing would compromise Content providers entirely
Secure wrapper, prevents permission stealing attacks from other applications Simple rule, instead of inheriting from ContentProvider inherit from SecureContentProvider This has prevented several bugs
Other apps can inspect app logs (in older android versions) Dynamically decides whether or not to enable logging Prevents unintentional logging
class BLog { public void d(tag, message); public void i(tag, message); }
Other apps can intercept implicit broadcasts, thus we need to safeguard them Simple rule: if you want a broadcast, use one of these These cover 99% of use cases, thus not reinventing the wheel Make it hard to get an unsafe broadcast receiver
Network threats
What causes MITM vulnerabilities?
SSLSocketFactory factory = SSLSocketFactory.getDefault(); SSLSocket socket = factory.getSocket(); socket.getInputStream();
Network threats
What causes MITM vulnerabilities?
deSslUrl(String uri) { uri.replace(https:, http:); }
Using different SSL stacks in different code paths Code that really really doesn t want to use https
Network threats
What causes MITM vulnerabilities?
Using different SSL stacks in different code paths Code that really really doesn t want to use https When we think of SSL. We need to make it faster and easier to use
Network threats
class SSLSocketFactoryHelper { getSocketFactory(); }
SSLSocketFactoryHelper makes SSL faster and secure One place to get SSL sockets Abstracts platform differences Enables features like session tickets, SNI in all android versions Certicate pinning and logging People naturally migrated
Network threats
SSLSocketFactoryHelper
Moving to SPDY reduces the overhead of SSL even further Better connection reuse
SPDY
Conceal
Existing libraries use memory and are slow. Conceal uses certain encryption algorithms from OpenSSL Made for Android, tries to manage memory usage. Faster than system provided libraries. Uses AES-GCM authenticated encryption.
Conceal
Were open sourcing it. You can use it to keep data safe. Not a general purpose crypto library.
http://facebook.github.io/conceal