Android Hacking Masterclass | The only guide you need to secure your android apps

Divyansh Dwivedi
6 min readOct 30, 2023

--

Android Hacking Masterclass

In the ever-evolving world of mobile app development, one aspect remains a constant concern: security. As the Android platform continues to dominate the market, understanding the intricacies of Android app security becomes paramount for both developers and security researchers. Welcome to Android Hacking Masterclass series. This series will delve deep into the multifaceted realm of Android app security, equipping you with the knowledge and skills to secure your apps and, for some, even launch a career in Android bug bounty.

This blog is particularly focused to help people who :

  1. Are either security researchers / pentesters / bug bounty hunters who would like to know more about Android security or get into Android bug bounty.
  2. Are experienced Android developers who would want to learn about securing their android apps

Who this blog is not for ?

  1. You are just beginning out your Android journey : If you are just starting out developing apps on android, you can still read the blog, but to make the most of this series, you must have at least an intermediate level of android development experience.

So, now we have our target audience let’s get started !

Now, first questions first …

Why care about security in android apps in the first place ?

The infamous case of the “Joker” malware serves as a poignant illustration. This malicious app found its way onto the Google Play Store, infecting countless devices and silently subscribing victims to premium services without their consent, costing them both money and trust. Such incidents showcase how security flaws can lead to catastrophic consequences, eroding user trust and incurring substantial financial and legal penalties.

Mobile phones in the current day, are the single source of truth for almost anyone in this world. Consider yourself ! Don’t you have any private information stored on your mobile device ? What if I can get to that ? Would caring about security matter then ? Obviously, mobile devices have multiple security measures to help prevent such data breaches !

Still, having a control of your device through a malicious app is not as difficult as one might think !

Now, one might think that …

How does having a security flaw in an app can lead to compromising the user’s device ?

Well, valid question. Hacking in the real world does not happen as one might imagine, or definitely not how they show it in the movies. It is much more sophisticated.

So, let’s go over a particular case, where I myself found a bug. I was pentesting on a german app. It had a classic misconfigured permission vulnerability. That app had permission to read and write to external storage, and they hadn’t configured the permission properly. That means, I/other apps could use their app to read and write to the external storage. So that would mean, a user would install a malicious app (which would obviously not appear malicious, in real world scenario if it was a real attack and neither it would ask for any permission from the user to use their external storage), but still it would use the vulnerable app’s permission to get the user’s data, and then send it to the attacker.

Vulnerabilities like these keep on arising from time to time, and as a security researcher one must know how to protect against them and as a developer one must know how to prevent them all together.

I mean there must be some reason that our favorite Zomato offers such large bounties for finding bugs in their app right ?

Zomato bug bounty program

Even google has a proper bug bounty partner program where you are paid to find bugs and secure apps on google play store (even the apps which are not made by google) . You can check that out here.

So, now that we are on the same page about the importance of security in Android apps, let me tell you a little more about this masterclass. This would a series of free-to-read blog articles. Here is what we will be covering in this series ?

1. Understanding the basics of Android App Security

Android app security goes beyond just protecting data; it’s about safeguarding the trust of millions of users. Understanding the basic principles is the first step to building secure, resilient apps. We’ll explore the underlying architecture that forms the backbone of Android’s security model. This includes the kernel, native libraries, and application framework, all working together to ensure the platform’s security.

2. Key Security Components in Android & Security Metrics: The Foundation of App Security

Uncover the various security components and features within the Android ecosystem. We’ll dive into elements like Android’s sandboxing, cryptographic tools, and the Android Debug Bridge (ADB). Security metrics are our measure of an app’s vulnerability and resilience. They form the backbone of evaluating an app’s security posture. We’ll discuss why security metrics are not just a “nice to have,” but a necessity for developers and security researchers. They help us identify and mitigate risks effectively. Explore how security metrics act as a mirror, reflecting an app’s strengths and weaknesses. We’ll break down the metrics that matter most and how they contribute to overall resilience. The threat landscape is constantly evolving. We’ll establish the vital connection between security metrics and understanding the ever-changing challenges posed by malicious actors.

3. Authentication and Authorization

Authentication and authorization are fundamental to app security. We’ll explore how these processes verify user identities, control access, and protect sensitive data.

4. Android’s Permission System & Proper Permission Handling

One of the key defenses in Android app security is its permission system. Learn how this system works, and discover the critical role it plays in keeping user data and devices secure. Android’s permission system is an integral part of app security. We’ll explore best practices for requesting, managing, and auditing permissions, emphasizing user privacy and security.

5. Data Encryption, Code Obfuscation and Tamper Detection

Data encryption is your app’s shield against data breaches. Learn about encryption at rest and in transit, and how the Android Keystore plays a pivotal role in key management. Code obfuscation and tamper detection are techniques that protect your intellectual property. Learn about their significance and how to use them effectively.

6. Secure Network Communication

Ensuring secure data transmission is critical. Discover the best practices for securing network communication, including HTTPS implementation and certificate pinning.

7. Secure Coding Practices

The security of your app often depends on the code you write. We’ll provide insights into secure coding practices, highlighting common vulnerabilities and how to avoid them. Incorporating third-party libraries is common, but it introduces risks. We’ll guide you through evaluating library security, integration, and ongoing maintenance.

Right now I have planned this, but I’ll keep on updating the content as per the reaction I get to this series. There are a lot more concepts and content that I would love to cover. If this series get’s enough positive feedback, I’ll add more content to this series.

8. Hands on Android Hacking Masterclass

Finally, we have learnt about almost everything there is to know in android hacking. Now, we’ll do a lot of practical exercises to get us ready for the real world. We will hack on a lot of different applications and play CTF’s so that we can get ready for the real world of android security. This would be by far the most interesting and engaging section of the entire masterclass series. This section is the one, I had most fun creating.

What do I aim to get out of this ?

Well, nothing as per say. I’ll be honest here. I have spent a lot of time learning about android and security. I wish to give it back to the community. With this series I just want to share my knowledge with the world and hopefully helping at least 1 person. Let’s see where does this go !

Hacking Begins

So, that all being said, I now finally want to officially start this series. So let’s dive right in. Go ahead and hop on to the first section of this series “Understanding the basics of Android App Security”.

--

--

Divyansh Dwivedi

SSE-1 @ Ninjavan | Founder @Animeclassroom | Team Lead (Android) @ GMP | Security Researcher | Author | Tech Strategist