CNIT 128
Hacking Mobile Devices
6. Analyzing Android Applications

Part 1
Topics
• Part 1
• Creating Your First Android Environment
• Understanding Android Applications
• Part 2
• Understanding the Security Model
• Reverse-Engineering Applications
Creating Your First Android
Environment
Android SDK
• Android Studio: complete app IDE
• Integrated Development Environment
• Command line tools only
Host OS
• Mac or Linux is best
• Windows causes many problems
• Bluestacks is best emulator for Windows
• We'll use Kali Linux
• Android tools already installed
Android SDK Tools
• adb
• The main tool you'll use
• Install apps
• Pull files off the device
• Get a shell
• Read logs
Android SDK Tools
• monitor
• See running processes
• android
• Manage Android emulators
• aapt
• Used by apktool to package source code
into binary form when building apps
Emulators
• Genymotion has 133 of them available
Emulator Restrictions
• Have root access
• No physical USB, headphones, Wi-Fi,
Bluetooth
• Cannot make phone calls
• Can simulate calls and SMS
Popular Emulators
• Virtualbox running Android x86
• BlueStacks, YouWave, Windows Android
• All run on Windows
Understanding Android
Applications
Android OS Basics
• Modified Linux kernel
• Virtual machine that runs Java-like apps
• Dalvik Virtual Machine
User Accounts
• On Linux, every app a user launches runs with
the same user ID (UID)
• This is the same as Windows
CNIT 128 6. Analyzing Android Applications (Part 1)
Android UIDs
• Each app runs under a different UID
• Unless a developer chooses to set several
apps with the same signature share a UID
Android UIDs
• adb shell
• ps -A
• Each app has an account starting u0_
• There are also special accounts like system and
root
/data/data
• Home directory for apps
Android Packages
• APK file
• Zipped archive
• Contains code, resources, and metadata
APK Packaging Process
• aapt converts XML resource files to binary
form
• aidl converts .aidl files to .java
• All source code and output from aapt and aidl
compiled into .class files by Java compiler
• dx converts .class files to a single
classes.dex file
APK Packaging Process
• apkbuilder combines all compiles resources,
images, and DEX file into an APK file
• jarsigner signs the APK
Structure of an APK
• /assets
• /res
• /lib
• /META-INF
• AndroidManifest.xml
• classes.dex
• resources.rsrc
Structure of an APK
• /assets
• Files developer wants to include
• /res
• Layouts, images, etc, in raw subdirectory
• /lib
• Libraries, in subdirectories x86, ARM, MIPS
Structure of an APK
• /META-INF
• Certificate of application, file inventory with
hashes
• AndroidManifest.xml
• Configuration of application and security
parameters
AndroidManifest.xml
Structure of an APK
• classes.dex
• Executable file containing Dalvik bytecode
• resources.rsrc
• Application strings
• Resources the developer chose to place
here instead of /res
Installing Packages
• GTalkService
• Maintains a connection to Google via pinned
SSL
• Fetches apps from Google Play
• Alternative apps stores are available
• Amazon, Samsung, GetJar, etc.
• Often even less safe
adb Commands
• adb install -- installs an app
• adb shell -- opens command shell
• adb push -- pushes file onto device
• adb pull -- pulls file from device
• adb forward -- forwards a TCP port
• adb logcat -- shows the syslog
Busybox
• A single binary with many useful Linux tools,
including:
• chmod, cp, echo, grep, ifconfig, mv, nc,
netstat, pwd, rm
Standard Android Tools
• pm -- Package Manager
• pm list packages -- show all packages
• pm path -- find stored APK for an app
• pm install
• pm uninstall
Standard Android Tools
• logcat -- view system logs
• getprop -- show system properties
• dumpsys -- status of system services
Drozer
• Security assessment tool
• Finds vulnerabilities
• Develops exploits
• Community edition is free
• Pro version costs money
How Drozer Works
• Agent
• App on device, a Remote Administration Tool
• Console
• Command-line tool on your computer
• Interacts with the Agent
• Server
• Routes sessions between Agent and
Console
Agent and Console
Binder
• Kernel module for Inter-Process
Communication (IPC)
• A character device at /dev /binder
Application Components
• Activities
• Visual screens of an app
• Services
• Components with no GUI
• Broadcast receivers
• Can detect events like an incoming SMS
• Content providers
• Data storehouses, often SQLite
Running

Services
• On Genymotion
• Settings
• System
• Advanced
• Developer
Options
• Running
services
AndroidManifest.xml
• Lists all
components
usable in
application
• Except
broadcast
receivers
• Lists permissions
Intents
• An object used for messaging between apps
• Works by calling binder
• This intent opens google.com in a browser
Implicit Intent
• The code on the last slide does not specify the
target app
• Any app that can respond to a VIEW action
on a URL is eligible to receive the intent
• If only one app can handle it, it goes there
• Otherwise an application picker appears
Intent Filters
• An app with this filter can diplay Web pages
Explicit Intent
• Sends URL specifically to the Android browser
Running an App
• When OS boots, a single VM starts
• A zygote process listens for app launch
requests
• Each app that launches causes a fork()
• Core libraries are shared between VMs
CNIT 128 6. Analyzing Android Applications (Part 1)
Demonstrations

More Related Content

PDF
CNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static Techniques
PDF
CNIT 128: 7. Attacking Android Applications (Part 1 of 3)
ODP
Linux Internals - Kernel/Core
PPT
Operating system lecture1
PPTX
White box testing
PPT
Linux file system
PPT
PPTX
Android application-component
CNIT 126 Ch 0: Malware Analysis Primer & 1: Basic Static Techniques
CNIT 128: 7. Attacking Android Applications (Part 1 of 3)
Linux Internals - Kernel/Core
Operating system lecture1
White box testing
Linux file system
Android application-component

What's hot (20)

PDF
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
PDF
UI controls in Android
PDF
CNIT 126 4: A Crash Course in x86 Disassembly
PDF
CNIT 126 5: IDA Pro
PDF
Android Components & Manifest
PDF
Booting Android: bootloaders, fastboot and boot images
PPTX
Software Development Life Cycle-SDLC
PDF
Encrypted DNS - DNS over TLS / DNS over HTTPS
PDF
Introduction to Exploitation
PDF
Android Internals
PDF
CNIT 152: 1 Real-World Incidents
PDF
Linux kernel modules
PDF
Android Programming Basics
DOCX
data replication
PDF
Linux introduction
PPTX
Android UI
PDF
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
PPTX
Linux standard file system
PDF
ELC2019: Static Partitioning Made Simple
PDF
Linux kernel architecture
Embedded Systems: Lecture 13: Introduction to GNU Toolchain (Build Tools)
UI controls in Android
CNIT 126 4: A Crash Course in x86 Disassembly
CNIT 126 5: IDA Pro
Android Components & Manifest
Booting Android: bootloaders, fastboot and boot images
Software Development Life Cycle-SDLC
Encrypted DNS - DNS over TLS / DNS over HTTPS
Introduction to Exploitation
Android Internals
CNIT 152: 1 Real-World Incidents
Linux kernel modules
Android Programming Basics
data replication
Linux introduction
Android UI
Embedded Systems: Lecture 11: Introduction to Git & GitHub (Part 2)
Linux standard file system
ELC2019: Static Partitioning Made Simple
Linux kernel architecture
Ad

Similar to CNIT 128 6. Analyzing Android Applications (Part 1) (20)

PPTX
Hacker Halted 2014 - Reverse Engineering the Android OS
PDF
Android app development by abhi android
PPTX
Android app development
PPTX
Android
PDF
Android Overview
ODP
Java Meetup - 12-03-15 - Android Development Workshop
PDF
Android_Malware_IOAsis_2014_Analysis.pdf
PPTX
Android village @nullcon 2012
PDF
Andriod Pentesting and Malware Analysis
PDF
Introduction to Android App Development
PDF
Android
PDF
An Introduction To Android
PPTX
Developing for Android-Types of Android Application
PDF
Unit 1 Kali Nethunter Android: OS, Debub Bridge
PDF
Introduction to everything around Android
PPT
Google android os
PPT
Android For Java Developers
PPTX
Android session-1-sajib
PPT
Chapter 1 Introduction to android.ppt pl
Hacker Halted 2014 - Reverse Engineering the Android OS
Android app development by abhi android
Android app development
Android
Android Overview
Java Meetup - 12-03-15 - Android Development Workshop
Android_Malware_IOAsis_2014_Analysis.pdf
Android village @nullcon 2012
Andriod Pentesting and Malware Analysis
Introduction to Android App Development
Android
An Introduction To Android
Developing for Android-Types of Android Application
Unit 1 Kali Nethunter Android: OS, Debub Bridge
Introduction to everything around Android
Google android os
Android For Java Developers
Android session-1-sajib
Chapter 1 Introduction to android.ppt pl
Ad

More from Sam Bowne (20)

PDF
Introduction to the Class & CISSP Certification
PDF
Cyberwar
PDF
3: DNS vulnerabilities
PDF
8. Software Development Security
PDF
4 Mapping the Application
PDF
3. Attacking iOS Applications (Part 2)
PDF
12 Elliptic Curves
PDF
11. Diffie-Hellman
PDF
2a Analyzing iOS Apps Part 1
PDF
9 Writing Secure Android Applications
PDF
12 Investigating Windows Systems (Part 2 of 3)
PDF
10 RSA
PDF
12 Investigating Windows Systems (Part 1 of 3
PDF
9. Hard Problems
PDF
8 Android Implementation Issues (Part 1)
PDF
11 Analysis Methodology
PDF
8. Authenticated Encryption
PDF
7. Attacking Android Applications (Part 2)
PDF
7. Attacking Android Applications (Part 1)
PDF
5. Stream Ciphers
Introduction to the Class & CISSP Certification
Cyberwar
3: DNS vulnerabilities
8. Software Development Security
4 Mapping the Application
3. Attacking iOS Applications (Part 2)
12 Elliptic Curves
11. Diffie-Hellman
2a Analyzing iOS Apps Part 1
9 Writing Secure Android Applications
12 Investigating Windows Systems (Part 2 of 3)
10 RSA
12 Investigating Windows Systems (Part 1 of 3
9. Hard Problems
8 Android Implementation Issues (Part 1)
11 Analysis Methodology
8. Authenticated Encryption
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 1)
5. Stream Ciphers

Recently uploaded (20)

PDF
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
PDF
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf
PDF
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
PPTX
ACFE CERTIFICATION TRAINING ON LAW.pptx
PPTX
operating_systems_presentations_delhi_nc
PPSX
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
PPTX
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
PPTX
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
PPTX
Theoretical for class.pptxgshdhddhdhdhgd
PDF
GSA-Past-Papers-2010-2024-2.pdf CSS examination
PPTX
Power Point PR B.Inggris 12 Ed. 2019.pptx
PDF
Review of Related Literature & Studies.pdf
PDF
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
PDF
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
PDF
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
PPTX
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
PDF
faiz-khans about Radiotherapy Physics-02.pdf
PDF
Diabetes Mellitus , types , clinical picture, investigation and managment
PPTX
Neurology of Systemic disease all systems
PPTX
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt
English 2nd semesteNotesh biology biopsy results from the other day and I jus...
WHAT NURSES SAY_ COMMUNICATION BEHAVIORS ASSOCIATED WITH THE COMP.pdf
GIÁO ÁN TIẾNG ANH 7 GLOBAL SUCCESS (CẢ NĂM) THEO CÔNG VĂN 5512 (2 CỘT) NĂM HỌ...
ACFE CERTIFICATION TRAINING ON LAW.pptx
operating_systems_presentations_delhi_nc
namma_kalvi_12th_botany_chapter_9_ppt.ppsx
UCSP Section A - Human Cultural Variations,Social Differences,social ChangeCo...
PAIN PATHWAY & MANAGEMENT OF ACUTE AND CHRONIC PAIN SPEAKER: Dr. Rajasekhar ...
Theoretical for class.pptxgshdhddhdhdhgd
GSA-Past-Papers-2010-2024-2.pdf CSS examination
Power Point PR B.Inggris 12 Ed. 2019.pptx
Review of Related Literature & Studies.pdf
LATAM’s Top EdTech Innovators Transforming Learning in 2025.pdf
Horaris_Grups_25-26_Definitiu_15_07_25.pdf
CHALLENGES FACED BY TEACHERS WHEN TEACHING LEARNERS WITH DEVELOPMENTAL DISABI...
Unit1_Kumod_deeplearning.pptx DEEP LEARNING
faiz-khans about Radiotherapy Physics-02.pdf
Diabetes Mellitus , types , clinical picture, investigation and managment
Neurology of Systemic disease all systems
principlesofmanagementsem1slides-131211060335-phpapp01 (1).ppt

CNIT 128 6. Analyzing Android Applications (Part 1)

  • 1. CNIT 128 Hacking Mobile Devices 6. Analyzing Android Applications Part 1
  • 2. Topics • Part 1 • Creating Your First Android Environment • Understanding Android Applications • Part 2 • Understanding the Security Model • Reverse-Engineering Applications
  • 3. Creating Your First Android Environment
  • 4. Android SDK • Android Studio: complete app IDE • Integrated Development Environment • Command line tools only
  • 5. Host OS • Mac or Linux is best • Windows causes many problems • Bluestacks is best emulator for Windows • We'll use Kali Linux • Android tools already installed
  • 6. Android SDK Tools • adb • The main tool you'll use • Install apps • Pull files off the device • Get a shell • Read logs
  • 7. Android SDK Tools • monitor • See running processes • android • Manage Android emulators • aapt • Used by apktool to package source code into binary form when building apps
  • 8. Emulators • Genymotion has 133 of them available
  • 9. Emulator Restrictions • Have root access • No physical USB, headphones, Wi-Fi, Bluetooth • Cannot make phone calls • Can simulate calls and SMS
  • 10. Popular Emulators • Virtualbox running Android x86 • BlueStacks, YouWave, Windows Android • All run on Windows
  • 12. Android OS Basics • Modified Linux kernel • Virtual machine that runs Java-like apps • Dalvik Virtual Machine
  • 13. User Accounts • On Linux, every app a user launches runs with the same user ID (UID) • This is the same as Windows
  • 15. Android UIDs • Each app runs under a different UID • Unless a developer chooses to set several apps with the same signature share a UID
  • 16. Android UIDs • adb shell • ps -A • Each app has an account starting u0_ • There are also special accounts like system and root
  • 18. Android Packages • APK file • Zipped archive • Contains code, resources, and metadata
  • 19. APK Packaging Process • aapt converts XML resource files to binary form • aidl converts .aidl files to .java • All source code and output from aapt and aidl compiled into .class files by Java compiler • dx converts .class files to a single classes.dex file
  • 20. APK Packaging Process • apkbuilder combines all compiles resources, images, and DEX file into an APK file • jarsigner signs the APK
  • 21. Structure of an APK • /assets • /res • /lib • /META-INF • AndroidManifest.xml • classes.dex • resources.rsrc
  • 22. Structure of an APK • /assets • Files developer wants to include • /res • Layouts, images, etc, in raw subdirectory • /lib • Libraries, in subdirectories x86, ARM, MIPS
  • 23. Structure of an APK • /META-INF • Certificate of application, file inventory with hashes • AndroidManifest.xml • Configuration of application and security parameters
  • 25. Structure of an APK • classes.dex • Executable file containing Dalvik bytecode • resources.rsrc • Application strings • Resources the developer chose to place here instead of /res
  • 26. Installing Packages • GTalkService • Maintains a connection to Google via pinned SSL • Fetches apps from Google Play • Alternative apps stores are available • Amazon, Samsung, GetJar, etc. • Often even less safe
  • 27. adb Commands • adb install -- installs an app • adb shell -- opens command shell • adb push -- pushes file onto device • adb pull -- pulls file from device • adb forward -- forwards a TCP port • adb logcat -- shows the syslog
  • 28. Busybox • A single binary with many useful Linux tools, including: • chmod, cp, echo, grep, ifconfig, mv, nc, netstat, pwd, rm
  • 29. Standard Android Tools • pm -- Package Manager • pm list packages -- show all packages • pm path -- find stored APK for an app • pm install • pm uninstall
  • 30. Standard Android Tools • logcat -- view system logs • getprop -- show system properties • dumpsys -- status of system services
  • 31. Drozer • Security assessment tool • Finds vulnerabilities • Develops exploits • Community edition is free • Pro version costs money
  • 32. How Drozer Works • Agent • App on device, a Remote Administration Tool • Console • Command-line tool on your computer • Interacts with the Agent • Server • Routes sessions between Agent and Console
  • 34. Binder • Kernel module for Inter-Process Communication (IPC) • A character device at /dev /binder
  • 35. Application Components • Activities • Visual screens of an app • Services • Components with no GUI • Broadcast receivers • Can detect events like an incoming SMS • Content providers • Data storehouses, often SQLite
  • 36. Running
 Services • On Genymotion • Settings • System • Advanced • Developer Options • Running services
  • 37. AndroidManifest.xml • Lists all components usable in application • Except broadcast receivers • Lists permissions
  • 38. Intents • An object used for messaging between apps • Works by calling binder • This intent opens google.com in a browser
  • 39. Implicit Intent • The code on the last slide does not specify the target app • Any app that can respond to a VIEW action on a URL is eligible to receive the intent • If only one app can handle it, it goes there • Otherwise an application picker appears
  • 40. Intent Filters • An app with this filter can diplay Web pages
  • 41. Explicit Intent • Sends URL specifically to the Android browser
  • 42. Running an App • When OS boots, a single VM starts • A zygote process listens for app launch requests • Each app that launches causes a fork() • Core libraries are shared between VMs