> For the complete documentation index, see [llms.txt](https://bradsen.gitbook.io/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bradsen.gitbook.io/docs/mobile-pentesting/insecurebankv2.md).

# InsecureBankv2

## Installation and Setup

{% embed url="<https://github.com/dineshshetty/Android-InsecureBankv2/tree/master/AndroLabServer>" %}

May have to remove **web.py** in the **requirement.txt** for it to run.

Change current directory to the **AndroLabServer** folder.

```
cd AndroLabServer
```

Run the HTTP server&#x20;

```
python app.py
```

In the mobile app, choose **Preferences** and configure the host machine IP and server port.&#x20;

<figure><img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2FvkZZ0ulNIehpKsXHv18f%2Fimage.png?alt=media&amp;token=df3a8b21-378a-4451-aaa6-a7bb96a25bef" alt="" width="284"><figcaption></figcaption></figure>

## Decompile APK file&#x20;

Use apktool to decode the apk file&#x20;

```
apktool d InsecureBankv2.apk
```

<img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2FZsEYyN1ZUoXTfmVLLPOC%2Funknown.png?alt=media&amp;token=28be10e3-23d1-4b2e-9eec-92ee7e7ac93a" alt="" width="563">

**Impact**: When authorization logic is enforced on the client side (e.g., in strings.xml, shared preferences, hidden UI flags, or JavaScript-like logic in apps), an attacker can modify it and bypass restrictions.

## Broken Access Control (Client-Side Authorization Bypass)

Navigate to the folder **\~/apktool/InsecureBankv2/res/values** and open the file **strings.xml** for editing. Modify the value of “is\_admin” from “no” to “yes”.

Before

<img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2Fi14Od8oQNxSmIrfr5eWs%2Funknown.png?alt=media&amp;token=20643fd5-ad0f-4c5a-a437-4fa83308e52b" alt="" width="563">

After

<img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2FIQH612bgmeTXWG9KWeyX%2Funknown.png?alt=media&amp;token=7b061210-d304-4e0b-bffe-2c56561b2a45" alt="" width="563">

Recompile the apk

```
apktool b InsecureBankv2
```

<figure><img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2FRq9vqCvq3NH3JoCXnMuO%2Fimage.png?alt=media&amp;token=ab558e4a-3218-4fb9-b184-3446d4438a60" alt=""><figcaption></figcaption></figure>

Change current directory to&#x20;

> apktool\InsecureBankv2\dist

Sign the app using apksigner:

1. Generate keystore

```
keytool -genkey -v -keystore demo.keystore -keyalg RSA -keysize 2048 -validity 10000 -alias demokeys
```

2. Zipalign the APK (The APK must be zipaligned before signing as outlined in  <https://developer.android.com/tools/apksigner>)

```
zipalign -p 4 InsecureBankv2.apk InsecureBankv2-signed.apk
```

3. Sign the application

```
apksigner sign --ks-key-alias demokeys --ks demo.keystore InsecureBankv2-signed.apk
```

4. Verify the application

```
apksigner verify InsecureBankv2-signed.apk
```

Expected all output files

<figure><img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2FOOb0kKvlpOAHRFGqlpeQ%2Fimage.png?alt=media&amp;token=a8621fc8-293b-4bb6-9702-06d8e573741f" alt=""><figcaption></figcaption></figure>

Drag and drop **InsecureBankv2-signed.apk** to the emulator. “Create User”  button will be seen.&#x20;

<img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2Fybf898NjJjgECZZuDbUH%2Funknown.png?alt=media&amp;token=4bd93f55-c549-4181-a552-e4da02488366" alt="" width="217">

**Impact**: When authorization logic is enforced on the client side (e.g., in strings.xml, shared preferences, hidden UI flags, or JavaScript-like logic in apps), an attacker can modify it and bypass restrictions.

## Exported Content Provider Vulnerability

A ContentProvider often handles:

* user credentials
* session tokens
* app database records
* cached sensitive data

Content provider is set to **exported = "true"** in **AndroidManifest.xml**

<img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2FMwaH6nN4zejLXstqlbl9%2Funknown.png?alt=media&amp;token=2e73e671-2816-4800-b830-3eba471b0998" alt="" width="563">

With exported=true and no proper readPermission / writePermission, any installed app can do things like:

* query() → steal data
* insert() → inject malicious records
* update() → modify user data
* delete() → wipe or corrupt data

In Jadx-gui, we can find the exact endpoint to call. &#x20;

<img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2FxEUH1VklKrCBbcbRqnSc%2Funknown.png?alt=media&amp;token=6f743cfd-5fe8-46c9-af04-1a8f8c6106c5" alt="" width="563">

Start remote terminal into an Android device.

```
adb shell
```

Read data from the **trackerusers** endpoint exposed by the **TrackUserContentProvider** in the **InsecureBankv2** application

```
content query --uri content://com.android.insecurebankv2.TrackUserContentProvider/trackerusers
```

It will show the login history of all of the users was stored on the device unencrypted.

<img src="https://1174946829-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F4K3GhEEELaFCyhvEQ0Wp%2Fuploads%2FtGIozJmFKKOakRHqq12F%2Funknown.png?alt=media&amp;token=cc737ea7-b273-4939-b15c-5bd92333abb4" alt="" width="563">

**Impact**: An attacker can send crafted broadcasts to the exported BroadcastReceiver and invoke sensitive functionality without authorization, potentially leading to unauthorized password changes, account takeover, or abuse of privileged application actions.&#x20;

\ <br>
