Tools

Install ADB, JADX. Use Android Studio or Genymotion or Nox for an emulator.

Burp

  • Set up proxy for all interfaces on 8082 or any port not in use and export cacert.der

  • Long press Wifi on phone and set up proxy on localhost.

  • Install the .der exported certificate as .CER

  • Copy it to device and Import it.

Enabled USB Debugging

  • Click on "Build Number" seven times.

  • Goto Developer Options and enable USB Degbugging

Install ADB

sudo apt install adb

ADB Connect

  • Switch on the WiFi and obtain the IP address of device.

  • Start an ADB server locally.

  • Check for connected devices

Pull APK from physical/emulator phone

APK Tool

AWS & Firebase Enumeration

Patching APK using Objection

Objection and Frida

Order of installation is important. First frida then objection.

To patch the application, goto the directory with APK and use objection.

Copy the .objection.apk file. (Uninstall the original file on device before this).

Manually Patching using Frida

Decompile the APK using APKTool

Goto the "lib" folder and inject the Frida gadget here.

First find the architecture of the device and inject it accordingly (either in x84_64 or x86)

Get Frida for that particular version and copy it to the lib directory.

Inject a System.loadLibrary("frida-gadget") call into the bytecode of the app, ideally before any other bytecode executes or any native code is loaded. A suitable place is typically the static initializer of the entry point classes of the app, e.g. the main application Activity, found via the manifest.

An easy way to do this is to add the following smali code in a suitable function:

Goto the /smali/ directory and find an activity that loads when the application starts.

Add the Internet permission to the manifest if it’s not there already, so that Frida gadget can open a socket.

Repackage the application:

Sign the updated APK using your own keys and zipalign.

Install the updated APK to a device.

Using frida gadget

When you next start the application you are going to see an empty screen: The injected libfrida-gadget.so library has opened a tcp socket and waits for a connection from frida.

You should see a message similar to the following in logcat:

Running nestat on the device confirms the listening socket:

As you might expect, the next step is connecting to the listening socket: Most frida tools work as expected although there are a few issues that can be handled better, e.g. connecting to the library after initialization, not just during loading.

There is just one thing to keep in mind: The process name you are going to use in Frida tooling should be “Gadget” instead of the normal package name.

A blank screen may appear when opening the app, but that means the gadget works. To trigger it, use objection.

We can now disable SSL pinning.

We could also monitor clipboard, dump memory, check for root detection, run commands, etc.

Drozer

Drozer identifies flaws in an app or a device. It acts like an installed Android app and talk to other apps to detect flaws.

Installation

Set up Drozer Agent on Android

Open the Drozer Agent on device. It waits for a connection on 31415.

Host a Drozer Server on Computer and launch Drozer Console.

With Drozer shell, we can run commands.

Recon

Last updated