SlideShare a Scribd company logo
Pentesting Mobile Applications


                      Prashant Verma
                  Security Consultant & Competency Lead
Target Mobile
Types of Mobile Applications


• Browser based Mobile Applications (WAP)
• Installed Applications
Android architecture

• DVM
  • ~JVM
  • dex files
• Sandboxing
  • Apps run
    with its user,
    group
• Apps may
  share data, if
  run with same
  user
iOS Architecture

 Core OS & Core Services –
  Low level file handling, network
  Sockets etc. Include Technologies
  like Core Foundation, CFNetwork,
  SQLite etc
  Written in C
 Media Layer – Supports audio and
  2D and 3D video
 Cocoa Touch Layer – Provides
  infrastructure used by applications.
  Contains the UIKit Framework
  Written in Objective-C
Pentesting Mobile Applications




•   Reading Stored Data
•   Capturing Requests
•   Reversing the Application Package
•   Platform Specific Issues
Reading Stored Data
Reading Stored Data


• Mobile applications store data in local
  memory of handset
• This data is stored by developers in files
  locally and is used by the application
• Look out for the persistent stored
  information in the mobiles for sensitive
  data (pwd, keys, account details etc.)
• This may involve hacking / jailbreaking the
  phone
Reading Stored Data: Android


• Android Applications store the data in
  directory /data/data/[PACKAGE_NAME]
• sharedpreferences
    • Context.MODE_PRIVATE
    • Context.MODE_WORLD_READABLE
    • Context.MODE_WORLD_WRITEABLE
• Files may be stored using the filesystem at
  /data/data/[PACKAGE_NAME]/files/filenam
• Storage in the SQLite databases
    • Can be read using SQLite browser
Reading Stored Data: Android


• Demo 1
 • Let us see how the stored data can be
   accessed in an Android phone

 • <Connect the phone via USB debugging
   mode, show the storage directory in Android,
   browser to show the different storage formats,
   read the files, read the databases using
   SQLite browser>
Reading Stored Data: iOS


• iPhone too stores the data in the
  application directory
     • /private/var/mobile/Applications/ApplicationID/
• Plist files ..can be read using
     • Property List Editor
     • plutil
• Sqlite databases
     • Same procedure to read as Android
Capturing the Traffic
Capturing The Traffic



• Capture HTTP requests & responses
• Carry out Parameter Manipulation and
  other attacks
• Set up a proxy in between the server & the
  client to intercept.
• This can be achieved by
    • Proxying the real devices
    • Proxying the emulators
Capturing The Traffic : Android



• Proxying Android Device
   • Root your phone 
   • Install Superuser
   • Install a proxy tool like ProxyDroid or Auto Proxy
      • Set the proxy IP address & port no.



• Emulators can also be proxied
Capturing The Traffic
Capturing The Traffic : iPhones



• Proxying Apple iPhone / iPAD
 • Setup a proxy ipaddress and port for the wifi
   connection
 • Entire traffic is routed through this proxy
• Proxying Simulators
 • Open the Simulator within the xcode IDE
 • GUI option to set proxy ipaddress and port
Capturing The Traffic: iPhones



• Demo 2
 • Let us now see how to proxy an iPhone
   device to capture the traffic

 • <connect the phone & laptop to the wifi, setup
   laptop as proxy for the phone, show the
   captured traffic in the laptop, demonstrate the
   parameter manipulation attack>
Capturing The Traffic: iPhones
Reversing the Application Package
Reversing the Application Package



• Reverse Engineer the application logic and
  source code
• Identify the flaws in the code base to
  exploit them
• Look for sensitive data like passwords,
  encryption algorithms and keys
• Nokia jar files & Android apk packages are
  easy to reverse
Reversing the Android Package



• Two step process
    • apk to dex conversion
    • dex to java conversion
Reversing the Android Package



• Demo 3
   • Let us now see how to reverse engineer an
     Android application package


 • <Take a .apk Android Package, demonstrate
   the reversing process to convert it to readable
   java files, show the sample vulnerability in the
   java file>
Platform Specific Issues
Platform Specific Issues



• Android the prime target of malwares
 • ZITMO
 • Android Market had malicious apps


• Apple iOS
 • iOS URL Schemes
 • Screenshot Caching issue
Malware: ZITMO


• User logs in to his banking application
• ZITMO, in background, listens to the incoming
  SMS
• ZITMO obtains the SMS
• ZITMO forwards the SMS to the attacker’s web
  address
• SMS contains the one time password (the
  second factor of the two factor authentication)
• Attacker can use it to bypass the two factor
  authentication
Android Market



• Recently, Google Android Market was in
  news for distributing Malicious Applications
• Google had to remove these infected
  applications from the Market
• Lack of Proper Vetting Process by Google,
  as opposed to Apple App Store
• Experts have advised Google for
  establishing the same
iOS URL Schemes



• iOS URL schemes
 • URL schemes are used for web server
   connections, without additional parameters
 • This involves sending the required parameters
   in the URL, which makes it a vulnerable
   implementation
 • Sometimes username-password is also send
   this way
 • Prefer other implementations, if easily
   possible without URL schemes
iOS Screenshot Caching


• Whenever users press the Home button
  while using an Application
   • iOS takes screenshot of application
   • This is required for the zoom-out animation while
     leaving the app
   • This same screenshot used to simulate zoom-in
     animation while returning to app
   • This is store in the device memory and can be
     used by anyone having access to rooted device
• Black out the View whenever Home button
  is pressed while using the application.
Securing Mobile Applications
Security Best Practices


• Do not hardcode sensitive information
• Do not store sensitive information locally
• If required to be stored, do not store at
  easily readable location like memory card.
• Encrypt the stored data
• Implement SSL
• Protect the webserver against application
  layer attacks
Security Best Practices


• Sanitize inputs, use prepared statements
  (protection against client side injection)
• Implement Proper Authentication. Do not
  use UDID or other hardware IDs for auth.
• Prefer encryption over encoding or
  obfuscation
OWASP Mobile Top 10 Risks
References



• Android official documentation
• Apple iOS code guide
• OWASP Mobile Top 10 Project
• Palisade – The application security
  magazine
• GoatDroid Project
• iGoat Project
Thank you
                         Prashant Verma
      Security Consultant & Competency Lead
               verma.prashantkumar@gmail.com

More Related Content

PDF
Mobile Application Pentest [Fast-Track]
PPTX
Android pen test basics
PPTX
Pentesting Android Apps
PPTX
Android Application Penetration Testing - Mohammed Adam
PDF
Hacking android apps by srini0x00
PPT
Mobile Application Security – Effective methodology, efficient testing!
PDF
Andriod Pentesting and Malware Analysis
PDF
Android security and penetration testing | DIVA | Yogesh Ojha
Mobile Application Pentest [Fast-Track]
Android pen test basics
Pentesting Android Apps
Android Application Penetration Testing - Mohammed Adam
Hacking android apps by srini0x00
Mobile Application Security – Effective methodology, efficient testing!
Andriod Pentesting and Malware Analysis
Android security and penetration testing | DIVA | Yogesh Ojha

What's hot (20)

PDF
Security testing in mobile applications
PDF
My Null Android Penetration Session
PPTX
Hacker Halted 2014 - Reverse Engineering the Android OS
PDF
Android Hacking
PPTX
Hacking Mobile Apps
PPTX
Android Hacking + Pentesting
PDF
Mobile Hacking
PDF
Hacking your Android (slides)
PDF
2015.04.24 Updated > Android Security Development - Part 1: App Development
PDF
Android Security Development
PDF
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
PDF
iOS Application Penetration Testing
PPTX
[Wroclaw #1] Android Security Workshop
PPTX
iOS Security and Encryption
PDF
I Want More Ninja – iOS Security Testing
PDF
Android Security & Penetration Testing
PDF
Android Security - Common Security Pitfalls in Android Applications
PPTX
Owasp mobile top 10
PDF
Hacking and Securing iOS Apps : Part 1
PDF
Android system security
Security testing in mobile applications
My Null Android Penetration Session
Hacker Halted 2014 - Reverse Engineering the Android OS
Android Hacking
Hacking Mobile Apps
Android Hacking + Pentesting
Mobile Hacking
Hacking your Android (slides)
2015.04.24 Updated > Android Security Development - Part 1: App Development
Android Security Development
Owasp Mobile Risk M2 : Insecure Data Storage : null/OWASP/G4H Bangalore Aug 2014
iOS Application Penetration Testing
[Wroclaw #1] Android Security Workshop
iOS Security and Encryption
I Want More Ninja – iOS Security Testing
Android Security & Penetration Testing
Android Security - Common Security Pitfalls in Android Applications
Owasp mobile top 10
Hacking and Securing iOS Apps : Part 1
Android system security
Ad

Viewers also liked (7)

PDF
Mobile Penetration Testing: Episode II - Attack of the Code
PDF
Gursev kalra _mobile_application_security_testing - ClubHack2009
PPT
iOS Application Pentesting
PPTX
iOS-Application-Security-iAmPr3m
PPTX
Pentesting iOS Applications
PPTX
Owasp Mobile Risk Series : M4 : Unintended Data Leakage
PDF
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Mobile Penetration Testing: Episode II - Attack of the Code
Gursev kalra _mobile_application_security_testing - ClubHack2009
iOS Application Pentesting
iOS-Application-Security-iAmPr3m
Pentesting iOS Applications
Owasp Mobile Risk Series : M4 : Unintended Data Leakage
Owasp Mobile Risk Series : M3 : Insufficient Transport Layer Protection
Ad

Similar to Pentesting Mobile Applications (Prashant Verma) (20)

PDF
Info security - mobile approach
PPT
Mobile code mining for discovery and exploits nullcongoa2013
PDF
CNIT 128 8: Mobile development security
PPTX
Virtue Security - The Art of Mobile Security 2013
PPTX
Pentesting iPhone applications
PDF
Mobile Application Security Code Reviews
PDF
Smart Bombs: Mobile Vulnerability and Exploitation
PPTX
Building a Mobile Security Program
PDF
Designing Secure Mobile Apps
PPTX
Mobile application security
PPTX
Mobile Application Security
PDF
C0c0n 2011 mobile security presentation v1.2
PPT
Mobile Apps Security
PDF
A tale of mobile threats
PDF
Mobile Threats and Owasp Top 10 Risks
PPTX
Android Security and Peneteration Testing
PDF
There's an App for That: Digital Forensic Realities for Mobile App Evidence, ...
PPTX
How iOS and Android Handle Security Webinar
PPTX
Windows Phone 8 Security and Testing WP8 Apps
PDF
Les 10 risques liés aux applications mobiles
Info security - mobile approach
Mobile code mining for discovery and exploits nullcongoa2013
CNIT 128 8: Mobile development security
Virtue Security - The Art of Mobile Security 2013
Pentesting iPhone applications
Mobile Application Security Code Reviews
Smart Bombs: Mobile Vulnerability and Exploitation
Building a Mobile Security Program
Designing Secure Mobile Apps
Mobile application security
Mobile Application Security
C0c0n 2011 mobile security presentation v1.2
Mobile Apps Security
A tale of mobile threats
Mobile Threats and Owasp Top 10 Risks
Android Security and Peneteration Testing
There's an App for That: Digital Forensic Realities for Mobile App Evidence, ...
How iOS and Android Handle Security Webinar
Windows Phone 8 Security and Testing WP8 Apps
Les 10 risques liés aux applications mobiles

More from ClubHack (20)

PDF
India legal 31 october 2014
PPTX
Cyberlaw by Mr. Pavan Duggal at ClubHack Infosec KeyNote @ Bangalore
PPT
Cyber Insurance
PPTX
Summarising Snowden and Snowden as internal threat
PPTX
Fatcat Automatic Web SQL Injector by Sandeep Kamble
PDF
The Difference Between the Reality and Feeling of Security by Thomas Kurian
PDF
Stand Close to Me & You're pwned! Owning Smart Phones using NFC by Aditya Gup...
PPTX
Smart Grid Security by Falgun Rathod
PPTX
Legal Nuances to the Cloud by Ritambhara Agrawal
PPT
Infrastructure Security by Sivamurthy Hiremath
PDF
Hybrid Analyzer for Web Application Security (HAWAS) by Lavakumar Kuppan
PPTX
Hacking and Securing iOS Applications by Satish Bomisstty
PPTX
Critical Infrastructure Security by Subodh Belgi
PPTX
Content Type Attack Dark Hole in the Secure Environment by Raman Gupta
PDF
XSS Shell by Vandan Joshi
PDF
Clubhack Magazine Issue February 2012
PDF
ClubHack Magazine issue 26 March 2012
PDF
ClubHack Magazine issue April 2012
PDF
ClubHack Magazine Issue May 2012
PDF
ClubHack Magazine – December 2011
India legal 31 october 2014
Cyberlaw by Mr. Pavan Duggal at ClubHack Infosec KeyNote @ Bangalore
Cyber Insurance
Summarising Snowden and Snowden as internal threat
Fatcat Automatic Web SQL Injector by Sandeep Kamble
The Difference Between the Reality and Feeling of Security by Thomas Kurian
Stand Close to Me & You're pwned! Owning Smart Phones using NFC by Aditya Gup...
Smart Grid Security by Falgun Rathod
Legal Nuances to the Cloud by Ritambhara Agrawal
Infrastructure Security by Sivamurthy Hiremath
Hybrid Analyzer for Web Application Security (HAWAS) by Lavakumar Kuppan
Hacking and Securing iOS Applications by Satish Bomisstty
Critical Infrastructure Security by Subodh Belgi
Content Type Attack Dark Hole in the Secure Environment by Raman Gupta
XSS Shell by Vandan Joshi
Clubhack Magazine Issue February 2012
ClubHack Magazine issue 26 March 2012
ClubHack Magazine issue April 2012
ClubHack Magazine Issue May 2012
ClubHack Magazine – December 2011

Recently uploaded (20)

PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Big Data Technologies - Introduction.pptx
PPTX
MYSQL Presentation for SQL database connectivity
PDF
KodekX | Application Modernization Development
PDF
Machine learning based COVID-19 study performance prediction
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Empathic Computing: Creating Shared Understanding
PPTX
Cloud computing and distributed systems.
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
MYSQL Presentation for SQL database connectivity
KodekX | Application Modernization Development
Machine learning based COVID-19 study performance prediction
Advanced methodologies resolving dimensionality complications for autism neur...
The AUB Centre for AI in Media Proposal.docx
Spectral efficient network and resource selection model in 5G networks
Empathic Computing: Creating Shared Understanding
Cloud computing and distributed systems.
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
20250228 LYD VKU AI Blended-Learning.pptx
Chapter 3 Spatial Domain Image Processing.pdf
How UI/UX Design Impacts User Retention in Mobile Apps.pdf

Pentesting Mobile Applications (Prashant Verma)

  • 1. Pentesting Mobile Applications Prashant Verma Security Consultant & Competency Lead
  • 3. Types of Mobile Applications • Browser based Mobile Applications (WAP) • Installed Applications
  • 4. Android architecture • DVM • ~JVM • dex files • Sandboxing • Apps run with its user, group • Apps may share data, if run with same user
  • 5. iOS Architecture  Core OS & Core Services – Low level file handling, network Sockets etc. Include Technologies like Core Foundation, CFNetwork, SQLite etc Written in C  Media Layer – Supports audio and 2D and 3D video  Cocoa Touch Layer – Provides infrastructure used by applications. Contains the UIKit Framework Written in Objective-C
  • 6. Pentesting Mobile Applications • Reading Stored Data • Capturing Requests • Reversing the Application Package • Platform Specific Issues
  • 8. Reading Stored Data • Mobile applications store data in local memory of handset • This data is stored by developers in files locally and is used by the application • Look out for the persistent stored information in the mobiles for sensitive data (pwd, keys, account details etc.) • This may involve hacking / jailbreaking the phone
  • 9. Reading Stored Data: Android • Android Applications store the data in directory /data/data/[PACKAGE_NAME] • sharedpreferences • Context.MODE_PRIVATE • Context.MODE_WORLD_READABLE • Context.MODE_WORLD_WRITEABLE • Files may be stored using the filesystem at /data/data/[PACKAGE_NAME]/files/filenam • Storage in the SQLite databases • Can be read using SQLite browser
  • 10. Reading Stored Data: Android • Demo 1 • Let us see how the stored data can be accessed in an Android phone • <Connect the phone via USB debugging mode, show the storage directory in Android, browser to show the different storage formats, read the files, read the databases using SQLite browser>
  • 11. Reading Stored Data: iOS • iPhone too stores the data in the application directory • /private/var/mobile/Applications/ApplicationID/ • Plist files ..can be read using • Property List Editor • plutil • Sqlite databases • Same procedure to read as Android
  • 13. Capturing The Traffic • Capture HTTP requests & responses • Carry out Parameter Manipulation and other attacks • Set up a proxy in between the server & the client to intercept. • This can be achieved by • Proxying the real devices • Proxying the emulators
  • 14. Capturing The Traffic : Android • Proxying Android Device • Root your phone  • Install Superuser • Install a proxy tool like ProxyDroid or Auto Proxy • Set the proxy IP address & port no. • Emulators can also be proxied
  • 16. Capturing The Traffic : iPhones • Proxying Apple iPhone / iPAD • Setup a proxy ipaddress and port for the wifi connection • Entire traffic is routed through this proxy • Proxying Simulators • Open the Simulator within the xcode IDE • GUI option to set proxy ipaddress and port
  • 17. Capturing The Traffic: iPhones • Demo 2 • Let us now see how to proxy an iPhone device to capture the traffic • <connect the phone & laptop to the wifi, setup laptop as proxy for the phone, show the captured traffic in the laptop, demonstrate the parameter manipulation attack>
  • 20. Reversing the Application Package • Reverse Engineer the application logic and source code • Identify the flaws in the code base to exploit them • Look for sensitive data like passwords, encryption algorithms and keys • Nokia jar files & Android apk packages are easy to reverse
  • 21. Reversing the Android Package • Two step process • apk to dex conversion • dex to java conversion
  • 22. Reversing the Android Package • Demo 3 • Let us now see how to reverse engineer an Android application package • <Take a .apk Android Package, demonstrate the reversing process to convert it to readable java files, show the sample vulnerability in the java file>
  • 24. Platform Specific Issues • Android the prime target of malwares • ZITMO • Android Market had malicious apps • Apple iOS • iOS URL Schemes • Screenshot Caching issue
  • 25. Malware: ZITMO • User logs in to his banking application • ZITMO, in background, listens to the incoming SMS • ZITMO obtains the SMS • ZITMO forwards the SMS to the attacker’s web address • SMS contains the one time password (the second factor of the two factor authentication) • Attacker can use it to bypass the two factor authentication
  • 26. Android Market • Recently, Google Android Market was in news for distributing Malicious Applications • Google had to remove these infected applications from the Market • Lack of Proper Vetting Process by Google, as opposed to Apple App Store • Experts have advised Google for establishing the same
  • 27. iOS URL Schemes • iOS URL schemes • URL schemes are used for web server connections, without additional parameters • This involves sending the required parameters in the URL, which makes it a vulnerable implementation • Sometimes username-password is also send this way • Prefer other implementations, if easily possible without URL schemes
  • 28. iOS Screenshot Caching • Whenever users press the Home button while using an Application • iOS takes screenshot of application • This is required for the zoom-out animation while leaving the app • This same screenshot used to simulate zoom-in animation while returning to app • This is store in the device memory and can be used by anyone having access to rooted device • Black out the View whenever Home button is pressed while using the application.
  • 30. Security Best Practices • Do not hardcode sensitive information • Do not store sensitive information locally • If required to be stored, do not store at easily readable location like memory card. • Encrypt the stored data • Implement SSL • Protect the webserver against application layer attacks
  • 31. Security Best Practices • Sanitize inputs, use prepared statements (protection against client side injection) • Implement Proper Authentication. Do not use UDID or other hardware IDs for auth. • Prefer encryption over encoding or obfuscation
  • 32. OWASP Mobile Top 10 Risks
  • 33. References • Android official documentation • Apple iOS code guide • OWASP Mobile Top 10 Project • Palisade – The application security magazine • GoatDroid Project • iGoat Project
  • 34. Thank you Prashant Verma Security Consultant & Competency Lead verma.prashantkumar@gmail.com