SlideShare a Scribd company logo
HACKING AND SECURING
   IOS APPLICATIONS




       http://www.securitylearn.net   -Satish B
Agenda
   iOS Security Concepts
   Loopholes in iOS
   Hacking & Securing iOS Applications
     How does loophole in iOS affects the apps
     How easy it’s to steal data from the apps

     How to protect these apps




                     http://www.securitylearn.net
Who Am I?

    <1            • Framework for functional testing tools
Development




5+ Information
                  • Web & Mobile application security
   Security




                  • iOS Forensics & hacking
Other Interests   • Tool development & Knowledge Sharing


                             http://www.securitylearn.net
iOS Basics
   iOS is the Operating System that run on Apple devices like iPhone,
    iPod, iPad & Apple TV
   Stripped down Mac OS X + XNU kernel
   Provides multi tasking
   Only allows to run Apple signed applications
   New features & Bug fixes with every release
       Current version is iOS 6.0.1




                                http://www.securitylearn.net
iOS Security Features
   Boot Chain
       Chain of trust
       Series of signature checks
       BootRom->LLB->iBoot->kernel->file system

   Code Signing
       Prevents running of unauthorized apps/code
       Verifies the integrity of the app code at rest & runtime
       Malware prevention

   Passcode
       Prevents unauthorized access to the device
       Default is 4-digit passcode & Support for complex passcode
       Configurable data wipe after 10 failed attempts


                                 http://www.securitylearn.net
Access data without passcode
   Breaking Chain of trust
       Bootrom exploit
       Patch the series of signature checks


   Boot with custom ramdisk
       Access file system


   No Bootrom exploit for latest devices
       iPhone 4s & 5, iPad 2 &3, iPad Mini




                                http://www.securitylearn.net
iOS Security Features
   Encryption
       Dedicated crypto engine
       Two hardcoded keys – UID & GID
       Usage of UID & GID is limited

   Data Protection
       Ties the data encryption to the user’s passcode
       Files are not accessible when the device is locked
       No Passcode = No data protection

   File Encryption
       Every File is encrypted with unique key
       File key is stored in the file metadata
       Metadata is encrypted with EMF Key


                               http://www.securitylearn.net
Bypassing the iPhone passcode
   Custom ram disk gives access to the file system
   Passcode is required to access those protected files
   Passcode is not stored on the device in any format
   Brute force is the only option


   Brute forcing at Springboard
       6 failed attempts introduces delay
       Delay from 1 min to several days


   Brute forcing at kernel level
       Passcode validity is verified by unlocking the System Keybag
       Load brute force script in custom ramdisk and try to unlock Keybag

                                http://www.securitylearn.net
Bypassing the iPhone passcode
   Brute force time depends on the iPhone hardware
   On iPhone 4 –




                           http://www.securitylearn.net
iOS Security Features
   ASLR - Address Space layout randomization
       Randomizes the memory address
       Apps can built with partial or full ASLR
           Full - Compiled with PIE


   DEP – Data Execution Prevention
       Differentiates code and data
       Prevents the execution of code from non executable memory pages

   Stack Canaries
       Stack smashing protection
       Canary is placed after the local variables
       Protects from buffer overflows


                                   http://www.securitylearn.net
iOS Software Stack




                                                          Security
                                                           APIs


                                                            iOS
                                                          Security
                                                          Features

                  http://www.securitylearn.net
     Ahmad-Reza Sadeghi et al, “Overview on apple iOS” paper
Types of iOS Applications
   Browser based
       Run inside safari
       Built with server side technology like PHP, .NET,…
       HTML, CSS & JavaScript rendering styled to the device


   Native
       Built with iOS SDK & ARM compiled
       Written in Objective C & Cocoa Touch API


   Hybrid
       Native container that leverage browser engine
       Objective C, HTML 5 & JavaScript

                               http://www.securitylearn.net
Areas of focus for hacking
   Device storage
       Plist
       Sqlite
       Cookies
       Keychain


   Run time analysis
       Breaking simple locks


   Sniffing Networks
       MITM & Transport security



                                http://www.securitylearn.net
Local Storage



    http://www.securitylearn.net
App Sandbox
   Apps run in a self-contained environment called Sandbox
   Apps can not access data from other apps
   All apps run as one user: mobile




                            http://www.securitylearn.net
Plist files
   Property list files - Key value pairs stored in binary or XML format
   Easily viewed and modified using property list editors (plutil)
   Designed to store user’s properties and configuration information
   But Apps store usernames, passwords, email ids and session info
   Ex: Facebook stores the authentication tokens




                             http://www.securitylearn.net
Plist files
   Apps create plist files with any or without a file extension
   Plists are identified by a file header – bplist
   Plist files are not protected by Data protection




   Plists are stored un-encrypted in the iOS normal backups (iTunes).
   Apps may delete the plist files upon logout
   File system changes are recorded in HFS Journal
   Deleted files can be recovered by carving the HFS Journal

                              http://www.securitylearn.net
Facebook Session Hijacking
   Facebook stores authentication tokens in plist file
   Gaining access to the plist allows to log into the app
   Plist files can be stolen
       Upon physical access to the device
       From backups : Metasploit post exploitation script to read iOS backup
   In addition to that, Tokens never expired even on Logout




                                http://www.securitylearn.net
Plist files
   Do not store sensitive data in Plist files
   If required, use custom encryption
   Protect plist files with data protection API
   Create plist files Library/Caches folder
       iTunes does not backup caches directory
   For better security, Implement classes for secure file wipe
       Before deleting the file overwrite the file bytes with junk values




                                 http://www.securitylearn.net
Data Protection for files




             http://www.securitylearn.net
Sqlite files
   Lightweight database for structured data storage
   Sqlite is portable, reliable, small and available as a single flat file
   Sqlite is preferred as it gives good memory usage and speed
   Apps store usernames, passwords, emails and sensitive data
    Ex: Gmail stores the emails in Sqlite db file for offline access




                              http://www.securitylearn.net
Sqlite files
   Sqlite can be created with any or without a file extension
   Sqlite files can be viewed using Sqlite Spy or sqlite3
   Data stored in the Sqlite is un-encrypted
   Sqlite files are stored un-encrypted in the iOS backups (iTunes)
   Apps may delete Sqlite files upon logout
   Delete files can be recovered by carving the HFS Journal




                             http://www.securitylearn.net
Sqlite files
   Apps may delete the Sqlite records
   Sqlite – tags the records as deleted but not purge them
   Records which are marked as deleted can be recovered by reading
    the WAL (Write Ahead Log)
   Recovering Sqlite records is easy compare to recovering the files
     Strings command can be used to print the deleted records




                            http://www.securitylearn.net
Sqlite files
   Do not store sensitive data in clear text
   Use custom encryption
   Protect Sqlite files with data protection API
   Implement classes for secure file wipe
   Purge the data upon deletion with VACUUM SQL command.
       VACUUM rebuilds the database
       Doing it for every delete consumes time
   Before deleting the Sqlite record, replace the data with junk values
       Data and Junk value length has to be same




                              http://www.securitylearn.net
Keychain
   Sqlite database for sensitive data storage
   Apple says “keychain is a secure place to store keys and
    passwords”
   Located at: /var/Keychains/keychain-2.db
   Four tables: genp, inet, cert, keys
   Keychain encryption is tied to the device
       Protected entries are tied to the user’s passcode
   Keychain file is accessible to all the applications
   Application can only access it’s own key chain items
       Based on app keychain access group




                                http://www.securitylearn.net
Keychain
   On a JailBroken device Keychain restrictions can be bypassed
   Design an app as a member of all keychain access groups (*)
          Keychain Dumper Tool
   Design app with com.apple.keystore.access-keychain-keys
    permission
          Keychain viewer – by Sogeti




                               http://www.securitylearn.net
Keychain
   Keychain is also not secure. Do not store sensitive data in clear
    text.
   Encrypt the data using custom encryption (CCCrypt)
   Use data protection API while storing data in keychain
   BY default entries are created with
    kSecAttrAccessibleWhenUnlocked data protection
   Apple may change the default protection any time
   Do not store the encryption keys in the binary




                             http://www.securitylearn.net
Data Protection for keychain




            http://www.securitylearn.net
Error Logs
   Apps may write sensitive data in logs
     Debugging (NSLog calls)

     Trouble shooting

     Requests & Responses

   Located at - /private/var/log/syslog
   To view iPhone logs
     Console App (from AppStore)

     iTunes Sync (CrashReporter folder)

     iPhone configuration utility - Console




                             http://www.securitylearn.net
Error Logs
   Syslog is out of sandbox – Any app can access it
   Do not write sensitive data in the syslog file




                              http://www.securitylearn.net
Screenshot
   Home button shrinks your application with a nice effect
   iOS takes screen shots of the application to create that effect
   Sensitive data may get cached
       App directory/Library/Caches/Snapshots


   Remove sensitive data or change the screen before the
    applicationDidEnterBackground() function returns
   Instead of hiding or removing sensitive data you can also prevent
    back- grounding altogether by setting the "Application does not run
    in background" property in the application's Info.plist file




                              http://www.securitylearn.net
Screenshot
   Gmail Screenshot




                       http://www.securitylearn.net
Keyboard cache
   iPhone records everything that a user types in clear text
   Designed to auto complete the predictive common words
   Located at - Library/Keyboard/en_GB-dynamic-text.dat
   Viewed using a hex editor




                              http://www.securitylearn.net
Keyboard cache
   Secure fields are not stored
       Passwords are safe
   Strings with all digits are not stored
       Pins and credit card numbers are safe
   Data typed into text fields are cached
       Usernames and security question answers…


   To disable auto complete of a text field
       Mark it as a secure field
        mytextField.secureTextEntry = YES
       Disable auto correction
        mytextField.autocorrectionType = UITextAutocorrectionTypeNo;


                                http://www.securitylearn.net
Cookies.binarycookies
   Binary file to store the cookies
   Persistent cookies are stored along with the flags (Secure,
    HTTPOnly)
   Most iOS apps does not prompt the user for login every time and
    creates persistent cookies
   Apps store the session cookies locally
   Grabbing cookies allows to log into the user’s account




                             http://www.securitylearn.net
Cookies.binarycookies
   BinaryCookieReader.py can be used to read the cookie files




   For critical applications don’t create persistent cookies




                             http://www.securitylearn.net
Run Time Analysis



     http://www.securitylearn.net
Binary Analysis
   Self distributed Apps are not encrypted
   AppStore binaries are encrypted
       Similar to Fairplay DRM used on iTunes music
   Loader decrypts the apps when loaded into memory
   Debugger can be used to dump the decrypted app from memory
    into a file
   Tools are available: Craculous & Installous
   GNU Debugger or IDA Pro are used on decrypted binary for better
    analysis
   Look for Hard coded passwords, encryption keys, buffer over flows
    and format string attacks


                              http://www.securitylearn.net
Runtime Analysis
   Use class-dump-z on decrypted binary and map the application
   iOS app centralized point of control (MVC) – UIApplication class
   Analyze the class dump output and identify the interesting class




                            http://www.securitylearn.net
Runtime Analysis
   App runtime can be easily modified using Cycript (Cydia pkg)
   Combination of JavaScript and Objective-C interpreter
   Can be hooked to a running process (like GDB)
   Gives access to all classes and instance variables within the app
   Existing methods can be overwritten easily
   Create object for the class and directly access the instance
    variables and invoke methods




                            http://www.securitylearn.net
Runtime Analysis
   Possible attacks with Cycript
       Authentication bypass
       Breaking simple locks
       Bypassing restrictions that stops apps from running on Jailbroken device
       Extract hardcode encryption keys
       Extract app passcodes
       Malicious code injection




   Do not store encryption keys / passcode in memory
   Implement code that restricts debugger attachment


                                   http://www.securitylearn.net
Transport Security



       http://www.securitylearn.net
Transport Security
   iOS apps use SSL/https to do secure transactions
   NSURLRequest / NSURLConnection are commonly used
   CFNetwork – Alternate low level framework to implement SSL
   Frameworks by default rejects the self signed certificates to prevent
    MITM attacks
   Provides API to accept any un-trusted certificate
   NSURLRequest
       setAllowsAnyHTTPSCertificate
   NSURLConnection delegate
       continueWithoutCredentialForAuthenticationChallenge
   CFNetwork
       kCFStreamSSLAllowsExpiredCertificates …

                              http://www.securitylearn.net
Transport Security
   DO not deploy iOS applications with cert validation bypass code




                            http://www.securitylearn.net
Transport Security
   API uses a default set of ciphers to setup a connection
   Does not provide an option to choose the cipher
   Apps can built with embedded SSL libraries
     MatrixSSL, yaSSL

   Apps compiled with latest SDK (>5) does not support weak ciphers




                                                 Image from iOS Application In-Security paper by MDSec

                            http://www.securitylearn.net
Thank You




 Email: Satishb3@hotmail.com

 Twitter: @Satishb3

                 http://www.securitylearn.net

More Related Content

What's hot (20)

Android Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed AdamAndroid Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed Adam
Mohammed Adam
 
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and EntitlementsRuxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Stefan Esser
 
Security Testing Mobile Applications
Security Testing Mobile ApplicationsSecurity Testing Mobile Applications
Security Testing Mobile Applications
Denim Group
 
Appium
AppiumAppium
Appium
Deepshikha Singh
 
Introduction to iOS Penetration Testing
Introduction to iOS Penetration TestingIntroduction to iOS Penetration Testing
Introduction to iOS Penetration Testing
OWASP
 
Android Storage - Vold
Android Storage - VoldAndroid Storage - Vold
Android Storage - Vold
William Lee
 
iOS Application Penetation Test
iOS Application Penetation TestiOS Application Penetation Test
iOS Application Penetation Test
JongWon Kim
 
Mobile security part 1(Android Apps Pentesting)- Romansh yadav
Mobile security part 1(Android Apps Pentesting)- Romansh yadavMobile security part 1(Android Apps Pentesting)- Romansh yadav
Mobile security part 1(Android Apps Pentesting)- Romansh yadav
Romansh Yadav
 
Pentesting Android Applications
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android Applications
Cláudio André
 
Mobile App Security Testing -2
Mobile App Security Testing -2Mobile App Security Testing -2
Mobile App Security Testing -2
Krisshhna Daasaarii
 
Mobile Application Security
Mobile Application SecurityMobile Application Security
Mobile Application Security
Ishan Girdhar
 
Pentesting Android Apps
Pentesting Android AppsPentesting Android Apps
Pentesting Android Apps
Abdelhamid Limami
 
Mobile Apps Security Testing -1
Mobile Apps Security Testing -1Mobile Apps Security Testing -1
Mobile Apps Security Testing -1
Krisshhna Daasaarii
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
SecuRing
 
Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop
Hossam .M Hamed
 
OWASP Mobile Top 10 Deep-Dive
OWASP Mobile Top 10 Deep-DiveOWASP Mobile Top 10 Deep-Dive
OWASP Mobile Top 10 Deep-Dive
Prathan Phongthiproek
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
Niyas Nazar
 
OWASP API Security Top 10 Examples
OWASP API Security Top 10 ExamplesOWASP API Security Top 10 Examples
OWASP API Security Top 10 Examples
42Crunch
 
Understanding android security model
Understanding android security modelUnderstanding android security model
Understanding android security model
Pragati Rai
 
SignaturesAreDead Long Live RESILIENT Signatures
SignaturesAreDead Long Live RESILIENT SignaturesSignaturesAreDead Long Live RESILIENT Signatures
SignaturesAreDead Long Live RESILIENT Signatures
Daniel Bohannon
 
Android Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed AdamAndroid Application Penetration Testing - Mohammed Adam
Android Application Penetration Testing - Mohammed Adam
Mohammed Adam
 
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and EntitlementsRuxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Ruxcon 2014 - Stefan Esser - iOS8 Containers, Sandboxes and Entitlements
Stefan Esser
 
Security Testing Mobile Applications
Security Testing Mobile ApplicationsSecurity Testing Mobile Applications
Security Testing Mobile Applications
Denim Group
 
Introduction to iOS Penetration Testing
Introduction to iOS Penetration TestingIntroduction to iOS Penetration Testing
Introduction to iOS Penetration Testing
OWASP
 
Android Storage - Vold
Android Storage - VoldAndroid Storage - Vold
Android Storage - Vold
William Lee
 
iOS Application Penetation Test
iOS Application Penetation TestiOS Application Penetation Test
iOS Application Penetation Test
JongWon Kim
 
Mobile security part 1(Android Apps Pentesting)- Romansh yadav
Mobile security part 1(Android Apps Pentesting)- Romansh yadavMobile security part 1(Android Apps Pentesting)- Romansh yadav
Mobile security part 1(Android Apps Pentesting)- Romansh yadav
Romansh Yadav
 
Pentesting Android Applications
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android Applications
Cláudio André
 
Mobile Application Security
Mobile Application SecurityMobile Application Security
Mobile Application Security
Ishan Girdhar
 
Applications secure by default
Applications secure by defaultApplications secure by default
Applications secure by default
SecuRing
 
Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop Privilege escalation from 1 to 0 Workshop
Privilege escalation from 1 to 0 Workshop
Hossam .M Hamed
 
Vulnerabilities in modern web applications
Vulnerabilities in modern web applicationsVulnerabilities in modern web applications
Vulnerabilities in modern web applications
Niyas Nazar
 
OWASP API Security Top 10 Examples
OWASP API Security Top 10 ExamplesOWASP API Security Top 10 Examples
OWASP API Security Top 10 Examples
42Crunch
 
Understanding android security model
Understanding android security modelUnderstanding android security model
Understanding android security model
Pragati Rai
 
SignaturesAreDead Long Live RESILIENT Signatures
SignaturesAreDead Long Live RESILIENT SignaturesSignaturesAreDead Long Live RESILIENT Signatures
SignaturesAreDead Long Live RESILIENT Signatures
Daniel Bohannon
 

Viewers also liked (20)

Reverse Engineering iOS apps
Reverse Engineering iOS appsReverse Engineering iOS apps
Reverse Engineering iOS apps
Max Bazaliy
 
Pentesting iPhone applications
Pentesting iPhone applicationsPentesting iPhone applications
Pentesting iPhone applications
Satish b
 
OWASP Melbourne - Introduction to iOS Application Penetration Testing
OWASP Melbourne - Introduction to iOS Application Penetration TestingOWASP Melbourne - Introduction to iOS Application Penetration Testing
OWASP Melbourne - Introduction to iOS Application Penetration Testing
eightbit
 
I Want More Ninja – iOS Security Testing
I Want More Ninja – iOS Security TestingI Want More Ninja – iOS Security Testing
I Want More Ninja – iOS Security Testing
Jason Haddix
 
Attacking and Defending Apple iOS Devices
Attacking and Defending Apple iOS DevicesAttacking and Defending Apple iOS Devices
Attacking and Defending Apple iOS Devices
Tom Eston
 
Behind the scenes with IOS security
Behind the scenes with IOS securityBehind the scenes with IOS security
Behind the scenes with IOS security
Priyanka Aash
 
Forensic analysis of iPhone backups (iOS 5)
Forensic analysis of iPhone backups (iOS 5)Forensic analysis of iPhone backups (iOS 5)
Forensic analysis of iPhone backups (iOS 5)
Satish b
 
Hacker Halted 2014 - EMM Limits & Solutions
Hacker Halted 2014 - EMM Limits & SolutionsHacker Halted 2014 - EMM Limits & Solutions
Hacker Halted 2014 - EMM Limits & Solutions
EC-Council
 
iOS Forensics: Overcoming iPhone Data Protection
iOS Forensics: Overcoming iPhone Data ProtectioniOS Forensics: Overcoming iPhone Data Protection
iOS Forensics: Overcoming iPhone Data Protection
Andrey Belenko
 
Smart phone security ios system
Smart phone security ios systemSmart phone security ios system
Smart phone security ios system
Jamil S. Alagha
 
iPhone forensics on iOS5
iPhone forensics on iOS5iPhone forensics on iOS5
iPhone forensics on iOS5
Satish b
 
iOS App Reverse Engineering
iOS App Reverse EngineeringiOS App Reverse Engineering
iOS App Reverse Engineering
Zishe Sha
 
ppt based on android technology with great animations
ppt based on android technology with great animationsppt based on android technology with great animations
ppt based on android technology with great animations
Hriday Garg
 
Mobile Penetration Testing: Episode 1 - The Forensic Menace
Mobile Penetration Testing: Episode 1 - The Forensic MenaceMobile Penetration Testing: Episode 1 - The Forensic Menace
Mobile Penetration Testing: Episode 1 - The Forensic Menace
NowSecure
 
Client Side Exploits using PDF
Client Side Exploits using PDFClient Side Exploits using PDF
Client Side Exploits using PDF
n|u - The Open Security Community
 
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Liang Chen
 
How Android and iOS Security Enhancements Complicate Threat Detection
How Android and iOS Security Enhancements Complicate Threat DetectionHow Android and iOS Security Enhancements Complicate Threat Detection
How Android and iOS Security Enhancements Complicate Threat Detection
NowSecure
 
iOS Security: The Never-Ending Story of Malicious Profiles
iOS Security: The Never-Ending Story of Malicious ProfilesiOS Security: The Never-Ending Story of Malicious Profiles
iOS Security: The Never-Ending Story of Malicious Profiles
Yair Amit
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
Satish b
 
SyScan 2015 - iOS 678 Security - A Study in Fail
SyScan 2015 - iOS 678 Security - A Study in FailSyScan 2015 - iOS 678 Security - A Study in Fail
SyScan 2015 - iOS 678 Security - A Study in Fail
Stefan Esser
 
Reverse Engineering iOS apps
Reverse Engineering iOS appsReverse Engineering iOS apps
Reverse Engineering iOS apps
Max Bazaliy
 
Pentesting iPhone applications
Pentesting iPhone applicationsPentesting iPhone applications
Pentesting iPhone applications
Satish b
 
OWASP Melbourne - Introduction to iOS Application Penetration Testing
OWASP Melbourne - Introduction to iOS Application Penetration TestingOWASP Melbourne - Introduction to iOS Application Penetration Testing
OWASP Melbourne - Introduction to iOS Application Penetration Testing
eightbit
 
I Want More Ninja – iOS Security Testing
I Want More Ninja – iOS Security TestingI Want More Ninja – iOS Security Testing
I Want More Ninja – iOS Security Testing
Jason Haddix
 
Attacking and Defending Apple iOS Devices
Attacking and Defending Apple iOS DevicesAttacking and Defending Apple iOS Devices
Attacking and Defending Apple iOS Devices
Tom Eston
 
Behind the scenes with IOS security
Behind the scenes with IOS securityBehind the scenes with IOS security
Behind the scenes with IOS security
Priyanka Aash
 
Forensic analysis of iPhone backups (iOS 5)
Forensic analysis of iPhone backups (iOS 5)Forensic analysis of iPhone backups (iOS 5)
Forensic analysis of iPhone backups (iOS 5)
Satish b
 
Hacker Halted 2014 - EMM Limits & Solutions
Hacker Halted 2014 - EMM Limits & SolutionsHacker Halted 2014 - EMM Limits & Solutions
Hacker Halted 2014 - EMM Limits & Solutions
EC-Council
 
iOS Forensics: Overcoming iPhone Data Protection
iOS Forensics: Overcoming iPhone Data ProtectioniOS Forensics: Overcoming iPhone Data Protection
iOS Forensics: Overcoming iPhone Data Protection
Andrey Belenko
 
Smart phone security ios system
Smart phone security ios systemSmart phone security ios system
Smart phone security ios system
Jamil S. Alagha
 
iPhone forensics on iOS5
iPhone forensics on iOS5iPhone forensics on iOS5
iPhone forensics on iOS5
Satish b
 
iOS App Reverse Engineering
iOS App Reverse EngineeringiOS App Reverse Engineering
iOS App Reverse Engineering
Zishe Sha
 
ppt based on android technology with great animations
ppt based on android technology with great animationsppt based on android technology with great animations
ppt based on android technology with great animations
Hriday Garg
 
Mobile Penetration Testing: Episode 1 - The Forensic Menace
Mobile Penetration Testing: Episode 1 - The Forensic MenaceMobile Penetration Testing: Episode 1 - The Forensic Menace
Mobile Penetration Testing: Episode 1 - The Forensic Menace
NowSecure
 
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Us 16-subverting apple-graphics_practical_approaches_to_remotely_gaining_root...
Liang Chen
 
How Android and iOS Security Enhancements Complicate Threat Detection
How Android and iOS Security Enhancements Complicate Threat DetectionHow Android and iOS Security Enhancements Complicate Threat Detection
How Android and iOS Security Enhancements Complicate Threat Detection
NowSecure
 
iOS Security: The Never-Ending Story of Malicious Profiles
iOS Security: The Never-Ending Story of Malicious ProfilesiOS Security: The Never-Ending Story of Malicious Profiles
iOS Security: The Never-Ending Story of Malicious Profiles
Yair Amit
 
Pentesting web applications
Pentesting web applicationsPentesting web applications
Pentesting web applications
Satish b
 
SyScan 2015 - iOS 678 Security - A Study in Fail
SyScan 2015 - iOS 678 Security - A Study in FailSyScan 2015 - iOS 678 Security - A Study in Fail
SyScan 2015 - iOS 678 Security - A Study in Fail
Stefan Esser
 

Similar to Hacking and securing ios applications (20)

Hacking and Securing iOS Applications by Satish Bomisstty
Hacking and Securing iOS Applications by Satish BomissttyHacking and Securing iOS Applications by Satish Bomisstty
Hacking and Securing iOS Applications by Satish Bomisstty
ClubHack
 
Hacking and Securing iOS Applications
Hacking and Securing iOS ApplicationsHacking and Securing iOS Applications
Hacking and Securing iOS Applications
n|u - The Open Security Community
 
iOS (Vulner)ability
iOS (Vulner)abilityiOS (Vulner)ability
iOS (Vulner)ability
Subho Halder
 
IOS Encryption Systems
IOS Encryption SystemsIOS Encryption Systems
IOS Encryption Systems
Peter Teufl
 
IOS security
IOS securityIOS security
IOS security
bakhti rahman
 
Mobile Forensics on a Shoestring Budget
Mobile Forensics on a Shoestring BudgetMobile Forensics on a Shoestring Budget
Mobile Forensics on a Shoestring Budget
Brent Muir
 
Security testing of mobile applications
Security testing of mobile applicationsSecurity testing of mobile applications
Security testing of mobile applications
GTestClub
 
Untitled 1
Untitled 1Untitled 1
Untitled 1
Sergey Kochergan
 
iOS secure app development
iOS secure app developmentiOS secure app development
iOS secure app development
Dusan Klinec
 
Unlocking-iOS-A-Hackers-Guide-to-App-Testing.pptx
Unlocking-iOS-A-Hackers-Guide-to-App-Testing.pptxUnlocking-iOS-A-Hackers-Guide-to-App-Testing.pptx
Unlocking-iOS-A-Hackers-Guide-to-App-Testing.pptx
Abida Shariff
 
Ярослав Воронцов — Пара слов о mobile security.
Ярослав Воронцов — Пара слов о mobile security.Ярослав Воронцов — Пара слов о mobile security.
Ярослав Воронцов — Пара слов о mobile security.
DataArt
 
iOS Application Security And Static Analysis.pdf
iOS Application Security And Static Analysis.pdfiOS Application Security And Static Analysis.pdf
iOS Application Security And Static Analysis.pdf
Cyber security professional services- Detox techno
 
iOS Application Static Analysis - Deepika Kumari.pptx
iOS Application Static Analysis - Deepika Kumari.pptxiOS Application Static Analysis - Deepika Kumari.pptx
iOS Application Static Analysis - Deepika Kumari.pptx
deepikakumari643428
 
OWASP for iOS
OWASP for iOSOWASP for iOS
OWASP for iOS
Phineas Huang
 
Security in iOS
Security in iOSSecurity in iOS
Security in iOS
Clement Prem
 
osi semair.pptx
osi semair.pptxosi semair.pptx
osi semair.pptx
amerdawood2
 
Mobile Device Encryption Systems
Mobile Device Encryption SystemsMobile Device Encryption Systems
Mobile Device Encryption Systems
Peter Teufl
 
Are Your Mobile Apps Secure? (Part I)
Are Your Mobile Apps Secure? (Part I)Are Your Mobile Apps Secure? (Part I)
Are Your Mobile Apps Secure? (Part I)
Nagarro
 
Evaluating iOS Applications
Evaluating iOS ApplicationsEvaluating iOS Applications
Evaluating iOS Applications
iphonepentest
 
Ios file management
Ios file managementIos file management
Ios file management
Rajeev Venkata
 
Hacking and Securing iOS Applications by Satish Bomisstty
Hacking and Securing iOS Applications by Satish BomissttyHacking and Securing iOS Applications by Satish Bomisstty
Hacking and Securing iOS Applications by Satish Bomisstty
ClubHack
 
iOS (Vulner)ability
iOS (Vulner)abilityiOS (Vulner)ability
iOS (Vulner)ability
Subho Halder
 
IOS Encryption Systems
IOS Encryption SystemsIOS Encryption Systems
IOS Encryption Systems
Peter Teufl
 
Mobile Forensics on a Shoestring Budget
Mobile Forensics on a Shoestring BudgetMobile Forensics on a Shoestring Budget
Mobile Forensics on a Shoestring Budget
Brent Muir
 
Security testing of mobile applications
Security testing of mobile applicationsSecurity testing of mobile applications
Security testing of mobile applications
GTestClub
 
iOS secure app development
iOS secure app developmentiOS secure app development
iOS secure app development
Dusan Klinec
 
Unlocking-iOS-A-Hackers-Guide-to-App-Testing.pptx
Unlocking-iOS-A-Hackers-Guide-to-App-Testing.pptxUnlocking-iOS-A-Hackers-Guide-to-App-Testing.pptx
Unlocking-iOS-A-Hackers-Guide-to-App-Testing.pptx
Abida Shariff
 
Ярослав Воронцов — Пара слов о mobile security.
Ярослав Воронцов — Пара слов о mobile security.Ярослав Воронцов — Пара слов о mobile security.
Ярослав Воронцов — Пара слов о mobile security.
DataArt
 
iOS Application Static Analysis - Deepika Kumari.pptx
iOS Application Static Analysis - Deepika Kumari.pptxiOS Application Static Analysis - Deepika Kumari.pptx
iOS Application Static Analysis - Deepika Kumari.pptx
deepikakumari643428
 
Mobile Device Encryption Systems
Mobile Device Encryption SystemsMobile Device Encryption Systems
Mobile Device Encryption Systems
Peter Teufl
 
Are Your Mobile Apps Secure? (Part I)
Are Your Mobile Apps Secure? (Part I)Are Your Mobile Apps Secure? (Part I)
Are Your Mobile Apps Secure? (Part I)
Nagarro
 
Evaluating iOS Applications
Evaluating iOS ApplicationsEvaluating iOS Applications
Evaluating iOS Applications
iphonepentest
 

Recently uploaded (20)

LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
UPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guideUPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guide
abmerca
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and GuestsLDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDMMIA Reiki News Ed3 Vol1 For Team and Guests
LDM Mia eStudios
 
The role of wall art in interior designing
The role of wall art in interior designingThe role of wall art in interior designing
The role of wall art in interior designing
meghaark2110
 
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
MCQ PHYSIOLOGY II (DR. NASIR MUSTAFA) MCQS)
Dr. Nasir Mustafa
 
UPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guideUPMVLE migration to ARAL. A step- by- step guide
UPMVLE migration to ARAL. A step- by- step guide
abmerca
 
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptxU3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
U3 ANTITUBERCULAR DRUGS Pharmacology 3.pptx
Mayuri Chavan
 
All About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdfAll About the 990 Unlocking Its Mysteries and Its Power.pdf
All About the 990 Unlocking Its Mysteries and Its Power.pdf
TechSoup
 
antiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidenceantiquity of writing in ancient India- literary & archaeological evidence
antiquity of writing in ancient India- literary & archaeological evidence
PrachiSontakke5
 
puzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tensepuzzle Irregular Verbs- Simple Past Tense
puzzle Irregular Verbs- Simple Past Tense
OlgaLeonorTorresSnch
 
Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)Myasthenia gravis (Neuromuscular disorder)
Myasthenia gravis (Neuromuscular disorder)
Mohamed Rizk Khodair
 
Module 1: Foundations of Research
Module 1: Foundations of ResearchModule 1: Foundations of Research
Module 1: Foundations of Research
drroxannekemp
 
Rock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian HistoryRock Art As a Source of Ancient Indian History
Rock Art As a Source of Ancient Indian History
Virag Sontakke
 
Botany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic ExcellenceBotany Assignment Help Guide - Academic Excellence
Botany Assignment Help Guide - Academic Excellence
online college homework help
 
Cultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptxCultivation Practice of Turmeric in Nepal.pptx
Cultivation Practice of Turmeric in Nepal.pptx
UmeshTimilsina1
 
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptxANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
ANTI-VIRAL DRUGS unit 3 Pharmacology 3.pptx
Mayuri Chavan
 
How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18How to Configure Public Holidays & Mandatory Days in Odoo 18
How to Configure Public Holidays & Mandatory Days in Odoo 18
Celine George
 
Ajanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of HistoryAjanta Paintings: Study as a Source of History
Ajanta Paintings: Study as a Source of History
Virag Sontakke
 
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptxTERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
TERMINOLOGIES,GRIEF PROCESS AND LOSS AMD ITS TYPES .pptx
PoojaSen20
 
spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)spinal cord disorders (Myelopathies and radiculoapthies)
spinal cord disorders (Myelopathies and radiculoapthies)
Mohamed Rizk Khodair
 
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon DolabaniHistory Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
History Of The Monastery Of Mor Gabriel Philoxenos Yuhanon Dolabani
fruinkamel7m
 
CNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscessCNS infections (encephalitis, meningitis & Brain abscess
CNS infections (encephalitis, meningitis & Brain abscess
Mohamed Rizk Khodair
 

Hacking and securing ios applications

  • 1. HACKING AND SECURING IOS APPLICATIONS http://www.securitylearn.net -Satish B
  • 2. Agenda  iOS Security Concepts  Loopholes in iOS  Hacking & Securing iOS Applications  How does loophole in iOS affects the apps  How easy it’s to steal data from the apps  How to protect these apps http://www.securitylearn.net
  • 3. Who Am I? <1 • Framework for functional testing tools Development 5+ Information • Web & Mobile application security Security • iOS Forensics & hacking Other Interests • Tool development & Knowledge Sharing http://www.securitylearn.net
  • 4. iOS Basics  iOS is the Operating System that run on Apple devices like iPhone, iPod, iPad & Apple TV  Stripped down Mac OS X + XNU kernel  Provides multi tasking  Only allows to run Apple signed applications  New features & Bug fixes with every release  Current version is iOS 6.0.1 http://www.securitylearn.net
  • 5. iOS Security Features  Boot Chain  Chain of trust  Series of signature checks  BootRom->LLB->iBoot->kernel->file system  Code Signing  Prevents running of unauthorized apps/code  Verifies the integrity of the app code at rest & runtime  Malware prevention  Passcode  Prevents unauthorized access to the device  Default is 4-digit passcode & Support for complex passcode  Configurable data wipe after 10 failed attempts http://www.securitylearn.net
  • 6. Access data without passcode  Breaking Chain of trust  Bootrom exploit  Patch the series of signature checks  Boot with custom ramdisk  Access file system  No Bootrom exploit for latest devices  iPhone 4s & 5, iPad 2 &3, iPad Mini http://www.securitylearn.net
  • 7. iOS Security Features  Encryption  Dedicated crypto engine  Two hardcoded keys – UID & GID  Usage of UID & GID is limited  Data Protection  Ties the data encryption to the user’s passcode  Files are not accessible when the device is locked  No Passcode = No data protection  File Encryption  Every File is encrypted with unique key  File key is stored in the file metadata  Metadata is encrypted with EMF Key http://www.securitylearn.net
  • 8. Bypassing the iPhone passcode  Custom ram disk gives access to the file system  Passcode is required to access those protected files  Passcode is not stored on the device in any format  Brute force is the only option  Brute forcing at Springboard  6 failed attempts introduces delay  Delay from 1 min to several days  Brute forcing at kernel level  Passcode validity is verified by unlocking the System Keybag  Load brute force script in custom ramdisk and try to unlock Keybag http://www.securitylearn.net
  • 9. Bypassing the iPhone passcode  Brute force time depends on the iPhone hardware  On iPhone 4 – http://www.securitylearn.net
  • 10. iOS Security Features  ASLR - Address Space layout randomization  Randomizes the memory address  Apps can built with partial or full ASLR  Full - Compiled with PIE  DEP – Data Execution Prevention  Differentiates code and data  Prevents the execution of code from non executable memory pages  Stack Canaries  Stack smashing protection  Canary is placed after the local variables  Protects from buffer overflows http://www.securitylearn.net
  • 11. iOS Software Stack Security APIs iOS Security Features http://www.securitylearn.net Ahmad-Reza Sadeghi et al, “Overview on apple iOS” paper
  • 12. Types of iOS Applications  Browser based  Run inside safari  Built with server side technology like PHP, .NET,…  HTML, CSS & JavaScript rendering styled to the device  Native  Built with iOS SDK & ARM compiled  Written in Objective C & Cocoa Touch API  Hybrid  Native container that leverage browser engine  Objective C, HTML 5 & JavaScript http://www.securitylearn.net
  • 13. Areas of focus for hacking  Device storage  Plist  Sqlite  Cookies  Keychain  Run time analysis  Breaking simple locks  Sniffing Networks  MITM & Transport security http://www.securitylearn.net
  • 14. Local Storage http://www.securitylearn.net
  • 15. App Sandbox  Apps run in a self-contained environment called Sandbox  Apps can not access data from other apps  All apps run as one user: mobile http://www.securitylearn.net
  • 16. Plist files  Property list files - Key value pairs stored in binary or XML format  Easily viewed and modified using property list editors (plutil)  Designed to store user’s properties and configuration information  But Apps store usernames, passwords, email ids and session info  Ex: Facebook stores the authentication tokens http://www.securitylearn.net
  • 17. Plist files  Apps create plist files with any or without a file extension  Plists are identified by a file header – bplist  Plist files are not protected by Data protection  Plists are stored un-encrypted in the iOS normal backups (iTunes).  Apps may delete the plist files upon logout  File system changes are recorded in HFS Journal  Deleted files can be recovered by carving the HFS Journal http://www.securitylearn.net
  • 18. Facebook Session Hijacking  Facebook stores authentication tokens in plist file  Gaining access to the plist allows to log into the app  Plist files can be stolen  Upon physical access to the device  From backups : Metasploit post exploitation script to read iOS backup  In addition to that, Tokens never expired even on Logout http://www.securitylearn.net
  • 19. Plist files  Do not store sensitive data in Plist files  If required, use custom encryption  Protect plist files with data protection API  Create plist files Library/Caches folder  iTunes does not backup caches directory  For better security, Implement classes for secure file wipe  Before deleting the file overwrite the file bytes with junk values http://www.securitylearn.net
  • 20. Data Protection for files http://www.securitylearn.net
  • 21. Sqlite files  Lightweight database for structured data storage  Sqlite is portable, reliable, small and available as a single flat file  Sqlite is preferred as it gives good memory usage and speed  Apps store usernames, passwords, emails and sensitive data Ex: Gmail stores the emails in Sqlite db file for offline access http://www.securitylearn.net
  • 22. Sqlite files  Sqlite can be created with any or without a file extension  Sqlite files can be viewed using Sqlite Spy or sqlite3  Data stored in the Sqlite is un-encrypted  Sqlite files are stored un-encrypted in the iOS backups (iTunes)  Apps may delete Sqlite files upon logout  Delete files can be recovered by carving the HFS Journal http://www.securitylearn.net
  • 23. Sqlite files  Apps may delete the Sqlite records  Sqlite – tags the records as deleted but not purge them  Records which are marked as deleted can be recovered by reading the WAL (Write Ahead Log)  Recovering Sqlite records is easy compare to recovering the files  Strings command can be used to print the deleted records http://www.securitylearn.net
  • 24. Sqlite files  Do not store sensitive data in clear text  Use custom encryption  Protect Sqlite files with data protection API  Implement classes for secure file wipe  Purge the data upon deletion with VACUUM SQL command.  VACUUM rebuilds the database  Doing it for every delete consumes time  Before deleting the Sqlite record, replace the data with junk values  Data and Junk value length has to be same http://www.securitylearn.net
  • 25. Keychain  Sqlite database for sensitive data storage  Apple says “keychain is a secure place to store keys and passwords”  Located at: /var/Keychains/keychain-2.db  Four tables: genp, inet, cert, keys  Keychain encryption is tied to the device  Protected entries are tied to the user’s passcode  Keychain file is accessible to all the applications  Application can only access it’s own key chain items  Based on app keychain access group http://www.securitylearn.net
  • 26. Keychain  On a JailBroken device Keychain restrictions can be bypassed  Design an app as a member of all keychain access groups (*)  Keychain Dumper Tool  Design app with com.apple.keystore.access-keychain-keys permission  Keychain viewer – by Sogeti http://www.securitylearn.net
  • 27. Keychain  Keychain is also not secure. Do not store sensitive data in clear text.  Encrypt the data using custom encryption (CCCrypt)  Use data protection API while storing data in keychain  BY default entries are created with kSecAttrAccessibleWhenUnlocked data protection  Apple may change the default protection any time  Do not store the encryption keys in the binary http://www.securitylearn.net
  • 28. Data Protection for keychain http://www.securitylearn.net
  • 29. Error Logs  Apps may write sensitive data in logs  Debugging (NSLog calls)  Trouble shooting  Requests & Responses  Located at - /private/var/log/syslog  To view iPhone logs  Console App (from AppStore)  iTunes Sync (CrashReporter folder)  iPhone configuration utility - Console http://www.securitylearn.net
  • 30. Error Logs  Syslog is out of sandbox – Any app can access it  Do not write sensitive data in the syslog file http://www.securitylearn.net
  • 31. Screenshot  Home button shrinks your application with a nice effect  iOS takes screen shots of the application to create that effect  Sensitive data may get cached  App directory/Library/Caches/Snapshots  Remove sensitive data or change the screen before the applicationDidEnterBackground() function returns  Instead of hiding or removing sensitive data you can also prevent back- grounding altogether by setting the "Application does not run in background" property in the application's Info.plist file http://www.securitylearn.net
  • 32. Screenshot  Gmail Screenshot http://www.securitylearn.net
  • 33. Keyboard cache  iPhone records everything that a user types in clear text  Designed to auto complete the predictive common words  Located at - Library/Keyboard/en_GB-dynamic-text.dat  Viewed using a hex editor http://www.securitylearn.net
  • 34. Keyboard cache  Secure fields are not stored  Passwords are safe  Strings with all digits are not stored  Pins and credit card numbers are safe  Data typed into text fields are cached  Usernames and security question answers…  To disable auto complete of a text field  Mark it as a secure field mytextField.secureTextEntry = YES  Disable auto correction mytextField.autocorrectionType = UITextAutocorrectionTypeNo; http://www.securitylearn.net
  • 35. Cookies.binarycookies  Binary file to store the cookies  Persistent cookies are stored along with the flags (Secure, HTTPOnly)  Most iOS apps does not prompt the user for login every time and creates persistent cookies  Apps store the session cookies locally  Grabbing cookies allows to log into the user’s account http://www.securitylearn.net
  • 36. Cookies.binarycookies  BinaryCookieReader.py can be used to read the cookie files  For critical applications don’t create persistent cookies http://www.securitylearn.net
  • 37. Run Time Analysis http://www.securitylearn.net
  • 38. Binary Analysis  Self distributed Apps are not encrypted  AppStore binaries are encrypted  Similar to Fairplay DRM used on iTunes music  Loader decrypts the apps when loaded into memory  Debugger can be used to dump the decrypted app from memory into a file  Tools are available: Craculous & Installous  GNU Debugger or IDA Pro are used on decrypted binary for better analysis  Look for Hard coded passwords, encryption keys, buffer over flows and format string attacks http://www.securitylearn.net
  • 39. Runtime Analysis  Use class-dump-z on decrypted binary and map the application  iOS app centralized point of control (MVC) – UIApplication class  Analyze the class dump output and identify the interesting class http://www.securitylearn.net
  • 40. Runtime Analysis  App runtime can be easily modified using Cycript (Cydia pkg)  Combination of JavaScript and Objective-C interpreter  Can be hooked to a running process (like GDB)  Gives access to all classes and instance variables within the app  Existing methods can be overwritten easily  Create object for the class and directly access the instance variables and invoke methods http://www.securitylearn.net
  • 41. Runtime Analysis  Possible attacks with Cycript  Authentication bypass  Breaking simple locks  Bypassing restrictions that stops apps from running on Jailbroken device  Extract hardcode encryption keys  Extract app passcodes  Malicious code injection  Do not store encryption keys / passcode in memory  Implement code that restricts debugger attachment http://www.securitylearn.net
  • 42. Transport Security http://www.securitylearn.net
  • 43. Transport Security  iOS apps use SSL/https to do secure transactions  NSURLRequest / NSURLConnection are commonly used  CFNetwork – Alternate low level framework to implement SSL  Frameworks by default rejects the self signed certificates to prevent MITM attacks  Provides API to accept any un-trusted certificate  NSURLRequest  setAllowsAnyHTTPSCertificate  NSURLConnection delegate  continueWithoutCredentialForAuthenticationChallenge  CFNetwork  kCFStreamSSLAllowsExpiredCertificates … http://www.securitylearn.net
  • 44. Transport Security  DO not deploy iOS applications with cert validation bypass code http://www.securitylearn.net
  • 45. Transport Security  API uses a default set of ciphers to setup a connection  Does not provide an option to choose the cipher  Apps can built with embedded SSL libraries  MatrixSSL, yaSSL  Apps compiled with latest SDK (>5) does not support weak ciphers Image from iOS Application In-Security paper by MDSec http://www.securitylearn.net
  • 46. Thank You Email: [email protected] Twitter: @Satishb3 http://www.securitylearn.net