Sunday, November 24, 2024
HomeAndroidAndroid Application Penetration Testing - Part 6

Android Application Penetration Testing – Part 6

Published on

Let the fun begins. As per Owasp, Vulnerabilities has been categorized as TOP 10.

M1 – Improper Platform Usage                                      M6 – Insecure Authorization

M2 – Insecure Data Storage                                          M7 – Client Code Quality

- Advertisement - SIEM as a Service

M3 – Insecure Communication                                      M8 – Code Tampering

M4 – Insecure Authentication                                        M9 – Reverse Engineering

M5 – Insufficient Cryptography                                      M10 – Extraneous Functionality

Also for practice collection of vulnerable Applications-pentestlab.blog

We are using Insecure bank Android Application to demonstrate vulnerabilities-

Information gathering

By using drozer we can gather information about Android application

Command – run app.package.info –a <.apk name>

Details – UID, GID, Users Permissions, Data directory, Apk Path, shared libraries, shared users, version and Application name.

Attacking Android Components

As I have defined all Android components Activities, services, Content provider and broadcast receivers in https://gbhackers.com/android-application-penetration-testing-part-5/ now we can look for their loopholes and how those components might vulnerable in an application.

  • Attacking activities 

Exported Activities

Exported Activities (exported = True) are those activities which can be accessed by other application on the same device. Most of the time after authentication on an Android

Application, it shifts to a new activity which basically users are aware off (like music playlist after your music player login). But developers keep those activities exported and even without custom permissions.

In Android manifest file, Activities are mentioned with exported value or by using drozer commands.

We can get information about exported activities.

Command – run App.activity.info –a <.apk name>

Manifest file

<activity android:label=”@7F070040″ android:name=”com.android.insecurebankv2.LoginActivity”><intent-filter><action android:name=”android.intent.action.MAIN”><activity android:label=”@7F070040″ android:name=”com.android.insecurebankv2.LoginActivity”><intent-filter><action android:name=”android.intent.action.MAIN”> </action><category android:name=”android.intent.category.LAUNCHER”> </category></intent-filter></activity><activity android:label=”@7F070057″ android:name=”com.android.insecurebankv2.FilePrefActivity” android:windowSoftInputMode=”0x00000034″> </activity><activity android:label=”@7F070054″ android:name=”com.android.insecurebankv2.DoLogin”> </activity><activity android:label=”@7F07005B” android:name=”com.android.insecurebankv2.PostLogin” android:exported=”true”> </activity><activity android:label=”@7F07005E” android:name=”com.android.insecurebankv2.WrongLogin”> </activity><activity android:label=”@7F070055″ android:name=”com.android.insecurebankv2.DoTransfer” android:exported=”true”> </activity><activity android:label=”@7F07005D” android:name=”com.android.insecurebankv2.ViewStatement” android:exported=”true”> </activity>

Drozer

As permissions are not defined or exported value is true for activities after post login, we can use this to bypass the authentication.

Let’s try to call post login activities without credentials using drozer.

Example – Dotransfer, Viewstatement, Changepassword

Command in drozer – run app.activity.start –component <.apkname>< activityname>

run app.activity.start –component com.android.insecurebankv2 com.android.insecurebankv2.DoTransfer

Before 

After

 Demo 

Using Malicious App to invoke Activities of other apps

Another way of invoking other application’s activities is to write a malicious app and feed it with the name of the package and activity to be launched. In our case, the malicious app doesn’t require any permission to launch the “Post login” activities of the vulnerable app.

Securing the Activity component

Setting android: exported attribute’s value to false

In the AndroidManifest.XML file of our application, we should add the following attribute to the application component to be secured. In our case after post login activities should be secured.

<activity android: label=”@7F070055″ android: name=”com.android.insecurebankv2.DoTransfer” android: exported=”false“></activity>

True: The provider is available to other applications. Any application can use the provider’s content URI to access it, subject to the permissions specified for the provider.

False: The provider is not available to other applications. Set android: exported=”false” to limit access to the provider to your applications. Only applications that have the same user ID (UID) as the provider will have access to it.

The above code restricts other applications or any system component other than the current app from accessing this Activity. Only applications that have the same user id as the current app will be able to access this Activity.

Limiting access with custom permissions

The android: exported attribute is not the only way to limit an activity’s exposure to other applications. We can also impose permission-based restrictions by defining custom permissions for an activity. This is helpful if the developer wants to limit the access to his app’s components to those apps which have permissions.

This is helpful if the developer wants to limit the access to his app’s components to those apps which have permissions.

Other Parts

Latest articles

Nearest Neighbor Attacks: Russian APT Hack The Target By Exploiting Nearby Wi-Fi Networks

Recent research has revealed that a Russian advanced persistent threat (APT) group, tracked as...

240+ Domains Used By PhaaS Platform ONNX Seized by Microsoft

Microsoft's Digital Crimes Unit (DCU) has disrupted a significant phishing-as-a-service (PhaaS) operation run by...

Russian TAG-110 Hacked 60+ Users With HTML Loaded & Python Backdoor

The Russian threat group TAG-110, linked to BlueDelta (APT28), is actively targeting organizations in...

Earth Kasha Upgraded Their Arsenal With New Tactics To Attack Organizations

Earth Kasha, a threat actor linked to APT10, has expanded its targeting scope to...

Free Webinar

Protect Websites & APIs from Malware Attack

Malware targeting customer-facing websites and API applications poses significant risks, including compliance violations, defacements, and even blacklisting.

Join us for an insightful webinar featuring Vivek Gopalan, VP of Products at Indusface, as he shares effective strategies for safeguarding websites and APIs against malware.

Discussion points

Scan DOM, internal links, and JavaScript libraries for hidden malware.
Detect website defacements in real time.
Protect your brand by monitoring for potential blacklisting.
Prevent malware from infiltrating your server and cloud infrastructure.

More like this

Google Unveils New Intelligent, Real-Time Protections for Android Users

Google has once again raised the bar for mobile security by introducing two new...

New Android Malware SpyAgent Taking Screenshots Of User’s Devices

SpyAgent, a newly discovered Android malware, leverages OCR technology to extract cryptocurrency recovery phrases...

ToxicPanda Banking Malware Attacking Banking Users To Steal Logins

Recent research has uncovered a new strain of malware developed for Android devices, initially...