Slide 1

Slide 1 text

Reverse & Inject

Slide 2

Slide 2 text

Android Chapter Lead @ TBC Bank tatocaster.me Tato Kutalia tatocaster

Slide 3

Slide 3 text

Plan ● Tools ● Static Analysis vs Dynamic ● What is Reverse Engineering (RE)

Slide 4

Slide 4 text

Tools Static Analysis ● JADX - Decompiler ● ApkTool - Decompiler ● Dex2Jar - Dex decompiler to Jar ● JD-GUI - Java Decompiler Dynamic analysis ● FRIDA Disassembler ● GHIDRA ● IDA PRO

Slide 5

Slide 5 text

● AndroidManifest.xml ● META-INF/ - java meta/signatures ● classes.dex - dalvik bytecode ● lib/ - native libs ● assets/ - other Application Structure APK

Slide 6

Slide 6 text

Java vs Android compilation

Slide 7

Slide 7 text

Java vs Smali Java public Boolean myStrMethod(byte mybyte, String str) smali .method public myStrMethod(B; Ljava/lang/String)Z – http://pallergabor.uw.hu/androidblog/dalvik_opcodes.html https://github.com/JesusFreke/smali/wiki

Slide 8

Slide 8 text

RE: DEMO

Slide 9

Slide 9 text

What about .so files?

Slide 10

Slide 10 text

No content

Slide 11

Slide 11 text

No content

Slide 12

Slide 12 text

No content

Slide 13

Slide 13 text

Dynamic analysis ● change and examine app in runtime

Slide 14

Slide 14 text

: DEMO

Slide 15

Slide 15 text

FRIDA Gadget vs FRIDA Server // Gadget - decompile APK - add FRIDA native library to lib/ - inject into bytecode - add permission - repackage - sign - install System.loadLibrary("frida-gadget") const-string v0, "frida-gadget" invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V

Slide 16

Slide 16 text

Scanned Apps

Slide 17

Slide 17 text

Scanned Apps - bypass otp/pin - client side check only - SQL injection - base64 decoding leading to app crash - mobile number / otp / pin / email enumeration - exposed client secrets - save sessionId in preferences - password reset does not kill the current session - leaking Google API keys - leaking test url and users in prod - leaking test features in production app

Slide 18

Slide 18 text

Catch the Flags

Slide 19

Slide 19 text

No content

Slide 20

Slide 20 text

Q&A