SlideShare a Scribd company logo
SESSION ID: 
Beginners Guide to Reverse Engineering Android Apps 
STU-W02B 
Pau Oliva Fora 
Sr. Mobile Security Engineer 
viaForensics 
@pof
#RSAC 
Agenda 
 
Anatomy of an Android app 
 
Obtaining our target apps 
 
Getting our hands dirty: reversing the target application 
 
Demo using Santoku Linux 
2
Anatomy of an Android app
#RSAC 
Anatomy of an Android app 
 
Simple ZIP file, renamed to “APK” extension 
 
App resources 
 
Signature 
 
Manifest (binary XML) 
4
Obtaining our target apps
#RSAC 
Getting the APK from the phone 
 
Backup to SD Card: 
 
APKOptic 
 
Astro file manager 
 
etc… 
6
#RSAC 
Getting the APK from the phone 
 
Using ADB (Android Debug Bridge): 
 
adb shell pm list packages 
 
adb pull /data/app/package-name-1.apk 
7
#RSAC 
Downloading the APK from Google Play 
 
Using unofficial Google Play API: 
 
https://github.com/egirault/googleplay-api 
 
Using a web service or browser extension: 
 
http://apps.evozi.com/apk-downloader/ 
 
http://apify.ifc0nfig.com/static/clients/apk-downloader/ 
8
#RSAC 
Downloading the APK from Google Play 
 
Using unofficial Google Play API: 
 
https://github.com/egirault/googleplay-api 
 
Using a web service or browser extension: 
 
http://apps.evozi.com/apk-downloader/ 
 
http://apify.ifc0nfig.com/static/clients/apk-downloader/ 
9
Getting our hands dirty: reversing the target application
#RSAC 
Disassembling 
DEX 
Smali 11
#RSAC 
Apktool 
 
apktool - https://code.google.com/p/android-apktool/ 
 
Multi platform, Apache 2.0 license 
 
Decode resources to original form (and rebuild after modification) 
 
Transforms binary Dalvik bytecode (classes.dex) into Smali source 
12
#RSAC 
Smali 
13
#RSAC 
Decompiling – Java Decompiler 
DEX 
JAR 
JAVA 14
#RSAC 
Dex2Jar 
 
dex2jar - https://code.google.com/p/dex2jar/ 
 
Multi platform, Apache 2.0 license 
 
Converts Dalvik bytecode (DEX) to java bytecode (JAR) 
 
Allows to use any existing Java decompiler with the resulting JAR file 
15
#RSAC 
Java Decompilers 
 
Jd-gui - http://jd.benow.ca/ 
 
Multi platform 
 
closed source 
 
JAD - http://varaneckas.com/jad/ 
 
Multi platform 
 
closed source 
 
Command line 
 
Others: Dare, Mocha, Procyon, … 
16
#RSAC 
Decompiling – Android (Dalvik) decompiler 
DEX 
JAVA 17
#RSAC 
Dalvik Decompilers 
 
Transforming DEX to JAR looses important metadata that the decompiler could use. 
 
Pure Dalvik decompilers skip this step, so they produce better output 
 
Unfortunately there are not as many choices for Android decompilers as for Java decompilers: 
 
Open Source: Androguard’s DAD - https://code.google.com/p/androguard/ 
 
Commercial: JEB - http://www.android-decompiler.com/ 
 
Others? 
18
Demo – Santoku
#RSAC 
Demo – Santoku Linux 
 
Santoku Linux - https://santoku-linux.com/ 
 
Mobile Forensics 
 
Mobile Malware analysis 
 
Mobile application assessment 
20
#RSAC 
Summary 
 
APK files are ZIP files, can be extracted with any unzip utility 
 
Apktool helps extracting binary resources, and allows repacking 
 
Dex2jar converts Dalvik Bytecode to Java Bytecode 
 
Pure Android decompilers are better 
 
Santoku Linux has all the tools you need to reverse engineering mobile apps 
21
#RSAC 
Q&A | Contact | Feedback 
 
Thanks for listening… 
 
@pof 
 
github.com/poliva 
 
poliva@viaforensics.com 
22

More Related Content

PPTX
inside dvm internals
PPT
Springboard & OpenCV
PDF
.Net Hijacking to Defend PowerShell BSidesSF2017
PDF
Scala FS 2012
PPTX
Java 9 new features
PDF
FRIDA 101 Android
PDF
Os Koziarsky
PPTX
Android - ADB
inside dvm internals
Springboard & OpenCV
.Net Hijacking to Defend PowerShell BSidesSF2017
Scala FS 2012
Java 9 new features
FRIDA 101 Android
Os Koziarsky
Android - ADB

What's hot (19)

PDF
Import golang; struct microservice
PDF
Who Needs Thumbs? Reverse Engineering Scramble with Friends v1.1
PDF
really really really awesome php application with bdd behat and iterfaces
PDF
Aosp+
PDF
Startup Camp - Git, Python, Django session
PDF
You're Off the Hook: Blinding Security Software
PDF
Asynchronous Systems with Fn Flow
PDF
用 Go 語言實戰 Push Notification 服務
PDF
ADB(Android Debug Bridge): How it works?
PDF
GCE 上搭配 Cloud Storage 建置 Drone CI
PDF
What Can Reverse Engineering Do For You?
PDF
X Means Y
PDF
Golang Project Layout and Practice
PDF
The Hookshot: Runtime Exploitation
PDF
ARM Cortex-A53 Errata on Andoid
PPTX
PyCon Canada 2015 - Is your python application secure
PDF
Is your python application secure? - PyCon Canada - 2015-11-07
PPTX
C/C++ Remote Development Overview
PDF
Git, CMake, Conan - How to ship and reuse our C++ projects?
Import golang; struct microservice
Who Needs Thumbs? Reverse Engineering Scramble with Friends v1.1
really really really awesome php application with bdd behat and iterfaces
Aosp+
Startup Camp - Git, Python, Django session
You're Off the Hook: Blinding Security Software
Asynchronous Systems with Fn Flow
用 Go 語言實戰 Push Notification 服務
ADB(Android Debug Bridge): How it works?
GCE 上搭配 Cloud Storage 建置 Drone CI
What Can Reverse Engineering Do For You?
X Means Y
Golang Project Layout and Practice
The Hookshot: Runtime Exploitation
ARM Cortex-A53 Errata on Andoid
PyCon Canada 2015 - Is your python application secure
Is your python application secure? - PyCon Canada - 2015-11-07
C/C++ Remote Development Overview
Git, CMake, Conan - How to ship and reuse our C++ projects?
Ad

Viewers also liked (18)

PDF
sebis research profile
PDF
Hide Android applications in images
PDF
Cyber as WMD- April 2015- GFSU
PDF
ToorCon 14 : Malandroid : The Crux of Android Infections
PDF
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
PDF
Mobile analysis-kung-fu-santoku-style-viaforensics-rsa-conference-2014
PDF
Via forensics thotcon-2013-mobile-security-with-santoku-linux
PDF
One Phish, Two Phish, Red Phish, Your Account Details Just Got Stolen
PDF
Cyber Security for Critical Infrastrucutre-ppt
PDF
Blackhat USA 2015: BGP Stream Presentation
PPTX
M.Tech. Cyber Security & Incident Response
PPTX
Shodan- That Device Search Engine
PDF
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
PPTX
APT 28 :Cyber Espionage and the Russian Government?
PDF
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
PDF
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
PPTX
Android– forensics and security testing
PPTX
Social Media at NASA, 2012 Edition
sebis research profile
Hide Android applications in images
Cyber as WMD- April 2015- GFSU
ToorCon 14 : Malandroid : The Crux of Android Infections
BlackHat USA 2013 Arsenal - Sparty : A FrontPage and SharePoint Security Audi...
Mobile analysis-kung-fu-santoku-style-viaforensics-rsa-conference-2014
Via forensics thotcon-2013-mobile-security-with-santoku-linux
One Phish, Two Phish, Red Phish, Your Account Details Just Got Stolen
Cyber Security for Critical Infrastrucutre-ppt
Blackhat USA 2015: BGP Stream Presentation
M.Tech. Cyber Security & Incident Response
Shodan- That Device Search Engine
BlackHat Arsenal 2014 - C-SCAD : Assessing Security Flaws in C-SCAD WebX Clie...
APT 28 :Cyber Espionage and the Russian Government?
BlackHat 2014 Briefings - Exploiting Fundamental Weaknesses in Botnet C&C Pan...
Introduction to Industrial Control Systems : Pentesting PLCs 101 (BlackHat Eu...
Android– forensics and security testing
Social Media at NASA, 2012 Edition
Ad

Similar to Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensics-rsa-conference-2014 (20)

PDF
Null Mumbai Meet_Android Reverse Engineering by Samrat Das
PPT
Steelcon 2015 Reverse-Engineering Obfuscated Android Applications
PDF
Droidcon Greece '15 - Reverse Engineering in Android: Countermeasures and Tools
PDF
AnDevCon: Android Reverse Engineering
PPTX
PDF
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
PDF
Cracking the mobile application code
PPTX
From Reversing to Exploitation
PPTX
MOBISEC 2018 - 08 - Reverse Engineering.pptx
PPTX
Basic reverse engineering steps about .apk file
PPTX
Security Vulnerabilities in Mobile Applications (Kristaps Felzenbergs)
PDF
Mobile malware analysis with the a.r.e. vm
PDF
Android talks #08 decompiling android applications
PDF
Voxxed days Vilnius 2015 - Android Reverse Engineering Lab
PDF
Learning by hacking - android application hacking tutorial
PPTX
From Reversing to Exploitation: Android Application Security in Essence
PDF
Introduction to mobile reversing
PDF
Introduction to mobile reversing
PDF
LinkedIn - Disassembling Dalvik Bytecode
PPTX
Decompiling Android
Null Mumbai Meet_Android Reverse Engineering by Samrat Das
Steelcon 2015 Reverse-Engineering Obfuscated Android Applications
Droidcon Greece '15 - Reverse Engineering in Android: Countermeasures and Tools
AnDevCon: Android Reverse Engineering
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
Cracking the mobile application code
From Reversing to Exploitation
MOBISEC 2018 - 08 - Reverse Engineering.pptx
Basic reverse engineering steps about .apk file
Security Vulnerabilities in Mobile Applications (Kristaps Felzenbergs)
Mobile malware analysis with the a.r.e. vm
Android talks #08 decompiling android applications
Voxxed days Vilnius 2015 - Android Reverse Engineering Lab
Learning by hacking - android application hacking tutorial
From Reversing to Exploitation: Android Application Security in Essence
Introduction to mobile reversing
Introduction to mobile reversing
LinkedIn - Disassembling Dalvik Bytecode
Decompiling Android

Recently uploaded (20)

PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PPTX
Lesson notes of climatology university.
PPTX
Pharma ospi slides which help in ospi learning
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PPTX
Cell Structure & Organelles in detailed.
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
master seminar digital applications in india
PDF
A systematic review of self-coping strategies used by university students to ...
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
Presentation on HIE in infants and its manifestations
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PDF
Computing-Curriculum for Schools in Ghana
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PPTX
Microbial diseases, their pathogenesis and prophylaxis
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
Lesson notes of climatology university.
Pharma ospi slides which help in ospi learning
STATICS OF THE RIGID BODIES Hibbelers.pdf
Cell Structure & Organelles in detailed.
O5-L3 Freight Transport Ops (International) V1.pdf
master seminar digital applications in india
A systematic review of self-coping strategies used by university students to ...
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
Presentation on HIE in infants and its manifestations
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Final Presentation General Medicine 03-08-2024.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
Computing-Curriculum for Schools in Ghana
102 student loan defaulters named and shamed – Is someone you know on the list?
Supply Chain Operations Speaking Notes -ICLT Program
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
Introduction-to-Literarature-and-Literary-Studies-week-Prelim-coverage.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Microbial diseases, their pathogenesis and prophylaxis

Beginners guide-to-reverse-engineering-android-apps-pau-oliva-fora-viaforensics-rsa-conference-2014

  • 1. SESSION ID: Beginners Guide to Reverse Engineering Android Apps STU-W02B Pau Oliva Fora Sr. Mobile Security Engineer viaForensics @pof
  • 2. #RSAC Agenda  Anatomy of an Android app  Obtaining our target apps  Getting our hands dirty: reversing the target application  Demo using Santoku Linux 2
  • 3. Anatomy of an Android app
  • 4. #RSAC Anatomy of an Android app  Simple ZIP file, renamed to “APK” extension  App resources  Signature  Manifest (binary XML) 4
  • 6. #RSAC Getting the APK from the phone  Backup to SD Card:  APKOptic  Astro file manager  etc… 6
  • 7. #RSAC Getting the APK from the phone  Using ADB (Android Debug Bridge):  adb shell pm list packages  adb pull /data/app/package-name-1.apk 7
  • 8. #RSAC Downloading the APK from Google Play  Using unofficial Google Play API:  https://github.com/egirault/googleplay-api  Using a web service or browser extension:  http://apps.evozi.com/apk-downloader/  http://apify.ifc0nfig.com/static/clients/apk-downloader/ 8
  • 9. #RSAC Downloading the APK from Google Play  Using unofficial Google Play API:  https://github.com/egirault/googleplay-api  Using a web service or browser extension:  http://apps.evozi.com/apk-downloader/  http://apify.ifc0nfig.com/static/clients/apk-downloader/ 9
  • 10. Getting our hands dirty: reversing the target application
  • 12. #RSAC Apktool  apktool - https://code.google.com/p/android-apktool/  Multi platform, Apache 2.0 license  Decode resources to original form (and rebuild after modification)  Transforms binary Dalvik bytecode (classes.dex) into Smali source 12
  • 14. #RSAC Decompiling – Java Decompiler DEX JAR JAVA 14
  • 15. #RSAC Dex2Jar  dex2jar - https://code.google.com/p/dex2jar/  Multi platform, Apache 2.0 license  Converts Dalvik bytecode (DEX) to java bytecode (JAR)  Allows to use any existing Java decompiler with the resulting JAR file 15
  • 16. #RSAC Java Decompilers  Jd-gui - http://jd.benow.ca/  Multi platform  closed source  JAD - http://varaneckas.com/jad/  Multi platform  closed source  Command line  Others: Dare, Mocha, Procyon, … 16
  • 17. #RSAC Decompiling – Android (Dalvik) decompiler DEX JAVA 17
  • 18. #RSAC Dalvik Decompilers  Transforming DEX to JAR looses important metadata that the decompiler could use.  Pure Dalvik decompilers skip this step, so they produce better output  Unfortunately there are not as many choices for Android decompilers as for Java decompilers:  Open Source: Androguard’s DAD - https://code.google.com/p/androguard/  Commercial: JEB - http://www.android-decompiler.com/  Others? 18
  • 20. #RSAC Demo – Santoku Linux  Santoku Linux - https://santoku-linux.com/  Mobile Forensics  Mobile Malware analysis  Mobile application assessment 20
  • 21. #RSAC Summary  APK files are ZIP files, can be extracted with any unzip utility  Apktool helps extracting binary resources, and allows repacking  Dex2jar converts Dalvik Bytecode to Java Bytecode  Pure Android decompilers are better  Santoku Linux has all the tools you need to reverse engineering mobile apps 21
  • 22. #RSAC Q&A | Contact | Feedback  Thanks for listening…  @pof  github.com/poliva  poliva@viaforensics.com 22