Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
Get access to immediate incident response assistance.
Get access to immediate incident response assistance.
Trustwave and Cybereason Merge to Form Global MDR Powerhouse for Unparalleled Cybersecurity Value. Learn More
As a mobile app tester, I have encountered numerous varied vulnerabilities. During one of my mobile engagements, I was able to achieve an Authentication Bypass by simply invoking each exposed Activity component of the Android application. The purpose of this post is to highlight this type of vulnerability that still exists in every Android application. While this type of issue isn’t widespread, understanding how this technique was used can help you understand how certain Android apps can leak critical information that can potentially lead to a compromise or breach.
Every Android app has three primary components:
Usually, Activities are called using Intents. An Intent is a messaging object used by the application to communicate with the different components. These components can be Activities, Services, or Broadcast Receivers. Intent Filters are typically defined in the AndroidManifest.xml file within the application. There are two types of Intent Filters:
When looking for Intents we can take advantage of we first have to examine the AndroidManifest.xml of the application. Every Android application has an AndroidManifest.xml, this is where you can see the important information about your app, such as package name and application ID, permissions, components, and device compatibility. Tools like “Apktool” (https://ibotpeaches.github.io/Apktool/) allow you to pull the manifest from an Android app “apk” file.
The screenshot below shows the AndroidManifest.xml of the app I was auditing. It shows the exported Activities being used in the application. One of the most common problems with Android components is the exported Activities, which often lead to malicious activity, remote code execution, and fake notifications just to name a few.
First, here's a brief background about this specific application. The mobile app is an internal messaging app developed specifically for communication within the company. It is designed to connect employees across the organization with the features of one-on-one messaging, group chat, and voice calls. The image below shows the login screen of the application. We will now try to invoke one of the Activities shown in the AndroidManifest.xml in Figure 1, by sending an Intent to the Activity and see what happens.
We will do this by using a root ADB shell connected to a device running the app and then running the command below. This will execute the Activity that you specified. For example, when looking at the listed Activities, MyChatRoomActivity is a UI that is intended for authenticated users. So, we are going to use MyChatRoomActivity to see if we can access it directly without logging in at all.
adb shell
su
generic_x86:/ $ am start -n com.app.uc/com.app.uc.ui.MyChatRoomActivity
Starting: Intent { cmp=com.app.uc/.ui.MyChatRoomActivity }
After executing the command from a root ADB shell, MyChatRoomActivity led us to the “My groups” chat panel of the app without providing any credentials (see Figure 3. Since this direct authentication bypass occurs by invoking one command which means the application activities do not check for a valid user session.
Figure 3: Logged in with no authentication
By using information contained in the AndroidManifest.xml via an adb shell anyone can explore an Android app for unintended behavior. While the Authentication Bypass here is an extreme example of the type of insecurities that can be found, this technique has been used to find and exploit Android app vulnerabilities for years.
App Developers should only export components that need to be exposed to other applications. This will limit what Activities are exposed in the AndroidManifest.xml. They should also stringently validate all data received in Intents. Where the application expects data to be passed from other applications, consider applying permissions to restrict which applications are allowed to do so. Developers can disable external exposure of any components by specifying android:exported=”false” in the application manifest.
https://developer.android.com/guide/topics/manifest/manifest-intro.html#perms
Trustwave is a globally recognized cybersecurity leader that reduces cyber risk and fortifies organizations against disruptive and damaging cyber threats. Our comprehensive offensive and defensive cybersecurity portfolio detects what others cannot, responds with greater speed and effectiveness, optimizes client investment, and improves security resilience. Learn more about us.
Copyright © 2024 Trustwave Holdings, Inc. All rights reserved.