SlideShare a Scribd company logo
CNIT 128
Hacking Mobile Devices
8. Identifying and Exploiting
Android Implementation Issues
Part 1 Updated 10-24-22
Topics
• Part 1
• Reviewing Pre-installed Applications
• Exploiting Devices
• Start through "Explanation of Privilege
Levels" (up to p. 375)
Topics
• Part 2
• Exploiting Devices
• "Practical Physical Attacks" (p. 376)
through
• "Man-in-the-Middle Exploits" (up to p. 401)
Topics
• Part 3
• Exploiting Devices
• "Injecting Exploits for JavaScript
Interfaces" (p. 401) and following
• Infiltrating User Data
Reviewing Pre-Installed
Applications
Root Access
• Each installed app has its own attack surface
• But when you exploit an app, you get access
with the privileges of that app
• Not root access
• But you can often exfiltrate user data without
root access
Find Powerful Apps
INSTALL PACKAGES
• Exploiting an app with this permission allows
an attacker to install a Trojan app
• Permission level signature|system
• Defined by the android package
Drozer on an Emulator
• Real devices have many more apps with this
dangerous permission
Apps Running as System
• On an emulator
• Many more on a real device (66 in book)
Finding Remote Attack
Vectors
Techniques
• Trick user into installing a malicious app
• Server-side: exploit a listening port
• Client-side: open a malicious document
Browsers and Document
Readers
• Frequently vulnerable
• Complex parsers written in native code
• Fuzzers can fund vulnerabilities
• Samsung has Polaris Viewer for PDFs by
default
• No PDF reader on my emulator
BROWSEABLE Activities
• Allows users to open content inside an
installed app rather than the browser
• App stores installed on the device use this
functionality
• To open links that point to apps
Example
• Manifest from a rogue Drozer agent
• Opening a link starting with pwn:// will open
this activity
• But can't be used in an iframe anymore
<activity
 

android:name="com.mwr.dz.PwnActivity">
 

<intent-filter>
 

<action android:name="android.intent.action.VIEW" />
 

<category android:name="android.intent.category.DEFAULT" />
 

<category android:name="android.intent.category.BROWSABLE" />
 

<data android:scheme="pwn" />
 

</intent-filter>
 

</activity>
Two Methods
• Via pwn:// URI or "web intent"
<a href="pwn://me">Start drozer<a>
 

<a href="intent://me/#Intent;scheme=pwn;end">
Start Drozer</a>
Many apps use
BROWSABLE
filters on my
emulator
Custom Update
Mechanisms
• Apps often write their own update mechanisms
• Rather than using the Play Store
• This requires the INSTALL_PACKAGES
permission
• Code may be vulnerable
• May check for a new file over HTTP or
broken HTTPS
Remote Loading of Code
• Link Ch 8b
Remote Loading of Code
• Apps can load new code at runtime
• Using the Java Reflection API
• With the DexClassLoader class
• May load code over the network, or from a
local location that can be overwritten by
other applications
• May cause code injection vulnerabilities
WebViews
• Recipe for disaster
• Using a WebView
• Defining a JavaScript interface
• Loading from a cleartext source or having
SSL bypass code
• Targeting API versions prior to 17 or using
an Android version earlier than 4.2
• May allow JavaScript code injection
8 Android Implementation Issues (Part 1)
Google's Fix
• https://developer.android.com/develop/ui/
views/layout/webapps/webview
Listening Services
• Android is unlikely to have listening ports
• My Genymotion has a few
Messaging Applications
• Examples, may be vulnerable
• Short Message Service (SMS)
• Multimedia Messaging Service (MMS)
• Commercial Mobile Alert System (CMAS)
• Email clients
• Chat clients
Finding Local Vulnerabilities
• Manual process
• Download all installed apps
• Convert them to readable source code
• Use grep to search for vulnerabilities
• Or use Drozer's scanner modules
Drozer's SQLi Scanner
• Doesn't find the Sieve SQL injection
Exploiting Devices
Remote and Local Exploits
• Remote exploit
• Gives attacker a foothold on the device
• Such as software exploits, MITM attacks, or
malware
• Local exploit
• Requires a foothold on the device already
• Local privilege escalation
Using Attack Tools
• Performs ARP poisoning, DNS spoofing, etc.
• We're using local proxy settings
• You need ettercap to perform real MITM
attacks on a LAN
Ettercap
Burp
• Can inspect and modify traffic
• Sends fake TLS certificates
• Burp can be added as a "trusted CA"
8 Android Implementation Issues (Part 1)
Drozer
• Infrastructure Mode
• Runs a Drozer server, as a C&C server
• Make "rogue agents" which are like malware
• Custom-built to phone home to the Drozer
server
• Much like Metasploit
Privilege Levels
Non-System App without
Context
• Ex: a shell from a Web browser
• Attacker has privileges of the compromised
app
• Can navigate filesystem under the app's
user account
• Cannot use Java libraries
• Cannot install packages, or read SMS, etc.
Non-System App with
Context
• Attacker takes over app's execution flow and
can load arbitrary classes
• Attacker can retrieve app Context
• Can do anything the app can do
Installed Package
• Can request arbitrary permissions
• Can be granted them, depending on
protection level
ADB Shell Access
• Can install apps
• Can interact with apps as a developer
System User Access
• Running as system user, can
• Install apps
• Change device configuration
• Access data from any app's private directory
Root User Access
• Ultimate power, can
• Install apps
• Read and write RAM
• Manipulate any aspect of the device
8 Android Implementation Issues (Part 1)

More Related Content

PDF
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
PDF
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
PDF
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)
PDF
CNIT 128 8. Android Implementation Issues (Part 3)
PDF
CNIT 128: Android Implementation Issues (Part 2)
PDF
CNIT 128 8. Android Implementation Issues (Part 2)
PDF
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 2)
PPTX
Android Application Penetration Testing - Mohammed Adam
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 1)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 3)
CNIT 128 8. Android Implementation Issues (Part 3)
CNIT 128: Android Implementation Issues (Part 2)
CNIT 128 8. Android Implementation Issues (Part 2)
CNIT 128 8. Identifying and Exploiting Android Implementation Issues (Part 2)
Android Application Penetration Testing - Mohammed Adam

Similar to 8 Android Implementation Issues (Part 1) (20)

PDF
PDF
CNIT 128 7. Attacking Android Applications (Part 2)
PDF
CNIT 128 7. Attacking Android Applications (Part 2)
PPTX
Hacker Halted 2014 - Reverse Engineering the Android OS
PPT
Securely Deploying Android Device - ISSA (Ireland)
PDF
CNIT 128: 7. Attacking Android Applications (Part 1 of 3)
PDF
CNIT 128 7. Attacking Android Applications (Part 3)
PDF
7. Attacking Android Applications (Part 1)
PDF
Hacking your Android (slides)
PDF
CNIT 128 7. Attacking Android Applications (Part 1)
PDF
CNIT 128 7. Attacking Android Applications (Part 3)
PDF
7. Attacking Android Applications (Part 2)
PPTX
Mobile application security
PPTX
Mobile Application Security
PPT
Mobile code mining for discovery and exploits nullcongoa2013
PPTX
Android Hacking + Pentesting
PPTX
Mobile security part 1(Android Apps Pentesting)- Romansh yadav
PDF
Building Custom Android Malware BruCON 2013
PDF
Android malware presentation
PDF
CNIT 128 Ch 4: Android
CNIT 128 7. Attacking Android Applications (Part 2)
CNIT 128 7. Attacking Android Applications (Part 2)
Hacker Halted 2014 - Reverse Engineering the Android OS
Securely Deploying Android Device - ISSA (Ireland)
CNIT 128: 7. Attacking Android Applications (Part 1 of 3)
CNIT 128 7. Attacking Android Applications (Part 3)
7. Attacking Android Applications (Part 1)
Hacking your Android (slides)
CNIT 128 7. Attacking Android Applications (Part 1)
CNIT 128 7. Attacking Android Applications (Part 3)
7. Attacking Android Applications (Part 2)
Mobile application security
Mobile Application Security
Mobile code mining for discovery and exploits nullcongoa2013
Android Hacking + Pentesting
Mobile security part 1(Android Apps Pentesting)- Romansh yadav
Building Custom Android Malware BruCON 2013
Android malware presentation
CNIT 128 Ch 4: Android
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
11 Analysis Methodology
PDF
8. Authenticated Encryption
PDF
5. Stream Ciphers
PDF
6 Scope & 7 Live Data Collection
PDF
4. Block Ciphers
PDF
6 Analyzing Android Applications (Part 2)
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
11 Analysis Methodology
8. Authenticated Encryption
5. Stream Ciphers
6 Scope & 7 Live Data Collection
4. Block Ciphers
6 Analyzing Android Applications (Part 2)
Ad

Recently uploaded (20)

PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPTX
PPH.pptx obstetrics and gynecology in nursing
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
RMMM.pdf make it easy to upload and study
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Insiders guide to clinical Medicine.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Complications of Minimal Access Surgery at WLH
PDF
Business Ethics Teaching Materials for college
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
Module 4: Burden of Disease Tutorial Slides S2 2025
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PPH.pptx obstetrics and gynecology in nursing
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
RMMM.pdf make it easy to upload and study
Anesthesia in Laparoscopic Surgery in India
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
VCE English Exam - Section C Student Revision Booklet
Insiders guide to clinical Medicine.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Week 4 Term 3 Study Techniques revisited.pptx
STATICS OF THE RIGID BODIES Hibbelers.pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Supply Chain Operations Speaking Notes -ICLT Program
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Complications of Minimal Access Surgery at WLH
Business Ethics Teaching Materials for college
Renaissance Architecture: A Journey from Faith to Humanism

8 Android Implementation Issues (Part 1)

  • 1. CNIT 128 Hacking Mobile Devices 8. Identifying and Exploiting Android Implementation Issues Part 1 Updated 10-24-22
  • 2. Topics • Part 1 • Reviewing Pre-installed Applications • Exploiting Devices • Start through "Explanation of Privilege Levels" (up to p. 375)
  • 3. Topics • Part 2 • Exploiting Devices • "Practical Physical Attacks" (p. 376) through • "Man-in-the-Middle Exploits" (up to p. 401)
  • 4. Topics • Part 3 • Exploiting Devices • "Injecting Exploits for JavaScript Interfaces" (p. 401) and following • Infiltrating User Data
  • 6. Root Access • Each installed app has its own attack surface • But when you exploit an app, you get access with the privileges of that app • Not root access • But you can often exfiltrate user data without root access
  • 8. INSTALL PACKAGES • Exploiting an app with this permission allows an attacker to install a Trojan app • Permission level signature|system • Defined by the android package
  • 9. Drozer on an Emulator • Real devices have many more apps with this dangerous permission
  • 10. Apps Running as System • On an emulator • Many more on a real device (66 in book)
  • 12. Techniques • Trick user into installing a malicious app • Server-side: exploit a listening port • Client-side: open a malicious document
  • 13. Browsers and Document Readers • Frequently vulnerable • Complex parsers written in native code • Fuzzers can fund vulnerabilities • Samsung has Polaris Viewer for PDFs by default • No PDF reader on my emulator
  • 14. BROWSEABLE Activities • Allows users to open content inside an installed app rather than the browser • App stores installed on the device use this functionality • To open links that point to apps
  • 15. Example • Manifest from a rogue Drozer agent • Opening a link starting with pwn:// will open this activity • But can't be used in an iframe anymore <activity android:name="com.mwr.dz.PwnActivity"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="pwn" /> </intent-filter> </activity>
  • 16. Two Methods • Via pwn:// URI or "web intent" <a href="pwn://me">Start drozer<a> <a href="intent://me/#Intent;scheme=pwn;end"> Start Drozer</a>
  • 18. Custom Update Mechanisms • Apps often write their own update mechanisms • Rather than using the Play Store • This requires the INSTALL_PACKAGES permission • Code may be vulnerable • May check for a new file over HTTP or broken HTTPS
  • 19. Remote Loading of Code • Link Ch 8b
  • 20. Remote Loading of Code • Apps can load new code at runtime • Using the Java Reflection API • With the DexClassLoader class • May load code over the network, or from a local location that can be overwritten by other applications • May cause code injection vulnerabilities
  • 21. WebViews • Recipe for disaster • Using a WebView • Defining a JavaScript interface • Loading from a cleartext source or having SSL bypass code • Targeting API versions prior to 17 or using an Android version earlier than 4.2 • May allow JavaScript code injection
  • 24. Listening Services • Android is unlikely to have listening ports • My Genymotion has a few
  • 25. Messaging Applications • Examples, may be vulnerable • Short Message Service (SMS) • Multimedia Messaging Service (MMS) • Commercial Mobile Alert System (CMAS) • Email clients • Chat clients
  • 26. Finding Local Vulnerabilities • Manual process • Download all installed apps • Convert them to readable source code • Use grep to search for vulnerabilities • Or use Drozer's scanner modules
  • 27. Drozer's SQLi Scanner • Doesn't find the Sieve SQL injection
  • 29. Remote and Local Exploits • Remote exploit • Gives attacker a foothold on the device • Such as software exploits, MITM attacks, or malware • Local exploit • Requires a foothold on the device already • Local privilege escalation
  • 31. • Performs ARP poisoning, DNS spoofing, etc. • We're using local proxy settings • You need ettercap to perform real MITM attacks on a LAN Ettercap
  • 32. Burp • Can inspect and modify traffic • Sends fake TLS certificates • Burp can be added as a "trusted CA"
  • 34. Drozer • Infrastructure Mode • Runs a Drozer server, as a C&C server • Make "rogue agents" which are like malware • Custom-built to phone home to the Drozer server • Much like Metasploit
  • 36. Non-System App without Context • Ex: a shell from a Web browser • Attacker has privileges of the compromised app • Can navigate filesystem under the app's user account • Cannot use Java libraries • Cannot install packages, or read SMS, etc.
  • 37. Non-System App with Context • Attacker takes over app's execution flow and can load arbitrary classes • Attacker can retrieve app Context • Can do anything the app can do
  • 38. Installed Package • Can request arbitrary permissions • Can be granted them, depending on protection level
  • 39. ADB Shell Access • Can install apps • Can interact with apps as a developer
  • 40. System User Access • Running as system user, can • Install apps • Change device configuration • Access data from any app's private directory
  • 41. Root User Access • Ultimate power, can • Install apps • Read and write RAM • Manipulate any aspect of the device