Security Best Practices for MobileDevelopmentDeveloper TrackTom Gersic, Model Metrics / Salesforce.comDirector, Technical ...
Safe Harbor Safe harbor statement under the Private Securities Litigation Reform Act of 1995: This presentation may contai...
All about Model Metrics                Now a Salesforce.com Company                10 year track record - 2,000+ cloud e...
Agenda 1. Fundamental Principles 2. What iOS and Android Share 3. iOS Specific Characteristics 4. Android Specific Charact...
Throwing down the gauntlet… Rules    1. Don’t break the phone or do       anything that might break it.    2. You need to ...
Who thinks the data on their phone is secure?
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@t...
Vulnerability
Threat
Consequence
Mitigation
Separation of Concerns – Principle of Least Privilege
Security Stack
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@t...
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@t...
Mobile Device Management Providers                                http://bit.ly/magicmdm
MDM Compliance
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@t...
Data Security – Hardware Encryption Requires PIN/Passcode on both iOS and Android Supported on   iPhone 3GS w/ iOS v4+ (A...
Last login: Fri Sep 02 12:00:00 2011 from nat-204-14-239-209-sfo.net.salesforce.com@tomgersic:~$ FUNDAMENTAL SECURITY PRIN...
Application Sandboxing
Application Signing
In-App Encryption
ASLR (PIE) and DEP
nat-204-14-239-209-sfo.net.salesforce.com@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES@tomgersic:~$ WHAT iOS AND ANDROID S...
@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES@tomgersic:~$ WHAT iOS AND ANDROID SHAREdevice securityOS / data securityOS /...
Libtiff Image Exploit / Jailbreak • iPhone 1 – patched in 1.1.2 • Tiff buffer overflow • No DEP/ASLR – nothing to prevent ...
Concatenated SMS Exploit – Charlie Miller
Concatenated SMS Exploit • Takes 519 SMS messages – all but 1 is invisible • Send message -1 of X to underflow the array b...
@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES@tomgersic:~$ WHAT iOS AND ANDROID SHAREdevice securityOS / data securityOS /...
Stripped down OS • Unix/BSD based OS, but… • No shell (/bin/sh). • No typical Unix utilities like ls, rm, cd, ps, etc. • A...
iOS Sandbox Specifics• All apps (Apple’s and App Store) run as “mobile” user.• Sandboxing is bolted on -- handled via XNU ...
Platform Apps • Some platform apps, like Mobile Safari run with a sandbox   profile as well.
Limited Background Processing Unlimited:   Audio Streaming (Spotify, Pandora)   GPS / Navigation   VOIP   Newsstand ap...
@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES@tomgersic:~$ WHAT iOS AND ANDROID SHAREdevice securityOS / data securityOS /...
Hardware Encryption • Everything is encrypted, right?
Hardware Encryption • With a PIN/Passcode, Email, Attachments, and some other   system files are encrypted while device is...
@tomgersic:~$ WHAT iOS AND ANDROID SHAREdevice securityOS / data securityOS / application security@tomgersic:~$ iOS SPECIF...
Facebook
My Secret Apps
My Secret Apps
device securityOS / data securityOS / application security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical explo...
data securitynetwork securityapplication security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplic...
Application Encryption • Encrypt your data yourself using PIN / Passcode • CoreData/SQLCipher   NSIncrementalStore   Goo...
Jailbreak Detection • Sandbox integrity check: fork() should fail • Check for jailbreak files:   /Applications/Cydia.app ...
Enable ASLR in your app • ASLR: Address Space Layout Randomization
Stack Canaries • AKA Stack Smashing Protection • Protect against buffer overflows • Places random known value (canary) bef...
Hide Data from App Snapshot Images
application security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encrypt...
@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encryptionsimple hacking – ...
NFC Exploit
DroidDream Malware
@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encryptionsimple hacking – ...
Android Sandbox
Permissions
Background Processes / App Interaction
The Return of Separation of Concerns and thePrinciple of Least Privilege
Types of Android Components     Activities     Intent     Service     Content Provider     Broadcast Receiver
Public / Private Components
But what about custom keyboards?
Keyboard Security Risks
Except Passwords? https://github.com/tomgersic/AndroidKeyLogger
known historical exploitsapplication sandboxhardware encryptionsimple hacking – no jailbreak requiredjailbreakmitigation@t...
Force.com Mobile SDK                  https://github.com/forcedotcom
Salesforce.com Mobile SDK SmartStore • SQLite ORM wrapper for Native and Hybrid apps built on the   SFDC Mobile SDK • NoSQ...
SmartStore Stack
SmartStore PIN
Who STILL thinks the data on their phone is secure?
Tom GersicDirector, Technical Solutions         @tomgersic
Security Best Practices for Mobile Development
Security Best Practices for Mobile Development
Security Best Practices for Mobile Development
Upcoming SlideShare
Loading in …5
×

Security Best Practices for Mobile Development

1,557
-1

Published on

0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,557
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
39
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Security Best Practices for Mobile Development

  1. 1. Security Best Practices for MobileDevelopmentDeveloper TrackTom Gersic, Model Metrics / Salesforce.comDirector, Technical SolutionsTwitter: @tomgersic
  2. 2. 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 litigation, 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.
  3. 3. 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
  4. 4. Agenda 1. Fundamental Principles 2. What iOS and Android Share 3. iOS Specific Characteristics 4. Android Specific Characteristics 5. Salesforce Mobile Offerings
  5. 5. 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.
  6. 6. Who thinks the data on their phone is secure?
  7. 7. 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
  8. 8. Vulnerability
  9. 9. Threat
  10. 10. Consequence
  11. 11. Mitigation
  12. 12. Separation of Concerns – Principle of Least Privilege
  13. 13. Security Stack
  14. 14. 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
  15. 15. 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 SHAREdevice security
  16. 16. Mobile Device Management Providers http://bit.ly/magicmdm
  17. 17. MDM Compliance
  18. 18. 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 SHAREdevice securityOS / data security
  19. 19. 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.
  20. 20. 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 SHAREdevice securityOS / data securityOS / application security
  21. 21. Application Sandboxing
  22. 22. Application Signing
  23. 23. In-App Encryption
  24. 24. ASLR (PIE) and DEP
  25. 25. nat-204-14-239-209-sfo.net.salesforce.com@tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES@tomgersic:~$ WHAT iOS AND ANDROID SHAREdevice securityOS / data securityOS / application security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICS
  26. 26. @tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES@tomgersic:~$ WHAT iOS AND ANDROID SHAREdevice securityOS / data securityOS / application security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploits
  27. 27. 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
  28. 28. Concatenated SMS Exploit – Charlie Miller
  29. 29. 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.
  30. 30. @tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES@tomgersic:~$ WHAT iOS AND ANDROID SHAREdevice securityOS / data securityOS / application security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandbox
  31. 31. 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.
  32. 32. 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.
  33. 33. Platform Apps • Some platform apps, like Mobile Safari run with a sandbox profile as well.
  34. 34. 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.
  35. 35. @tomgersic:~$ FUNDAMENTAL SECURITY PRINCIPLES@tomgersic:~$ WHAT iOS AND ANDROID SHAREdevice securityOS / data securityOS / application security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encryption
  36. 36. Hardware Encryption • Everything is encrypted, right?
  37. 37. 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
  38. 38. @tomgersic:~$ WHAT iOS AND ANDROID SHAREdevice securityOS / data securityOS / application security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encryptionsimple hacking – no jailbreak required
  39. 39. Facebook
  40. 40. My Secret Apps
  41. 41. My Secret Apps
  42. 42. device securityOS / data securityOS / application security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encryptionsimple hacking – no jailbreak requiredjailbreak
  43. 43. data securitynetwork securityapplication security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encryptionsimple hacking – no jailbreak requiredjailbreakmitigation
  44. 44. Application Encryption • Encrypt your data yourself using PIN / Passcode • CoreData/SQLCipher  NSIncrementalStore  Good Dynamics • FMDB/SQLCipher  Salesforce Smartstore
  45. 45. 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
  46. 46. Enable ASLR in your app • ASLR: Address Space Layout Randomization
  47. 47. 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
  48. 48. Hide Data from App Snapshot Images
  49. 49. application security@tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encryptionsimple hacking – no jailbreak requiredjailbreakmitigation@tomgersic:~$ ANDROID SPECIFIC CHARACTERISTICS
  50. 50. @tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encryptionsimple hacking – no jailbreak requiredjailbreakmitigation@tomgersic:~$ ANDROID SPECIFIC CHARACTERISTICSnewsworthy exploits
  51. 51. NFC Exploit
  52. 52. DroidDream Malware
  53. 53. @tomgersic:~$ iOS SPECIFIC CHARACTERISTICSknown historical exploitsapplication sandboxhardware encryptionsimple hacking – no jailbreak requiredjailbreakmitigation@tomgersic:~$ ANDROID SPECIFIC CHARACTERISTICSnewsworthy exploitsandroid sandbox
  54. 54. Android Sandbox
  55. 55. Permissions
  56. 56. Background Processes / App Interaction
  57. 57. The Return of Separation of Concerns and thePrinciple of Least Privilege
  58. 58. Types of Android Components  Activities  Intent  Service  Content Provider  Broadcast Receiver
  59. 59. Public / Private Components
  60. 60. But what about custom keyboards?
  61. 61. Keyboard Security Risks
  62. 62. Except Passwords? https://github.com/tomgersic/AndroidKeyLogger
  63. 63. known historical exploitsapplication sandboxhardware encryptionsimple hacking – no jailbreak requiredjailbreakmitigation@tomgersic:~$ ANDROID SPECIFIC CHARACTERISTICSnewsworthy exploitsandroid sandbox@tomgersic:~$ Salesforce SmartStore
  64. 64. Force.com Mobile SDK https://github.com/forcedotcom
  65. 65. 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
  66. 66. SmartStore Stack
  67. 67. SmartStore PIN
  68. 68. Who STILL thinks the data on their phone is secure?
  69. 69. Tom GersicDirector, Technical Solutions @tomgersic
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×