← All writing notes

Reverse Engineering Android APKs

Reverse Engineering Android APKs

This is a quick reference for how I usually approach reverse engineering Android apps for the purposes of research, pentesting, bug bounty, etc. I plan to write a more in-depth guide at some point in the future.

Installing Tools

sudo pacman -S android-tools jdk-openjdk jre-openjdk
paru -S android-apktool-git apk-editor-studio-bin jadx-gui-desktop burpsuite frida-tools frida python-frida-tools

Configuration & Optimization

# Android VM optimization
sudo modprobe -r kvm_intel
sudo modprobe kvm_intel nested=1

# Confirm above optimization
grep -E --color=auto 'vmx|svm' /proc/cpuinfo

# Java VM optimization
sudo archlinux-java set java-18-openjdk
export _JAVA_OPTIONS=-Xmx6G
export _JAVA_OPTIONS=-Xmx12G

Pull APK file via ADB

# Find APK on device (or Android VM)
adb shell pm list packages | grep <APP_NAME>

# What is the path of the APK?
adb shell pm path <APP>

# Pull a copy locally
adb pull <PATH> .

Decompile APK, Java Classes

apktool d <APP>,apk -o out/
jadx -d out classes.dex

Recompile & Zip Align APK

apktool b out/ --use-aapt2 -o APP_patched.apk
zipalign -p -b 4 APP_patched.apk

APK Signing

keytool -genkey -v -keystore release.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
apksigner sign --ks release.keystore APP_patched.apk

APK Install

adb install APP_patched.apk

Make Android System Writable

# Emulator must have the following flag
emulator -writable-system -avd <AVD_NAME>
adb shell mount -o rw,remount,rw /system

Generate & Push Android System Root Cert

# Generate Cert
openssl req -x509 -days 730 -nodes -newkey rsa:2048 -outform der -keyout server.key -out ca.der -extensions v3_ca -config openssl.cnf
openssl rsa -in server.key -inform pem -out server.key.der -outform der
openssl pkcs8 -topk8 -in server.key.der -inform der -out server.key.pkcs8.der -outform der -nocrypt

# Get <CERT_IDENTIFIER>
openssl x509 -inform PEM -subject_hash_old -in ca.cer | head -1

# Push cert to Android system
adb push ca.cer /system/etc/security/cacerts/<CERT_IDENTIFIER>.0

Frida SSL Unpinning

adb push frida-server-15.1.27-android-x86 /data/local/tmp/frida-server
adb shell "chmod 755 /data/local/tmp/frida-server"
adb shell "/data/local/tmp/frida-server &"
wget https://raw.githubusercontent.com/httptoolkit/frida-android-unpinning/main/frida-script.js
frida --no-pause -U -l ./frida-script.js -f com.APP_NAME com.android.chrome

APK Logs

adb logcat -c

<3 Zach

How to Install Fedora 42 with Full Disk Encryption, Snapshot, and Rollback Support

This is an archived copy - I DID NOT write this This is a direct copy of this excellent write up by Madhu Desai that I saved for my own personal reference while using this as a baseline install guide. Please refer to the linked write up for any updates and to see the comment discussion Fedora Linux 42 is here! Fedor

May 9, 2025 · 20 min read

Unlocking the FM350-GL

Is this legal? If you are using a US based mobile provider with a US based SIM card, this might not be legal. Lenovo's own unlock tool continues to block any US based carrier SIM cards. If you do the unlock yourself, you can get around the region restriction, but you may enter a legal gray area in doing so. This i

May 9, 2025 · 4 min read

WoL Magic Packet

Wake on LAN Quick notes defining the standard magic packet used for Wake on LAN. Packet Header 0xFF repeated, 6 times. Packet Payload AABBCCDDEEFF MAC Address (IEEE 802 MAC-48), repeated 16 times. Packet Structure type MACAddr [6]byte type MagicPacket struct { header [6]byte payload [16]MACAddr } Exampl

Apr 23, 2025 · 2 min read

Anonymous, Allegedly: Reverse-Engineering the 2022 YikYak Relaunch

A responsible-disclosure writeup of privacy and data-leakage flaws in the relaunched YikYak Android app — where 'anonymous' turned out to be a UI decision, not a backend guarantee.

Jun 30, 2026 · 14 min read

Webmentions

Please Note This was written back when this blog was using Hugo for static site generation. I recently moved to Obsidian Publish - I am not sure if using Webmentions is possible or not. If I manage to figure something out, I will write an updated post about it :) I've been looking at adopting more and more IndieW

Dec 3, 2021 · 3 min read