Android Hacking

Introduction

  • Key Techniques:

    • APK analysis and decompilation

    • Smali and Java code review

    • Reverse engineering and patching

    • Using tools: adb, wget, apktool, jadx, keytool, jarsigner


Challenge 1: droids0

Task

  • Objective: Extract the flag from application logs.

Steps & Commands

  • Download APK:

    wget https://jupiter.challenges.picoctf.org/static/02bcd73e630f50ef0b12bcdad9d84e0d/zero.apk
  • Install APK on Emulator/Device:

    adb install -t zero.apk
  • Check Device Logs for Flag:

    adb logcat | grep -E -o "picoCTF{.*}"

Challenge 2: droids1

Task

  • Objective: Discover the password and unlock the flag.

Steps & Commands

  • Download and Install APK:

  • Decompile the APK:

  • Find Password in Smali Code:

  • Check XML Files for Hardcoded Password:


Challenge 3: droids2

Task

  • Objective: Uncover an obfuscated password by analyzing decompiled code.

Steps & Commands

  • Download and Install APK:

  • Decompile APK for Analysis:

  • Decompile Java Code for Better Readability:

  • Extract Password from Decompiled Java Code:

    • Modify extracted Java class to print the password.


Challenge 4: droids3

Task

  • Objective: Patch the APK to redirect the flag method call.

Steps & Commands

  • Download and Install APK:

  • Decompile APK for Smali Editing:

  • Modify getFlag Method in Smali:

    • Replace call to nope(input) with yep(input).

  • Recompile Modified APK:

  • Sign the Patched APK:

  • Install and Run the Patched APK:


Challenge 5: droids4

Task

  • Objective: Reverse the password logic and patch the app to reveal the flag.

Steps & Commands

  • Download and Install APK:

  • Decompile and Analyze Smali Code:

  • Find Password Logic in Smali or Decompiled Java:

  • Extract Password from Decompiled Java Code:

    • Modify extracted Java class to print the password.

  • Recompile & Sign APK (Same as Challenge 4):

  • Install and Run the Patched APK:


Thank You!

Credits to Learning to ‘Hack Android’ with picoCTF by Ed Holloway-George. You can reach out to me at LinkedIn and Twitter.

Last updated