building hacking modern ios apps
play

Building&Hacking modern iOS apps Wojciech Regua @_r3ggi - PowerPoint PPT Presentation

www.securing.pl Building&Hacking modern iOS apps Wojciech Regua @_r3ggi wojciech.regula@securing.pl @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl WHOAMI -Senior IT Security Consultant @ SecuRing -Focused on


  1. www.securing.pl Building&Hacking modern iOS apps Wojciech Reguła @_r3ggi wojciech.regula@securing.pl

  2. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl WHOAMI -Senior IT Security Consultant @ SecuRing -Focused on iOS apps security -Blogger https://wojciechregula.blog/ -OWASP SKF contributor

  3. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl INTRODUCTION

  4. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl AGENDA 1. iOS platform myths and reality 2. securityProblemsInMASVSCategories.forEach { problem in 2.1 Discuss problem 2.2 Show solution 2.3 Present new Apple WWDC feature } 3. My new library – iOS Security Suite 🚁 4. Short and long term things to implement in your code

  5. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl PART I PLATFORM MYTHS AND REALITY

  6. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl MYTH #1 APPLE’S REVIEW IS 100% RELIABLE https://twitter.com/orhaneee/status/1076147994574184449

  7. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl MYTH #2 THERE IS NO JAILBREAK FOR IOS 11+ https://github.com/pwn20wndstuff/Undecimus

  8. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl MYTH #3 NO JAILBREAK MEANS NO REVERSING APPS

  9. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl PART II SECURE DEVELOPMENT

  10. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl V1 ARCHITECTURE

  11. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl SWIFT VS OBJECTIVE-C -Integer overflow -> Runtime error -No direct memory access (unless usage of UnsafePointer) -Format string mitigated through string interpolation

  12. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl MYTH – SWIFT AUTOOBFUSCATES ITSELF -There is no obfuscation -Swift uses ”name mangling”

  13. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl MYTH – SWIFT AUTOOBFUSCATES ITSELF -Class TestClass -1 Instance variable -Constructor -2 Methods

  14. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl www.securing.pl www.securing.pl MYTH – SWIFT MYTH – SWIFT AUTOOBFUSCATES AUTOOBFUSCATES ITSELF ITSELF - _$ Swift Symbol - _$ Swift Symbol - Length and module name - Length and module name - Length and class name - Length and class name - C function of class (method) - C function of class (method) - Length and method name - Length and method name - Parameters and return type - Parameters and return type

  15. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl

  16. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl MYTH – SWIFT METHODS CANNOT BE DYNAMICALLY CHANGED -They can, using for example Frida -You just need to hook the symbol

  17. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl MYTH – SWIFT METHODS CANNOT BE DYNAMICALLY CHANGED

  18. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl DEMO HTTPS://VIMEO.COM/334861122

  19. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl TAKEAWAYS -Binary vulnerabilities mitigated -Mostly no memory access -Obufscation ⬇ https://github.com/rockbruno/swiftshield

  20. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl AUTOMATED SMS CODES INPUT (WWDC 2018) -Controversial feature since other app may have access to the one time password -Low risk but there is possibility to do social engineering

  21. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl DEMO HTTPS://VIMEO.COM/334861389

  22. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl V2 DATA STORAGE

  23. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl ON-DEVICE DATA STORAGE -Most common issue is storing sensitive data on the device that should not be there: • API Keys • SSH Keys • Cloud credentials • Test env credentials

  24. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl ON-DEVICE DATA STORAGE -Sensitive data may be insecurely stored in: • Info.plist • User defaults • Regular files • Hardcoded into the binary • Even in Keychain (as they shouldn’t be stored client-side)

  25. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl ON-DEVICE DATA STORAGE

  26. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl ON-DEVICE DATA STORAGE -Directories that are backed up: • Documents/ • Library/Application Support/ • Library/Preferences/ • Library/* -Directories not backed up: • Library/Caches/ • tmp/

  27. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl CREDENTIAL PROVIDER EXTENSION (WWDC 2018) -Password managers in native apps -Add UITextContentType

  28. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl TAKEAWAYS -No sensitive data in IPA -kSecAttrAccessibleWhen with ThisDeviceOnly -UIKit DataProtection -Credential Providers

  29. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl V3 CRYPTOGRAPHY

  30. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl CRYPTOGRAPHY - Insecure token generation - Bear case

  31. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl

  32. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl

  33. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl

  34. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl https://wojciechregula.blog/post/stealing-bear-notes-with-url-schemes/

  35. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl AUTOMATIC STRONG PASSWORDS (WWDC 2018) - Mentioned before Autofill can create new passwords connected with your domain - You are able to set the password policy that will be applied

  36. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl TAKEAWAYS -No home-made ciphers -Everything in IPA is public -SecKeyCreateEncryptedData instead of 3 rd party AES/RSA -Native password policy

  37. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl V4 SESSION MANAGEMENT

  38. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl SESSION MANAGEMENT -Local access control… -JWT -> sign the token!

  39. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl V5 NETWORK COMMUNICATION

  40. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl NETWORK COMMUNICATION -Avoid HTTP -Use HTTPS ✅ -App Transport Security -HTTPS -> make sure if cert is trusted

  41. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl

  42. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl V6 PLATFORM INTERACTION

  43. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl INTER-PROCESS (APPLICATION) COMMUNICATION -XPC (macOS, iOS not allowed) -Mach messages (macOS, iOS not allowed) -URL Schemes -AirDrop -Clipboard (please, do not do that)

  44. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl

  45. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl

  46. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl TAKEAWAYS -Verify sender -Check parameters -If WebView -> check permissions

  47. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl V7 CODE QUALITY

  48. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl CODE QUALITY -No deprecated APIs -Vulnerable libraries -CocoaPods/Carthage -> no fixed versions please

  49. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl AFNetworking 2.5.1 allowed to perform Man in the Middle attack when app did not use SSL pinning

  50. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl DEPRECATED UIWEBVIEW (WWDC 2018) -UIWebView has access to local files via file:// handler BY DEFAULT -WKWebView also has if you turn some flags on btw -XSS ☠

  51. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl DICTIONARY THAT LOOKS YOU UP

  52. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl

  53. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl

  54. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl DEMO HTTPS://VIMEO.COM/334862417

  55. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl HELP VIEWER PROBLEMS

  56. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl DEMO HTTPS://VIMEO.COM/334861507

  57. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl YAHOO IOS XSS EXAMPLE BY @OMESPINO

  58. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl V8 RESILIENCY REQUIREMENTS

  59. @_r3ggi wojciech.regula@securing.pl www.securing.pl www.securing.pl ANTI TAMPERING For those who: • Don’t want their app to be tampered with • Consider malware as a risk • Have to be complaint with OWASP MASVS

Recommend


More recommend