72
Security Best Practices for Mobile Development Developer Track Tom Gersic, Model Metrics / Salesforce.com Director, Technical Solutions Twitter: @tomgersic

Security Best Practices for Mobile Development

Embed Size (px)

Citation preview

Page 1: Security Best Practices for Mobile Development

Security Best Practices for Mobile

Development

Developer Track

Tom Gersic, Model Metrics�/ Salesforce.com

Director, Technical Solutions

Twitter: @tomgersic

Page 2: Security Best Practices for Mobile Development

Safe Harbor

Safe harbor statement under the Private Securities Litigation Reform Act of 1995:

This presentation may contain forward-looking statements that involve risks, uncertainties, and assumptions. If any such uncertainties materialize or if

any of the assumptions proves incorrect, the results of salesforce.com, inc. could differ materially from the results expressed or implied by the forward-

looking statements we make. All statements other than statements of historical fact could be deemed forward-looking, including any projections of

product or service availability, subscriber growth, earnings, revenues, or other financial items and any statements regarding strategies or plans of

management for future operations, statements of belief, any statements concerning new, planned, or upgraded services or technology developments

and customer contracts or use of our services.

The risks and uncertainties referred to above include – but are not limited to – risks associated with developing and delivering new functionality for our

service, new products and services, our new business model, our past operating losses, possible fluctuations in our operating results and rate of growth,

interruptions or delays in our Web hosting, breach of our security measures, the outcome of intellectual property and other l itigation, risks associated

with possible mergers and acquisitions, the immature market in which we operate, our relatively limited operating history, our ability to expand, retain,

and motivate our employees and manage our growth, new releases of our service and successful customer deployment, our limited history reselling

non-salesforce.com products, and utilization and selling to larger enterprise customers. Further information on potential factors that could affect the

financial results of salesforce.com, inc. is included in our annual report on Form 10-Q for the most recent fiscal quarter ended July 31, 2012. This

documents and others containing important disclosures are available on the SEC Filings section of the Investor Information section of our Web site.

Any unreleased services or features referenced in this or other presentations, press releases or public statements are not currently available and may

not be delivered on time or at all. Customers who purchase our services should make the purchase decisions based upon features that are currently

available. Salesforce.com, inc. assumes no obligation and does not intend to update these forward-looking statements.

Page 3: Security Best Practices for Mobile Development

All about Model Metrics

Now a Salesforce.com Company

10 year track record - 2,000+ cloud engagements

Passionate & innovative World-class skills - CRM,

Force.com, Heroku, Radian6, Rypple, iOS and Android

In-house design studio – ModelFX

Mobile experts - iPhone, iPad and Android

Page 4: Security Best Practices for Mobile Development

Agenda

1. Fundamental Principles

2. What iOS and Android Share

3. iOS Specific Characteristics

4. Android Specific Characteristics

5. Salesforce Mobile Offerings

Page 5: Security Best Practices for Mobile Development

Throwing down the gauntlet…

Rules

1. Don’t break the phone or do

anything that might break it.

2. You need to be done before

Q&A starts.

3. If you are successful, you need

to tell us how you did it.

Page 6: Security Best Practices for Mobile Development

Who thinks the data on their phone is secure?

Page 7: Security Best Practices for Mobile Development

Welcome to Dreamforce 20.12 LTS (GNU)

Last login: Fri Sep 02 12:00:00 2011 from nat-

204-14-239-209-sfo.net.salesforce.com

@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES

Page 8: Security Best Practices for Mobile Development
Page 9: Security Best Practices for Mobile Development

Vulnerability

Page 10: Security Best Practices for Mobile Development

Threat

Page 11: Security Best Practices for Mobile Development

Consequence

Page 12: Security Best Practices for Mobile Development

Mitigation

Page 13: Security Best Practices for Mobile Development

Separation of Concerns – Principle of Least Privilege

Page 14: Security Best Practices for Mobile Development

Security Stack

Page 15: Security Best Practices for Mobile Development

Welcome to Dreamforce 20.12 LTS (GNU)

Last login: Fri Sep 02 12:00:00 2011 from nat-

204-14-239-209-sfo.net.salesforce.com

@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES

@tomgersic:~$ WHAT iOS AND ANDROID SHARE

Page 16: Security Best Practices for Mobile Development

Welcome to Dreamforce 20.12 LTS (GNU)

Last login: Fri Sep 02 12:00:00 2011 from nat-

204-14-239-209-sfo.net.salesforce.com

@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES

@tomgersic:~$ WHAT iOS AND ANDROID SHARE

device security

Page 17: Security Best Practices for Mobile Development

Mobile Device Management Providers

http://bit.ly/magicmdm

Page 18: Security Best Practices for Mobile Development

MDM Compliance

Page 19: Security Best Practices for Mobile Development

Welcome to Dreamforce 20.12 LTS (GNU)

Last login: Fri Sep 02 12:00:00 2011 from nat-

204-14-239-209-sfo.net.salesforce.com

@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES

@tomgersic:~$ WHAT iOS AND ANDROID SHARE

device security

OS / data security

Page 20: Security Best Practices for Mobile Development

Data Security – Hardware Encryption

Requires PIN/Passcode on both iOS and Android

Supported on

iPhone 3GS w/ iOS v4+ (AES 256 bit)

Android Honeycomb+ (AES 128 bit)

• Some manufacturers increase to AES 256 bit (Samsung SAFE)

SD Card encryption on Android is manufacturer specific.

Page 21: Security Best Practices for Mobile Development

Last login: Fri Sep 02 12:00:00 2011 from nat-

204-14-239-209-sfo.net.salesforce.com

@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES

@tomgersic:~$ WHAT iOS AND ANDROID SHARE

device security

OS / data security

OS / application security

Page 22: Security Best Practices for Mobile Development

Application Sandboxing

Page 23: Security Best Practices for Mobile Development

Application Signing

Page 24: Security Best Practices for Mobile Development

In-App Encryption

Page 25: Security Best Practices for Mobile Development

ASLR (PIE) and DEP

Page 26: Security Best Practices for Mobile Development

nat-204-14-239-209-sfo.net.salesforce.com

@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES

@tomgersic:~$ WHAT iOS AND ANDROID SHARE

device security

OS / data security

OS / application security

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

Page 27: Security Best Practices for Mobile Development

@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES

@tomgersic:~$ WHAT iOS AND ANDROID SHARE

device security

OS / data security

OS / application security

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

known historical exploits

Page 28: Security Best Practices for Mobile Development

Libtiff Image Exploit / Jailbreak

• iPhone 1 – patched in 1.1.2

• Tiff buffer overflow

• No DEP/ASLR – nothing to prevent executing code on the

heap

• Gained root access from viewing an image on the web

Page 29: Security Best Practices for Mobile Development

Concatenated SMS Exploit – Charlie Miller

Page 30: Security Best Practices for Mobile Development

Concatenated SMS Exploit

• Takes 519 SMS messages – all but 1 is invisible

• Send message -1 of X to underflow the array buffer

• Can’t be stopped by the user

• Used to write an entire binary executable to the heap, and run

it, taking over the phone.

Page 31: Security Best Practices for Mobile Development

@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES

@tomgersic:~$ WHAT iOS AND ANDROID SHARE

device security

OS / data security

OS / application security

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

known historical exploits

application sandbox

Page 32: Security Best Practices for Mobile Development

Stripped down OS

• Unix/BSD based OS, but…

• No shell (/bin/sh).

• No typical Unix utilities like ls, rm, cd, ps, etc.

• All public apps reviewed.

• Private “Enterprise” apps contractually limited to internal

organization.

Page 33: Security Best Practices for Mobile Development

iOS Sandbox Specifics

• All apps (Apple’s and App Store) run as “mobile” user.

• Sandboxing is bolted on -- handled via XNU Sandbox

“Seatbelt” kernel extension.

• Applications run in separate subdirectories of

/private/var/mobile/Applications

• Any app in this directory is loaded with “container”

(sandboxed) profile.

Page 34: Security Best Practices for Mobile Development

Platform Apps

• Some platform apps, like Mobile Safari run with a sandbox

profile as well.

Page 35: Security Best Practices for Mobile Development

Limited Background Processing

Unlimited:

Audio Streaming (Spotify, Pandora)

GPS / Navigation

VOIP

Newsstand app content downloading

Hardware integrations (bluetooth, other external accessories)

Everything else: 10 minute window after app closes to finish any

task.

Page 36: Security Best Practices for Mobile Development

@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES

@tomgersic:~$ WHAT iOS AND ANDROID SHARE

device security

OS / data security

OS / application security

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

known historical exploits

application sandbox

hardware encryption

Page 37: Security Best Practices for Mobile Development

Hardware Encryption

• Everything is encrypted, right?

Page 38: Security Best Practices for Mobile Development

Hardware Encryption

• With a PIN/Passcode, Email, Attachments, and some other

system files are encrypted while device is locked

• Any other app is storing the keys with the lock unless app

specifies NSFileProtectionComplete

Page 39: Security Best Practices for Mobile Development

@tomgersic:~$ WHAT iOS AND ANDROID SHARE

device security

OS / data security

OS / application security

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

known historical exploits

application sandbox

hardware encryption

simple hacking – no jailbreak required

Page 40: Security Best Practices for Mobile Development

Facebook

Page 41: Security Best Practices for Mobile Development

My Secret Apps

Page 42: Security Best Practices for Mobile Development

My Secret Apps

Page 43: Security Best Practices for Mobile Development

device security

OS / data security

OS / application security

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

known historical exploits

application sandbox

hardware encryption

simple hacking – no jailbreak required

jailbreak

Page 44: Security Best Practices for Mobile Development
Page 45: Security Best Practices for Mobile Development

data security

network security

application security

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

known historical exploits

application sandbox

hardware encryption

simple hacking – no jailbreak required

jailbreak

mitigation

Page 46: Security Best Practices for Mobile Development

Application Encryption

• Encrypt your data yourself using PIN / Passcode

• CoreData/SQLCipher

NSIncrementalStore

Good Dynamics

• FMDB/SQLCipher

Salesforce Smartstore

Page 47: Security Best Practices for Mobile Development

Jailbreak Detection

• Sandbox integrity check: fork() should fail

• Check for jailbreak files:

/Applications/Cydia.app

/Library/MobileSubstrate/MobileSubstrate.dylib

/var/cache/apt

/bin/sh

/bin/bash

Page 48: Security Best Practices for Mobile Development

Enable ASLR in your app

• ASLR: Address Space Layout Randomization

Page 49: Security Best Practices for Mobile Development

Stack Canaries

• AKA Stack Smashing Protection

• Protect against buffer overflows

• Places random known value (canary) before local variables

• Use Apple LLVM – won’t work with LLVM GCC

Page 50: Security Best Practices for Mobile Development

Hide Data from App Snapshot Images

Page 51: Security Best Practices for Mobile Development

application security

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

known historical exploits

application sandbox

hardware encryption

simple hacking – no jailbreak required

jailbreak

mitigation

@tomgersic:~$ ANDROID SPECIFIC CHARACTERISTICS

Page 52: Security Best Practices for Mobile Development

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

known historical exploits

application sandbox

hardware encryption

simple hacking – no jailbreak required

jailbreak

mitigation

@tomgersic:~$ ANDROID SPECIFIC CHARACTERISTICS

newsworthy exploits

Page 53: Security Best Practices for Mobile Development

NFC Exploit

Page 54: Security Best Practices for Mobile Development

DroidDream Malware

Page 55: Security Best Practices for Mobile Development

@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS

known historical exploits

application sandbox

hardware encryption

simple hacking – no jailbreak required

jailbreak

mitigation

@tomgersic:~$ ANDROID SPECIFIC CHARACTERISTICS

newsworthy exploits

android sandbox

Page 56: Security Best Practices for Mobile Development

Android Sandbox

Page 57: Security Best Practices for Mobile Development

Permissions

Page 58: Security Best Practices for Mobile Development

Background Processes / App Interaction

Page 59: Security Best Practices for Mobile Development

The Return of Separation of Concerns and the

Principle of Least Privilege

Page 60: Security Best Practices for Mobile Development

Types of Android Components

Activities

Intent

Service

Content Provider

Broadcast Receiver

Page 61: Security Best Practices for Mobile Development

Public / Private Components

Page 62: Security Best Practices for Mobile Development

But what about custom keyboards?

Page 63: Security Best Practices for Mobile Development

Keyboard Security Risks

Page 64: Security Best Practices for Mobile Development

Except Passwords?

https://github.com/tomgersic/AndroidKeyLogger

Page 65: Security Best Practices for Mobile Development

known historical exploits

application sandbox

hardware encryption

simple hacking – no jailbreak required

jailbreak

mitigation

@tomgersic:~$ ANDROID SPECIFIC CHARACTERISTICS

newsworthy exploits

android sandbox

@tomgersic:~$ Salesforce SmartStore

Page 66: Security Best Practices for Mobile Development

Force.com Mobile SDK

https://github.com/forcedotcom

Page 67: Security Best Practices for Mobile Development

Salesforce.com Mobile SDK SmartStore

• SQLite ORM wrapper for Native and Hybrid apps built on the

SFDC Mobile SDK

• NoSQL style JSON-based document store

Page 68: Security Best Practices for Mobile Development

SmartStore Stack

Page 69: Security Best Practices for Mobile Development

SmartStore PIN

Page 70: Security Best Practices for Mobile Development

Who STILL thinks the data on their phone is secure?

Page 71: Security Best Practices for Mobile Development

Tom Gersic

Director, Technical Solutions

@tomgersic

Page 72: Security Best Practices for Mobile Development