Categories: Android

Android Application Penetration Testing – Part 10

Attacking Broadcast receiver:

A Broadcast Receiver is an Android Component which allows you to register for system or application events.We recommend reading Android Penetration Testing – Part 5 for more details with Broadcast Receiver

 Let’s examine android manifest

Broadcast receivers are generally registered in the following format. As we can see in android manifest file exported value = True for broadcast

The code seems insecure since the receiver is exported.

The parameters that are passed to the Broadcast Receiver can be seen below

The Goal is to send spoofed broadcast intents and see if the application is accepting them. If yes, we will exploit the application to send an SMS to some random mobile numbers using the fake broadcasts.

  • Attacking vulnerable broadcast receivers
  • Securing the applications

Attacking Vulnerable Broadcast Receivers

Let’s now try to send some spoofed broadcasts to the above receiver.

Using am tool available in adb

Using adb

  1. Get an adb shell on the device and type the following command to send a spoofed broadcast.
  2. Navigate back to the “platform-tools” folder and enter the below mentioned command:

. /adb shell

  1. Enter the following command in the shell:

am broadcast -a theBroadcast -n com.android.insecurebankv2/com.android.insecurebankv2.MyBroadCastReceiver –es phonenumber 5554 –es newpass Dinesh@123!

  1. Back on the emulator, navigate to the “Messages”. The above-entered command automatically makes a call to the mentioned Broadcast Receiver and an SMS text with the passwords is sent.

Now, a broadcast event is sent in the background, and since the application is not validating the input source, an SMS will be sent to emulator-5554 without user intervention.

Let’s see how we can secure application-

Securing the Applications:

  • Setting android: exported attribute’s value to false

In the AndroidManifest.xml file of our application, we should add the following attribute to the receiver to be secured.

  • Limiting access to custom permissions

We can also impose permission-based restrictions by defining custom permissions for each receiver. This is helpful if the developer wants to limit the access to his app’s components to those apps which have permissions.

This is the reason why we need to specify “android.permission.RECEIVE_SMS” permission in the AndroidManifest.xml file if any app wants to listen for the Receive SMS event using the action “android.provider.Telephony.SMS_RECEIVED“

Check out our previous parts of Android Penetration Testing

Android Application Penetration Testing – Part 1
Android Application Penetration Testing – Part 2
Android Application Penetration testing – Part 3
Android Application Penetration Testing – Part 4
Android Application Penetration Testing – Part 5
Android Application Penetration Testing – Part 6
Android Application Penetration Testing – Part 7
Android Application Penetration Testing – Part 8
Android Application Penetration Testing – Part 9

Gurubaran

Gurubaran is a co-founder of Cyber Security News and GBHackers On Security. He has 10+ years of experience as a Security Consultant, Editor, and Analyst in cybersecurity, technology, and communications.

Recent Posts

Landmark Admin Suffers Major Breach, Exposing Data of 1.6M+ Users

Landmark Admin, LLC (“Landmark”), a Texas-based third-party administrator for life insurance carriers, has confirmed that…

25 minutes ago

SquareX to Reveal Critical Data Splicing Attack at BSides SF, Exposing Major DLP Vulnerability

SquareX researchers Jeswin Mathai and Audrey Adeline will be disclosing a new class of data exfiltration techniques at BSides San…

25 minutes ago

Firefox Fixes High-Severity Vulnerability Causing Memory Corruption via Race Condition

Mozilla has released Firefox 137.0.2, addressing a high-severity security flaw that could potentially allow attackers…

2 hours ago

Tails 6.14.2 Released with Critical Fixes for Linux Kernel Vulnerabilities

The Tails Project has urgently released Tails 6.14.2, addressing critical security vulnerabilities in the Linux kernel…

3 hours ago

APT29 Hackers Use GRAPELOADER in New Attack Against European Diplomats

Check Point Research (CPR) has uncovered a new targeted phishing campaign employing GRAPELOADER, a sophisticated…

4 hours ago

Chinese Hackers Unleash New BRICKSTORM Malware to Target Windows and Linux Systems

A sophisticated cyber espionage campaign leveraging the newly identified BRICKSTORM malware variants has targeted European…

4 hours ago