In android You know
that every GUI interface is an separate
activity. An activity represents a single screen with a user interface just
like window or frame of Java. In An application there are many activities depend
on application functionalities. Let's take a example :
An application that
have three modules login , register
and dashboard . For that there are there
are three different activities for all these modules.
What is export Means Here?
In Android
Application there is an attribute android: exported =true or false . This
attribute is used in android to provide
an access to other third party
application to start their service , activities
and receive broadcast messages.
Like for an Example : If an application have broadcast receiver to receive any
events or message , if in that application exported attribute is set to true
then this broadcast message can also receive by other third party
application installed in device.
If an activity have
exported true then we can launch
activity directly without any error this can leads to login bypass or other
bypass depend on application.
What is
Improper Export of Activities In
Android Application ??
The Android
application exports a component for use by other applications, but does not
properly restrict which applications can launch the component or access the
data it contains. Exported Activities are those activities which can be
accessed by other application on the same device.
If an
application activity dashboard that should be launched after registering or after login ,but due to exported true in activity dashboard activity may be launched before login
and registration that is bypassing the real behavior of application and it can
bypass the extra layer security in application like pass code protection, pin protection ,2fa protection.
KNOW WHEN ACTIVITY IS EXPORTED OR NOT?
- if an activity have attribute exported=true then that activity is exported by any other app can launch that activity.
- If an activity have no any attribute exported then that activity is default set exported false.
- An activity have no any attribute but in that activity intent filter is used, using an intent filter an activity becomes default becomes exported true.
- If you are using application an rooted device then all activities can be launched by other applications.
Exploitation:
- PASSCODE/PIN PROTECTION BYPASS : for this please read my bug bounty writeup : https://negativewives.blogspot.com/2020/04/passcode-protection-bypass-by-brute.html
- Bypass PIN/Fingerprint lock: https://hackerone.com/reports/331489,https://hackerone.com/reports/490946.
- Steal files : https://hackerone.com/reports/161710
MITIGATION:
- In application all activities should be exported false
- If any intent filter is used in application use custom permission
- Application should not run on rooted device.
For root check implement root bear library : https://github.com/scottyab/rootbeer
For custom
permission:
<!-- define a
permission -->
<permission
android:protectionLevel="signature"
android:name="com.mypackage.MYPERMISSION"/>
<uses-permission
android:name="com.mypackage.MYPERMISSION" />
<!-- define an
activity which can only be started through internal code -->
<activity
android:name="..."
android:permission="com.mypackage.MYPERMISSION" >
...
</activity>
Comments