Android Pentesting 101 — Part 1 - Pentestmag

Android Pentesting 101 — Part 1

Android Pentesting 101 — Part 1

by Vaibhav Lakhani and Dhir Parmar

Welcome to this new series of Android Pentesting. This series is about how you can hack into Android and find vulnerabilities in it using various methods. In this series, we aim to achieve all the vulnerabilities which you can find along with the methodology. In the first part, we aim to cover a basic description of how android pentesting is done and all the tools required to perform it. So, Gear Up and load your arsenals!!!

Coming to the very basics, Mobile applications are generally of 3 types:

  • Native Applications: These are mobile applications developed for a particular Operating System (OS) or a Platform. They usually need an emulator and web-based attacks (such as XSS) are not possible on this kind of application.
  • Web-Based Applications: These are browser-based applications and generally use WebView (a system component in Android) to display web pages on Android Operating System. They do not need an emulator and web-based attacks (such as XSS) are possible.
  • Hybrid Applications: As the name suggests these are the combination of the above two applications and usually require an emulator for testing. These are the applications that you will find in the real world.

Now, before we learn about android pentesting, it is very important to know how Android Architecture works. I will be giving a short description of each component, but if you want to dig in more you can learn it from here.

  • Applications: The topmost layer of the architecture where all 3rd Party Applications are installed. Examples include Camera, WhatsApp, Google, etc.
  • Application Framework: This is the layer that provides various classes for the creation of the Android Application. Examples Activity Manager, Content Provider, etc.
  • Android Runtime: The most important layer consists of the Dalvik VM. Dalvik Virtual Machine (DVM) is similar to JVM which enables the applications to run and provides various platform libraries such as SSL, SQLite, Media, etc.
  • Linux Kernel: This is the heart of the android architecture and provides features such as security, memory management, process management, etc.

Now let's quickly have a sneak peek at various Android Components.

  • Activity: These are java classes that have some predefined functions which are triggered at different app states. There are in total four app states: Active, Pause, Stop and Destroy. The different methods that can be invoked are onCreate(), onStart(), onResume(), onPause(), onStop(), onDestroy(). Think of a scenario when sensitive data is being transmitted and the onPause() method appears and after n seconds onResume() method is called, how would the application handle the sensitive data then? This could be a good check case.
  • Services: These are operations that happen in the background and do not have a UI. Services are critical and should always be checked as attackers usually plant malware here. An example scenario would be a calculator application asking for call logs permission.
  • Intents: These are bound to different components in an application and are used to perform different kinds of actions and invoke activities in different applications. Intent filters are used to protect activities.
  • Content Providers: Acts as a middle layer to access data from various sources.
  • Broadcast Receivers: These receive broadcast messages from various events which could be from one or many applications. For example, when an application receives an SMS it sends a broadcast message to every other application.

Let’s now talk about the Android File System. The following are the folders found inside the file hierarchy:

  • /boot: Bootable files consisting of the Android kernel and ramdisk
  • /system: The entire Android OS is stored inside this folder. It also consists of the pre-installed system applications which are stored inside /system/app
  • /recovery: This folder is designed for backup and is considered as an alternate boot option.
  • /cache: This folder stores frequently accessed app data and components
  • /misc: Contains miscellaneous system settings
  • /sdcard: This folder is the space that is available to users to store their files and data.
  • /data: This particular folder consists of all user data.
    • /data/data: Consists of all applications data installed by the user
    • /data/app: Consists of all APKs of the application installed by the user
    • /data/system: Consists of files such as gesture.key, password.key
    • /data/local/tmp: Writeable temporary

Some certain important files and folders are generally created while the application's creation. In our android pentesting, having a look at these files and folders is critical. The different important files and folders are as follows:

  • AndroidManifest.xml: has the structure and metadata of the application. Usually, all permissions, API keys, etc. are stored inside this particular file.
  • Java: This particular folder contains the Java source code files.
  • drawable: All images, videos, gifs, etc. are stored inside this particular folder.
  • layout: A layout defines the visual structure for a user interface, such as the UI for an Android application.
  • mipmap: The image Asset folder that usually contains different icons.
  • colors.xml: Color resource file of the Android application.
  • strings.xml: String resource file of the Android application.
  • styles.xml: Styles resource file of the Android application.
  • build.gradle: This particular file is used to add various dependencies. This file also has the SDKVersion number and other important details.

So now let's talk about the final topic of the Android architecture the Android Data Storage Model. Android stores data in 5ways:

  • Shared Preferences: Store private data in key-value pairs on the device.
  • Internal Storage: Store private data on the device's memory.
  • External Storage: Store public data on the shared external storage.
  • SQLite Databases: Stored structured data on private databases.
  • Network Connection: Store data on the web with your Network Server.

We all know that once the Android application is created a .apk file is generated. Ever wondered what exactly is this .apk file?? Well, a .apk file is nothing but a zip file of the source code which contains all the resources, dex codes, assets, manifest files, etc. The following diagram shows how a Java Source Code is converted to an APK file.

Perfect! Now since we have learned the entire android architecture, let’s learn about how the actual pentesting methodology works!! There are two types of analysis which is usually done while performing Android pentesting.

  • Static Analysis: This means viewing the source code of the APK and finding out vulnerabilities by reviewing the APK. This is kinda similar to Source Code Review. We usually look out for different Intent functions, Sources, and Sinks, Dangerous Permissions, Hardcoded API Keys, etc. This was the reason we went into the details of the Android Architecture. (I know it is kinda long and boring but much needed as well :P)
  • Dynamic Analysis: Dynamic Analysis is all about playing with requests and responses. But here is a catch, like normal Web Pentesting, in Android (as well as iOS) the requests and responses are not caught directly. We first need to bypass Root Detection and then bypass SSL Pinning. We will be learning more about this in the upcoming articles.

Now its time to pick up your weapons ;) The following is a curated list of all the tools which are required to perform both Static as well as Dynamic Analysis.

  • An Android Device: Obviously, you require an Android Device to perform the testing. It can be a real android device or an emulator as well. If it is a real Android device, make sure that the Android device is rooted. Rooting can easily be performed using a tool called Magisk. For an emulator, you can use Genymotion. Sometimes emulators do lag and having a real android device is much more beneficial.
  • Android Debug Bridge (ADB): This is used to communicate with the device and perform debug operations on the device.
  • Dex2jar: Dex2jar is a wonderful tool that helps you to convert the dex code to jar format so that reading the source code is easier.
  • JD-GUI : JD-GUI is a tool that allows you to view the java source code of an APK file directly.
  • MobSF: MobSF is an all-in-one security tool that helps you to perform automatic static analysis and makes your work a lot simpler.
  • drozer: The Metasploit Framework(MSF)for Android security which allows you to find vulnerabilities and exploit them as well.
  • Frida: A tool that is going to help bypass a lot of things ;)
  • Objection: Another tool that will help us bypass a lot of things ;)
  • apksigner: Used to sign modified APKs.
  • Burp Suite: Oh! Don’t forget the GOD!!

That's all folks for Part One! We hope that you enjoyed this article! We will be back with another part soon, where we will show you'll the methodology of Static Analysis while performing Android Pentesting.

Happy Hunting!


Vaibhav Lakhani: Twitter, LinkedIn

Dhir Parmar: Twitter, LinkedIn

302Found: Twitter, LinkedIn

Originally published at:

November 16, 2022
Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments

© HAKIN9 MEDIA SP. Z O.O. SP. K. 2013

Privacy Preference Center


Cookies that are necessary for the site to function properly. This includes, storing the user's cookie consent state for the current domain, managing users carts to using the content network, Cloudflare, to identify trusted web traffic. See full Cookies declaration

gdpr, PYPF, woocommerce_cart_hash, woocommerce_items_in_cart, _wp_wocommerce_session, __cfduid [x2],


These are used to track user interaction and detect potential problems. These help us improve our services by providing analytical data on how users use this site.

_global_lucky_opt_out, _lo_np_, _lo_cid, _lo_uid, _lo_rid, _lo_v, __lotr
_ga, _gid, _gat, __utma, __utmt, __utmb, __utmc, __utmz


tr, fr