This site is the archived OWASP Foundation Wiki and is no longer accepting Account Requests.
To view the new OWASP Foundation website, please visit https://owasp.org

Difference between revisions of "Android Testing Cheat Sheet"

From OWASP
Jump to: navigation, search
(Testing Methodology)
(Testing Methodology)
Line 10: Line 10:
  
 
== Testing Methodology ==
 
== Testing Methodology ==
[[File:Screen Shot 2017-02-22 at 1.20.22 PM.png]]
+
[[File:Android Pentest.png]]
  
 
A complete android pen testing involves different areas such as the ones described in the above picture
 
A complete android pen testing involves different areas such as the ones described in the above picture

Revision as of 11:23, 24 February 2017

Cheatsheets-header.jpg

Last revision (mm/dd/yy): 02/24/2017

Introduction

This cheat sheet provides a checklist of tasks to be performed to do a penetration test of an Android application. It follows the OWASP Mobile Top 10 Risks list.

Testing Methodology

Android Pentest.png

A complete android pen testing involves different areas such as the ones described in the above picture

Application Mapping

In this first phase, the focus relies on understanding the application logic and what exactly the application does. This involves some manual test where we do some basic operations such as install the APK on the phone, login and comprehend the functionality of the app

Client Attacks

This is one of the most challenging and exciting parts of the pentest assessment. Android apps are packed as an APK, also known as Android Package Kit or Android Application Package. Our mission as Pen testers is to verify how well protected the application has been created and designed against known threat actors.Android Mobile applications are distributed through platforms like Google Play. Since the application is fully installed on the client, it becomes vulnerable to any attacks coming from the client.

Network Attacks

As we need to identify vulnerabilities in the Client, is also essential to verify how secure is the communication between the Client and the Server by evaluating the traffic. For this purpose,musing tools like Attack proxies, evaluating potential SSL issues, and executing Wireshark Data package inspection is an essential part of the assessment.

Server Attacks

Last but not least, issues at the Server level will impact the security of the application. Insecure implementation such as misconfigurations , vulnerabilities and issues at API or Database level, affect also the security of an application

At the device level, there are 2 ways in which the application shall be tested. Reverse Engineering is an essential part of pen testing mobile applications. It also requires the use of rooted devices. If you have been wondering why do we need to Reverse Engineer an installed APK, the major reason relies on the client.



  1. With Android device running in a factory default or normal mode
  2. With Android device running in a rooted mode

At the application level, there are 2 ways in which it shall be tested

  1. Application running on the device (to take benefits of touch related features)
  2. Application running on the emulator (to ease the task of testing using wider screen of desktop or laptop)

Application Mapping

Map the application for possible security vectors

  1. What is the application genre ? (Game, business, productivity etc)
  2. Does the application connect to backend web services?
  3. Is the application purely native or incorporates readymade frameworks?
  4. Does the application store data on the device?
  5. What all features of the device are used by the application? (camera, gyroscope, contacts etc)

OWASP Step-by-step Approach

(For each of the standards below, there shall be multiple steps for the tester to follow])

M1 - Weaker Server side controls

M2 - Insecure Data storage

This Section should be ideally tested after using the application for some time. This way application has time to store some data on the disk.

Commonplaces to look at

  • /data/data/app_folder
  • /sdcard/
  • /sdcard1/

M3 - Insufficient Transport Layer

Multiple layer of checks to be performed here

1. On Server side

  • Identify all ssl endpoints.
  • Perform SSL Cipher Scan using (sslscan)[1] or similar software.
  • SSLv2, SSLv3 is disabled
  • TLS 1.2, 1.1 and 1.0 is supported (1.2 is essential to ensure highest possible secure connection)
  • RC4 and CBC Based Ciphers are disabled
  • DH Params are >2048 Bits
  • SSL Certificate is signed with atleast sha2 / sha256
  • ECDHE Ciphers / Ciphers supporting Perfect forward secrecy are preferred
  • SSL Certificate is from Trusted RootCA
  • SSL Certificate is not expired

2. On Device Side

  • Ensure application is working correctly by navigating around.
  • Put a proxy in between the application and remote server. If application fails to load. Application might be doing cert validation. Refer logcat if any message is printed.
  • Place Proxy RootCA in trusted root CA list in device. (Burp)[2] (OWASP-ZAP)[3]
  • Try using application again. If application still doesn't connect, application might be doing cert pinning.
  • Install (Xposed Framework)[4] and (Just Trust Me)[5], enable JustTrustMe and then reboot device.
  • Try again if everything works we have a application which employee's cert pinning.

M4 - Unintended Data Leakage

Simmilar to M2 this section requires application to be used however while the application is in use we need to monitor following places.

  • adb logcat output
  • cache and webcache folder locations

M5 - Poor Authorization and Authentication

One of the simplest check's to be performed after application is used for some time and it has time to put the data inside system.

  • enumerate all exported activities
  • start each activity and identify if the activity was suppose to be publicly accessible or not.
  • Any activity displaying confidential information should be behind authentication. (confidential information includes PII (Personally identifiable data), financial data etc)

M6 - Broken Cryptography

There are multiple things to look at

  • Usage of known weak crypto algo's like Rot13, MD4, MD5, RC2, RC4, SHA1
  • Do it Yourself / let me design my own algo for encryption
  • Secret key hard coded in the application code itself.

M7 - Client Side Injection

Android applications need to store data locally in sqlite files or XML structures and hence need to performs either SQL/XML Queries or file I/O.

This gives rise to 2 major issues.

  1. SQL / XML injection, and if the reading intent is publicly exposed another application could read this.
  2. Local file read which can allow other application to read files of the application in question and if they contain sensitive data then data leakage via this media.

If the application is a HTML5 hybrid application then Cross Site Scripting (XSS) should also be considered. XSS will expose the entire application to the attacker as HTML5 applications will have the ability to call native functionality and hence control over the entire application.

M8 - Security Decisions via untrusted inputs

M9 - Improper Session Handling

Improper Session Handling typically results in the same outcomes as poor authentication. Once you are authenticated and given a session, that session allows one access to the mobile application. There are multiple things to look at

  • Check and validate Sessions on the Backend
  • Check for session Timeout Protection
  • Check for improper Cookies configuration
  • Insecure Token Creation

M10 - Lack of Binary Protection

Android Binaries are basically dex classes, which if not protected can result in an easy decompilation of source code. This could lead to code / logic leakage.

Following controls need to be checked for and validated:

  • Jailbreak Detection Controls
  • Checksum Controls
  • Certificate Pinning Controls
  • Debugger Detection Controls

References

(OWASP M10-2014)[6]

Authors and Primary Editors

  • Jonathan Carter
  • Prashant Phatak
  • Milan Singh Thakur
  • Anant Shrivastava

Other Cheatsheets