- https://www.hackingarticles.in/android-penetration-testing-apk-reverse-engineering/
- https://www.hackingarticles.in/android-penetration-testing-apk-reversing-part-2/
- https://www.hackingarticles.in/android-pentest-deep-link-exploitation/
- https://www.hackingarticles.in/android-penetration-testing-webview-attacks/
- https://www.hackingarticles.in/android-penetration-testing-frida/
- https://www.hackingarticles.in/android-pentest-lab-setup-adb-command-cheatsheet/
- https://www.hackingarticles.in/android-hooking-and-sslpinning-using-objection-framework/
- https://www.hackingarticles.in/android-penetration-testing-drozer/
- https://www.hackingarticles.in/android-pentest-automated-analysis-using-mobsf/
apktool -d com.uber -o uberAPK; grep -Phro "(https?://)[\w\,-/]+[\"\']" uberAPK/ | sed 's#"##g' | anew | grep -v "w3\|android\|github\|schemes.android\|google\|goo.gl"
- Download jadx decompiler and install adb
- Open AndroidManifest.xml
- Find all browser activities (must contain )
- Run
adb shell am start -n app_package_name/component_name -a android.intent.action.VIEW -d http://google.com
for each of the activities (or any of your domains). Also track in Burp any requests to http://google.com or your domain. - If a domain is opened, it means you found a vulnerability! Now inspect the request if it contains any auth tokens (if yes, it means you've got an account takeover!). No? Try different techniques to obtain any PII. In the worst case you will get a reward like for an XSS.
- If you can just open arbitrary links in an app. And use http://google.com (remove the space) in the 4 step.
- ADB Cheatsheet
- Testing with Frida
- APK Reverse Engineering - 1
- APK Reverse Engineering - 2
- Android Hooking and SSLPinning using Objection Framework
- Android Mobile Exploitation with Evil-Droid
# list devices
adb devices -l
# connect virtual devices
adb connect 192.168.52.104
Android Debug Bridge is a utility that provides debugging features for android devices. ADB can be used to conduct debugging over USB as well as over TCP.
adb connect 192.168.52.104
adb shell
adb install <apk_file.apk>
# connect shell
adb shell
#direct to data folder
cd data/data/
#list instlled apps
ls | tail -10
# start adb server
abd start-sever
# stop adb server
adb kill-server
# run adb as root
adb root
# revert back to unroot
adb unroot
# monitor logs
adb logcat
# push files to device
adb push <source_file_name> <destination_folder>
# pull files from device
adb pull <source_file_name> <destination_folder>
# list installed apps
adb shell pm list packages | tail -10
# list system apps
adb shell pm list packages -s
# list third party apps
adb shell pm list packages -3
# clear application data
adb shell pm clear <package_name>
# view installation path of package
adb shell pm path <package_name>
# View running services in a package
adb shell dumpsys activity services <package_name>
# Extracting information about a package
adb shell dumpsys package <package_name>
# View foreground activity
adb shell dumpsys activity activities | grep mResumedActivity
# Information about activities in a specific package
adb shell dumpsys activity activities | grep <package_name>
# Viewing running services of a package
adb shell dumpsys activity services <package_name>
# Viewing detailed information about a package
adb shell dumpsys package <package_name>
# start activity
adb shell am start -n <package_name>/<activity>
# start service
adb shell am startservice -n <package_name>/<activity>
# stop service
adb shell am stopservice -n <package_name>/<activity>
adb shell pidof <package_name>
# For example, I have to inspect the logs of this package, I can filter it out using grep and the PID like:
adb logcat | grep 7399
There are many ways to decompile the app
Using apktool to decompile
# decompile
apktool d -f -r <apk_file>
# compile
apktool b <app_files_folder> -o <output_apk_file_name>
Use Bytecode viewer, jadex-ui
keytool -genkey -v -keystore harshit_key.keystore -alias harsh_key -keyalg RSA -keysize 2048 -validity 10000
jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 -keystore harshit_key.keystore new_uncrackable.apk harsh_key
<permissions> – Permissions that APK requires to run
<activity> – Various activities in the APK
<intent-filter> – Intent filters
<data android:scheme=”string” /> – Data Schemes
<action android:name=”string” /> – Action that an intent performs
<uses-configuration> tag – specifies input mechanisms
<uses-sdk> tag – specifies android API to be used
adb connect 192.168.27.101:5555
chmod 777 frida-server-14.1.3-android-x86_64 && adb push frida-server-14.1.3-android-x86_64 /tmp/frida-server
pip3 install objection
objection –-gadget <package_name> explore
- Set proxies in device and install the CA certificates
- Run below command to bypass SSL Pinning
android sslpinning disable
# list class methods
android hooking list class_methods <activity>
# list class
android hooking search classes main
if we want to monitor a particular activity to see what all functions the activity calls and in what logical sequence to better understand how to create hooks, we’d type the following command:
android hooking watch class <activity> --dump-args ----dump-backtrace –dump-return
android ui FLAG_SECURE
android ui FLAG_SECURE true
android ui FLAG_SECURE false
android intent launch_activity
android intent launch_activity <activity>
android root disable