SlideShare a Scribd company logo
CNIT 128
Hacking Mobile Devices
8. Identifying and Exploiting 

Android Implementation Issues

Part 2
Topics
• Part 1
• Reviewing Pre-installed Applications
• Exploiting Devices
• Start through "Explanation of Privilege
Levels" (up to p. 402)
Topics
• Part 2
• Exploiting Devices
• "Practical Physical Attacks" (p. 375)
through
• "Polaris Viewer Memory Corruption" (up to
p. 402)
Topics
• Part 3
• Exploiting Devices
• "Injecting Exploits for JavaScript
Interfaces" (p. 402) and following
• Infiltrating User Data
Practical Physical Attacks
Bypassing Lock Screen
• Getting ADB Shell
Access: Two Ways
• USB Debugging
• Unlocked
Bootloaders
USB Debugging
• adb shell
• Usually turned off by
default
• Exposes data and
can be used to install
new packages
• User must approve it
• Not possible if
screen is locked
Bug
• In Android up to 4.4.2
• Navigating to energency dialer or lock screen
camera
• Allows the USB debugging authorization
prompt
• With the screen locked
Privilege Levels
• /default.prop file controld ADB privileges
• By default: ro.secure=1
• Adb runs as the shell user
• If ro.secure=0
• Adb runs as root
ALLOW_ADBD_ROOT
• From Android 4.3 onwards
• ADB won't run as root unless it's compiled with
the ALLOW_ADBD_ROOT flag
• Even if rro.secure=0
• To get root, compile a custom version of adbd
and overwrite the binary on the device
Unlocked Bootloaders
• First boot phone into Fastboot mode
• Hold down power and volume keys while
turning on the phone
• or adb reboot bootloader
• Not possible with Genymotion, Nox, or
Bluestacks
• They have no recovery partition
Unlock Bootloader
• Forces factory
reset
• Wipes all user
data
• To stop thieves
Unlocked Bootloader
• If user unlocked it and left it unlocked
• Boot into ClockworkMod Recovery ROM
(not updated since 2014)
• Get a root ADB shell
Bypassing Lock Screens
• Using the DISABLE_KEYGUARD Permission
• Allows an app to remove the lock screen
• App code:
KeyguardManager kgm =
((KeyguardManager)getSystemService("keyguard"));
KeyGuardManager.KeyguardLock kgl =
kgm.newKeyguardLock("mahh");
kgl.disableKeyguard(); Even though the
KeyguardManager.KeyguardLock
Custom Drozer Agent
drozer agent build --permission
android.permission.DISABLE_KEYGUARD
• Install agent with adb, launch it, and bypass
screen lock
• Works on Nox (Android 5.1.1)
• Fails on Genymotion (Android 9.0)
Removing Key Files
• Pattern lock screen uses data from
• /data/system/gesure.key
• PIN or password lock uses data from
• /data/system/password.key
• Removing these files disables lock screen
entirely
Removing Key Files
• But that requires running as system or root
• Privilege escalation
Abusing Android
Application Issues
• On Android 4.3 and earlier, this intent unlocks
the phone:
shell@android:/ $ am start -n 

com.android.settings/
com.android.settings.ChooseLockGeneric 

--ez confirm_credentials false 

--ei lockscreen.password_type 0 --activity-clear-task
Starting: Intent { flg=0x8000
cmp=com.android.settings/.ChooseLockGeneric (has
extras) }
Using Logic Flaws that
Don't Require Shell Access
• Some actions are allowed when a phone is
locked
• Make emergency phone calls
• Receive phone calls
• Allow third-party apps to temporarily disable
the lock screen
• Or place an activity in front of it
Motorola Droid
• Phone the locked device
• Answer the call
• Press Back button
• Escape the lock screen
Viber
• Messaging and calling app
• Place a Viber call
• Answer it
• Press the back button multiple times
• Escape the lock screen
Usng Legitimate Lock
Screen Reset Functionality
• Entering the PIN
five times
incorrectly
• Connects to a
linked Google
account
Android Device Manager
• Allows lock
screen to be
bypassed from
a Google
account
• Not active by
default--user
must enable it
Practical Remote Attacks
Remote Exploits
• Launched over the Internet
• Three modes of exploitation:
• Loading a drozer JAR that loads a limited
agent
• Installing and starting a rogue drozer agent
by abusing INSTALL_PACKAGES
• Loading a drozer JAR that is passed
Context
Browser Memory
Corruption
• The most technical method
• Reverse shells via buffer overflow, etc.
• Becoming rarer as the browser becomes more
secure
Polaris Viewer
Memory Corruption
• Office and PDF file viewer
• Pre-installed on some devices
• Exploited in 2012 with a crafted DOCX file
• Using a stack-based buffer overflow
• App also had INSTALL_PACKAGES
permission
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 2)
Android Browser JavaScript
Interface
• All WebViews using JavaScriptInterface
• And targeting API before 17
• Are vulnerable to code execution flaws
• Includes all stock Android browsers on Android
4.1.1 and below
• Can get Context and use full permissions of
browser
Use Metasploit
• Link Ch 8g
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 2)
Privilege Escalation
• Exynos driver exploit on some devices
• Drozer has a exploit.mmap_abuse module
• Tries to get root by abusing the map device
operation
• Similar to the exynos exploit
• Very dangerous: may cause a kernel panic
and reboot the device
Maintaining Access
• Must install a special su binary bundled with
Drozer, called "minimal su"
• Allows every app to escalate to root
• Without alerting the user
Man-in-the-Middle Exploits
• Getting in the middie
• Host a wireless network
• ARP Poisoning
• Use Burp
Man-in-the-Middle Exploits
• Intercepting SSL requires the ability to get a
root CA certificate
• Only nation-states or very rich attackers
• But many apps ignore this defense and allow
MITM attacks anyway
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 2)

More Related Content

What's hot (20)

PDF
6. Analyzing Android Applications Part 2
Sam Bowne
 
PDF
CNIT 128 7. Attacking Android Applications (Part 3)
Sam Bowne
 
PDF
CNIT 128: Android Implementation Issues (Part 2)
Sam Bowne
 
PDF
CNIT 128 9. Writing Secure Android Applications
Sam Bowne
 
PDF
CNIT 128 2. Analyzing iOS Applications (Part 1)
Sam Bowne
 
PDF
CNIT 128 7. Attacking Android Applications (Part 3)
Sam Bowne
 
PDF
CNIT 128: 7. Attacking Android Applications (Part 1 of 3)
Sam Bowne
 
PDF
CNIT 128 8. Android Implementation Issues (Part 2)
Sam Bowne
 
PDF
CNIT 128: 3. Attacking iOS Applications (Part 2)
Sam Bowne
 
PDF
CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
Sam Bowne
 
PDF
CNIT 128 7. Attacking Android Applications (Part 2)
Sam Bowne
 
PDF
CNIT 128 8. Android Implementation Issues (Part 3)
Sam Bowne
 
PDF
CNIT 128 9. Writing Secure Android Applications
Sam Bowne
 
PDF
Hacking Tizen: The OS of everything - Whitepaper
Ajin Abraham
 
PDF
2015.04.24 Updated > Android Security Development - Part 1: App Development
Cheng-Yi Yu
 
PPT
iOS Application Pentesting
n|u - The Open Security Community
 
PDF
Abusing, Exploiting and Pwning with Firefox Add-ons
Ajin Abraham
 
PDF
Shellcoding in linux
Ajin Abraham
 
PPTX
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Ajin Abraham
 
PPT
iOS Hacking: Advanced Pentest & Forensic Techniques
Ömer Coşkun
 
6. Analyzing Android Applications Part 2
Sam Bowne
 
CNIT 128 7. Attacking Android Applications (Part 3)
Sam Bowne
 
CNIT 128: Android Implementation Issues (Part 2)
Sam Bowne
 
CNIT 128 9. Writing Secure Android Applications
Sam Bowne
 
CNIT 128 2. Analyzing iOS Applications (Part 1)
Sam Bowne
 
CNIT 128 7. Attacking Android Applications (Part 3)
Sam Bowne
 
CNIT 128: 7. Attacking Android Applications (Part 1 of 3)
Sam Bowne
 
CNIT 128 8. Android Implementation Issues (Part 2)
Sam Bowne
 
CNIT 128: 3. Attacking iOS Applications (Part 2)
Sam Bowne
 
CNIT 128 6. Analyzing Android Applications (Part 2 of 3)
Sam Bowne
 
CNIT 128 7. Attacking Android Applications (Part 2)
Sam Bowne
 
CNIT 128 8. Android Implementation Issues (Part 3)
Sam Bowne
 
CNIT 128 9. Writing Secure Android Applications
Sam Bowne
 
Hacking Tizen: The OS of everything - Whitepaper
Ajin Abraham
 
2015.04.24 Updated > Android Security Development - Part 1: App Development
Cheng-Yi Yu
 
iOS Application Pentesting
n|u - The Open Security Community
 
Abusing, Exploiting and Pwning with Firefox Add-ons
Ajin Abraham
 
Shellcoding in linux
Ajin Abraham
 
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Ajin Abraham
 
iOS Hacking: Advanced Pentest & Forensic Techniques
Ömer Coşkun
 

Similar to CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 2) (20)

PDF
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
Sam Bowne
 
PDF
8 Android Implementation Issues (Part 1)
Sam Bowne
 
PPTX
Android Penetration Testing - Day 3
Mohammed Adam
 
PDF
9 Writing Secure Android Applications
Sam Bowne
 
PDF
Android Attacks
Michael Scovetta
 
PDF
Android Security, From the Ground Up
Opersys inc.
 
PPTX
Hacker Halted 2014 - Reverse Engineering the Android OS
EC-Council
 
PPTX
Java Insecurity: How to Deal with the Constant Vulnerabilities
Lumension
 
PDF
Kernel Mode Threats and Practical Defenses
Priyanka Aash
 
PPTX
Android village @nullcon 2012
hakersinfo
 
PPTX
Genymotion with Jenkins
Vishal Nayak
 
PPTX
Mobile security
priyanka pandey
 
PPTX
[Wroclaw #1] Android Security Workshop
OWASP
 
PDF
CNIT 128 Ch 4: Android
Sam Bowne
 
PPTX
Forensics WS Consolidated
Karter Rohrer
 
PDF
Android_Malware_IOAsis_2014_Analysis.pdf
jjb117343
 
PPSX
Android Rooting
Sisir Molakalapalli
 
PPTX
Whats different in android L, M, N and O
Pietro F. Maggi
 
PPTX
128-ch4.pptx
SankalpKabra
 
PPTX
Android Application WebAPI Development Training
OESF Education
 
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
Sam Bowne
 
8 Android Implementation Issues (Part 1)
Sam Bowne
 
Android Penetration Testing - Day 3
Mohammed Adam
 
9 Writing Secure Android Applications
Sam Bowne
 
Android Attacks
Michael Scovetta
 
Android Security, From the Ground Up
Opersys inc.
 
Hacker Halted 2014 - Reverse Engineering the Android OS
EC-Council
 
Java Insecurity: How to Deal with the Constant Vulnerabilities
Lumension
 
Kernel Mode Threats and Practical Defenses
Priyanka Aash
 
Android village @nullcon 2012
hakersinfo
 
Genymotion with Jenkins
Vishal Nayak
 
Mobile security
priyanka pandey
 
[Wroclaw #1] Android Security Workshop
OWASP
 
CNIT 128 Ch 4: Android
Sam Bowne
 
Forensics WS Consolidated
Karter Rohrer
 
Android_Malware_IOAsis_2014_Analysis.pdf
jjb117343
 
Android Rooting
Sisir Molakalapalli
 
Whats different in android L, M, N and O
Pietro F. Maggi
 
128-ch4.pptx
SankalpKabra
 
Android Application WebAPI Development Training
OESF Education
 
Ad

More from Sam Bowne (20)

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

Recently uploaded (20)

PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
PDF
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PDF
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
PPTX
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
PDF
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PDF
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
PPTX
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
PDF
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PPTX
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Women's Health: Essential Tips for Every Stage.pdf
Iftikhar Ahmed
 
SSHS-2025-PKLP_Quarter-1-Dr.-Kerby-Alvarez.pdf
AishahSangcopan1
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
grade 5 lesson matatag ENGLISH 5_Q1_PPT_WEEK4.pptx
SireQuinn
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
Chapter-V-DED-Entrepreneurship: Institutions Facilitating Entrepreneurship
Dayanand Huded
 
STAFF DEVELOPMENT AND WELFARE: MANAGEMENT
PRADEEP ABOTHU
 
CEREBRAL PALSY: NURSING MANAGEMENT .pdf
PRADEEP ABOTHU
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
Knee Extensor Mechanism Injuries - Orthopedic Radiologic Imaging
Sean M. Fox
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Soil and agriculture microbiology .pptx
Keerthana Ramesh
 
The dynastic history of the Chahmana.pdf
PrachiSontakke5
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
SPINA BIFIDA: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 

CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 2)

  • 1. CNIT 128 Hacking Mobile Devices 8. Identifying and Exploiting 
 Android Implementation Issues Part 2
  • 2. Topics • Part 1 • Reviewing Pre-installed Applications • Exploiting Devices • Start through "Explanation of Privilege Levels" (up to p. 402)
  • 3. Topics • Part 2 • Exploiting Devices • "Practical Physical Attacks" (p. 375) through • "Polaris Viewer Memory Corruption" (up to p. 402)
  • 4. Topics • Part 3 • Exploiting Devices • "Injecting Exploits for JavaScript Interfaces" (p. 402) and following • Infiltrating User Data
  • 6. Bypassing Lock Screen • Getting ADB Shell Access: Two Ways • USB Debugging • Unlocked Bootloaders
  • 7. USB Debugging • adb shell • Usually turned off by default • Exposes data and can be used to install new packages • User must approve it • Not possible if screen is locked
  • 8. Bug • In Android up to 4.4.2 • Navigating to energency dialer or lock screen camera • Allows the USB debugging authorization prompt • With the screen locked
  • 9. Privilege Levels • /default.prop file controld ADB privileges • By default: ro.secure=1 • Adb runs as the shell user • If ro.secure=0 • Adb runs as root
  • 10. ALLOW_ADBD_ROOT • From Android 4.3 onwards • ADB won't run as root unless it's compiled with the ALLOW_ADBD_ROOT flag • Even if rro.secure=0 • To get root, compile a custom version of adbd and overwrite the binary on the device
  • 11. Unlocked Bootloaders • First boot phone into Fastboot mode • Hold down power and volume keys while turning on the phone • or adb reboot bootloader • Not possible with Genymotion, Nox, or Bluestacks • They have no recovery partition
  • 12. Unlock Bootloader • Forces factory reset • Wipes all user data • To stop thieves
  • 13. Unlocked Bootloader • If user unlocked it and left it unlocked • Boot into ClockworkMod Recovery ROM (not updated since 2014) • Get a root ADB shell
  • 14. Bypassing Lock Screens • Using the DISABLE_KEYGUARD Permission • Allows an app to remove the lock screen • App code: KeyguardManager kgm = ((KeyguardManager)getSystemService("keyguard")); KeyGuardManager.KeyguardLock kgl = kgm.newKeyguardLock("mahh"); kgl.disableKeyguard(); Even though the KeyguardManager.KeyguardLock
  • 15. Custom Drozer Agent drozer agent build --permission android.permission.DISABLE_KEYGUARD • Install agent with adb, launch it, and bypass screen lock • Works on Nox (Android 5.1.1) • Fails on Genymotion (Android 9.0)
  • 16. Removing Key Files • Pattern lock screen uses data from • /data/system/gesure.key • PIN or password lock uses data from • /data/system/password.key • Removing these files disables lock screen entirely
  • 17. Removing Key Files • But that requires running as system or root • Privilege escalation
  • 18. Abusing Android Application Issues • On Android 4.3 and earlier, this intent unlocks the phone: shell@android:/ $ am start -n 
 com.android.settings/ com.android.settings.ChooseLockGeneric 
 --ez confirm_credentials false 
 --ei lockscreen.password_type 0 --activity-clear-task Starting: Intent { flg=0x8000 cmp=com.android.settings/.ChooseLockGeneric (has extras) }
  • 19. Using Logic Flaws that Don't Require Shell Access • Some actions are allowed when a phone is locked • Make emergency phone calls • Receive phone calls • Allow third-party apps to temporarily disable the lock screen • Or place an activity in front of it
  • 20. Motorola Droid • Phone the locked device • Answer the call • Press Back button • Escape the lock screen
  • 21. Viber • Messaging and calling app • Place a Viber call • Answer it • Press the back button multiple times • Escape the lock screen
  • 22. Usng Legitimate Lock Screen Reset Functionality • Entering the PIN five times incorrectly • Connects to a linked Google account
  • 23. Android Device Manager • Allows lock screen to be bypassed from a Google account • Not active by default--user must enable it
  • 25. Remote Exploits • Launched over the Internet • Three modes of exploitation: • Loading a drozer JAR that loads a limited agent • Installing and starting a rogue drozer agent by abusing INSTALL_PACKAGES • Loading a drozer JAR that is passed Context
  • 26. Browser Memory Corruption • The most technical method • Reverse shells via buffer overflow, etc. • Becoming rarer as the browser becomes more secure
  • 27. Polaris Viewer Memory Corruption • Office and PDF file viewer • Pre-installed on some devices • Exploited in 2012 with a crafted DOCX file • Using a stack-based buffer overflow • App also had INSTALL_PACKAGES permission
  • 29. Android Browser JavaScript Interface • All WebViews using JavaScriptInterface • And targeting API before 17 • Are vulnerable to code execution flaws • Includes all stock Android browsers on Android 4.1.1 and below • Can get Context and use full permissions of browser
  • 32. Privilege Escalation • Exynos driver exploit on some devices • Drozer has a exploit.mmap_abuse module • Tries to get root by abusing the map device operation • Similar to the exynos exploit • Very dangerous: may cause a kernel panic and reboot the device
  • 33. Maintaining Access • Must install a special su binary bundled with Drozer, called "minimal su" • Allows every app to escalate to root • Without alerting the user
  • 34. Man-in-the-Middle Exploits • Getting in the middie • Host a wireless network • ARP Poisoning • Use Burp
  • 35. Man-in-the-Middle Exploits • Intercepting SSL requires the ability to get a root CA certificate • Only nation-states or very rich attackers • But many apps ignore this defense and allow MITM attacks anyway