SlideShare a Scribd company logo
Smartphone Hacking
TheArt ofAndroid Exploitation
By: Malachi Jones, PhD
About Me
 Education
 Bachelors Degree: Computer Engineering (Univ. of Florida, 2007)
 Master’s Degree: Computer Engineering (GeorgiaTech, 2009)
 PhD: Computer Engineering (GeorgiaTech, 2013)
 Cyber Security Experience
 Harris: Cyber Software Engineer (2013-2014)
 Harris: Vulnerability Researcher (2015)
 BoozAllen DarkLabs : Embedded Security Researcher (2016- Present)
https://www.linkedin.com/in/malachijonesphd
About Dark Labs
BoozAllen Dark Labs is an elite team of security researchers,
penetration testers, reverse engineers, network
analysts, and data scientists, dedicated to stopping
cyber attacks before they occur.1
(1 http://darklabs.bah.com)
2015: AYear of Embedded Exploitation
(Link)
(Link)
2015: AYear of Embedded Exploitation
(Link)
2015: AYear of Embedded Exploitation
(Link)
2016: The Exploitation Continues…
Outline
 Motivation: Understanding both sides (offense & defense)
 Objectives ofTalk
 Review
 Secure Coding
 Vulnerability Research (VR)
 Vulnerability Discovery on Android
 Weaponizing & Deploying Exploits
 Demo/Conclusion
Motivation: Understanding Offense & Defense
 DefensiveCyber Awareness
 Understanding and implementation of current best practices (e.g. secure
coding) to build a hardened security system
 Successfully making tradeoffs between security, performance, and cost
to develop a system that is useful, secure, and affordable
Motivation: Understanding Offense & Defense
 Offensive Cyber Awareness
 Forefront of new attacks & techniques
 Can help defenders develop mitigation techniques before a new attack can
cause significant damage
 Ability to think like the adversary to find and patch potential vulnerabilities
before they do
Objectives ofTalk
 Discuss techniques (borrowed from hackers) that can allow the
defender to find and patch vulnerabilities before a hacker does
 Demonstrate how effortless it can be to weaponize a vulnerability
to p0wn devices.
Android Hacker’s Handbook
 This presentation is based on material from the Handbook
 Joshua Drake is the lead author and also the person who discovered the
Android vulnerability dubbed StageFright
 Handbook provides a lot more in-depth coverage onAndroid Hacking
than we can cover in this presentation
Review
Secure Coding
Review: Secure Coding
 Low level code (e.g. drivers and kernels) of embedded devices such as
smartphones are written in C/C++
 The genius/curse of C/C++
 Trust the programmer
 Don’t prevent the programming from doing what needs to be done
 Make it fast, even if it is not guaranteed to be portable
 How does this translate to security and safety?
It doesn’t…..
Review: Secure Coding
 Best practices for secure C/C++ coding written by
Robert C. Seacord (CERT @ CMU)
 Based on common mistakes that inexperienced and
professional software developers make
 Should be a mandatory reading for any aspiring C/C++
programmer
Review: Secure Coding
 Question: So, how can bugs still manifest even if best practices such as
secure coding principles are adhered to?
 Answer:An attacker can exploit bugs in the interactions (external and/or
internal) of components in hardware and/or software systems
 Case Study: Hot Potato Exploit (link)
 Affects allWindows versions includingWindows 7 & 8
 Exploits bugs in the interaction with legacy software components
that include NetBIOS Name Service (NBNS)
 Can enable remote code execution by an attacker
Review
Vulnerability Research
Review:Vulnerability Research
 Primary objective of Vulnerability Research (VR) is to find exploitable
bugs (not all bugs are exploitable)
 Often, a proof of concept (PoC) is desirable that demonstrates the
extent to which the vulnerability can be weaponized in a reliable way to
p0wn devices.
Review:Vulnerability Research
 Complications (in the exploitation of bug)
 AddressSpace Layout Randomization (ASLR) : Randomizes base address of modules; difficult for
attacker to know where to direct cpu to execute code
 Data Execution Prevention (DEP) : Makes non-code memory regions not executable; no shell code
execution
 Reliability:The vulnerability may be difficult to consistently reproduce; vulnerability may require the
system to be in an unlikely state for exploitation
Review:Vulnerability Research
 VR Process Overview
 ProfilingTarget: Information gathering which includes port scanning
and preliminary reviews of device services and security features (e.g.
ASLR and SELinux)
 InitialAccess: Preferably obtaining access to a shell or a debug serial
port on a test device that is similar to target device
 Vulnerability Discovery: Activities include static analysis, dynamic
analysis, and fuzzing to discover an exploitable bug
 Exploitation/Weaponization: Development of a proof-of-concept that
demonstrates the exploit capabilities of bug.
Review:Vulnerability Research
 VR Process Overview
 ProfilingTarget: Information gathering which includes port scanning
and preliminary reviews of device services and security features (e.g.
ASLR and SELinux)
 InitialAccess: Preferably obtaining access to a shell or a debug serial
port on a test device that is similar to target device
 Vulnerability Discovery: Activities include static analysis, dynamic
analysis, and fuzzing to discover an exploitable bug
 Exploitation/Weaponization: Development of a proof-of-concept that
demonstrates the exploit capabilities of bug.
Presentation Focus
Review:Vulnerability Research
 Vulnerability Discovery
 Static Analysis: Analyzing code and data in the application without
directly executing the application; may require converting the binary
from machine code to C-like code, aka decompiling.
 DynamicAnalysis: Executing the application in an instrumented or
monitored manner to garner more concrete information on behavior
 Fuzzing: Dynamic method for testing software input validation by
feeding it intentionally malformed input
v
bool validatePassword(char * usercredential, int password_len, int username_len)
{
char username[100];
char password[100];
//Get username
memcpy(username, usercredential,username_len);
char *p_password = usercredential+ username_len +1;
//Get password
memcpy(password, p_password,password_len);
…………………………………………………………………………………………
}
No check to make sure that the
password length does not exceed the
local buffer size of ‘100’
Password buffer has
length of 100
Review:Vulnerability Research
 Static Analysis
 In the above example, there is a stack overflow vulnerability
 By passing in a ‘password’ with a length greater than 100, possible to
overflow buffer, which can allow for control of code execution
Review:Vulnerability Research
 Static Analysis
 If the source is unavailable, then it may be necessary to decompile the
binary into psuedo code
 Tools such as IDA PRO can be used to aid in reversing
Decompiled “Pseudo-C”ARM Dissassembly
Review:Vulnerability Research
 Dynamic Analysis
 Can be used to step through the code to understand behavior
 Variables and software state can be manipulated
Review:Vulnerability Research
 Fuzzing
 A primary objective is to generate malformed input that will induce
unexpected behavior in software that can include a crash
 Additional static/dynamic analysis can then be used to determine root cause
and whether or not the bug is exploitable
Software
Component
Input Output
Typical Scenario
Fuzzing Scenario
Software
Component
Output
Fuzzer
(Malformed Input)
Input Crash
Review:Vulnerability Research
 Exploitation/Weaponization
 RemoteAccess: Setting up a backdoor on the victim that allows for
future command and control capabilities
 Phoning home state of victim: Periodically updating the host about
the current activities and state of victim
 Persistence: Includes surviving a reboot of victim and attempts to
remove installed ‘custom’ software
Review:Vulnerability Research
 Weaponization: Case Study of Regin (link)
 Remote Access: Cyberattack platform that is deployed on victim networks
for total remote control of host at all levels
 Phoning Home State ofVictim: Forms a peer-to-peer network with other
infected machines to send information back to the command and control
center
 Persistence: Covertly installs kernel modules and drivers
28
Review:Vulnerability Research
 Question: Are Hackers the only ones that conduct vulnerability
research? If not, why would others do this type of research?
 Answer:
 The motivation behind this presentation is that the defenders should
also be usingVR techniques to identify exploitable bugs.
 Some companies have bug bounty hunting programs, where a
white/grey hat identifies a bug in exchange for money
 Others hireVR personnel onsite to hack into their own stuff. Example:
Charlie Miller and ChrisValasek were hired by Uber after their Chrysler
car hack demo (link).
Vulnerability Discovery on Android
Vulnerability Discovery on Android
 Important Note: Although concepts and techniques discussed in this
section are targeted at the Android platform, they are also relevant
for other platforms including iOS, Linux, andWindows.
Vulnerability Discovery on Android
Overall Goal:
Exercise code on the target with malformed
inputs that we generate
Vulnerability Discovery on Android
 Steps for Exploit Discovery using FuzzTesting
1. Choose a software target
2. Generate Inputs
3. Delivering & Processing Inputs
4. Monitor for crashes
Vulnerability Discovery on Android (The Steps)
1) Choose a SoftwareTarget
Vulnerability Discovery: Choosing aTarget
 Objective 1.1: Find a software attack surface whose code can be
exercised remotely by an adversary
Vulnerability Discovery: Choosing aTarget
 We’ll target the Android browser
 Why?
 Standard on all Android devices
 Since web browsers focus on performance, much of the code is implemented in C/C++
 Very complex with support for new technologies that include HTML5, and the
browser is essentially a mini OS
Vulnerability Discovery: Choosing aTarget
 Objective 1.2: Select a web technology that the browser implements
to focus on
 Note: One of the most challenging aspects of fuzzing is to
determining where to focus the fuzzing efforts
Vulnerability Discovery: Choosing aTarget
 We’ll focus on the Typed Array feature of HTML5
 Why HTML5
 Relatively new technologies, which means there are bound to be
undiscovered bugs
 Has a rich feature set that includes support for video and audio, which
means high complexity;complexity often introduces bugs
Vulnerability Discovery: Choosing aTarget
 Background: Typed Arrays
 Allows web developers access to a region of memory that is formatted
as a native array
 ExampleSnippet:
 Snippet Explained : Creates an array of 16 elements and initializes them
from 0 to 15
var arr = new Uint8Array(16);
for (var n = 0; n < arr.length; n++)
{
arr[n] = n
}
Vulnerability Discovery: Choosing aTarget
 Key Concepts:
 The typed array is a native array, which means that it doesn’t need to be
translated between JavaScript and native representation
 Translating back and forth between JavaScript and native representation impacts
performance
 Browser can achieve greater performance through improved efficiency using this
type of array
var arr = new Uint8Array(16);
for (var n = 0; n < arr.length; n++)
{
arr[n] = n
}
Vulnerability Discovery: Choosing aTarget
 Previously disclosed bugs inTyped Array :
 Researcher Pinkie Pie compromises of Chrome @ 2013 Mobile
pwn2Own (link)
 Researcher geohot compromises Chrome @ 2014 pwn2Own (link)
var arr = new Uint8Array(16);
for (var n = 0; n < arr.length; n++)
{
arr[n] = n
}
2) Generating Inputs
Vulnerability Discovery on Android (The Steps)
Vulnerability Discovery: Generate Inputs
 So now that we have our target, we’d like to generate inputs to see how
the target handles it
 Below is an example snippet that would generate different ‘types’ of Typed
Arrays
 Note: Generating ‘good’ inputs is not trivial. It requires an understanding
of the target and the possible unaddressed corner cases and boundary
conditions
def generate_var():
vtype = random.choice(TYPEDARRAY_TYPES)
vlen = rand_num()
return “var array1 = new %s(%d);” % (vtype, vlen)
Vulnerability Discovery on Android (The Steps)
3) Delivering & Processing Inputs
Vulnerability Discovery: Delivering Inputs
 Delivering Inputs
 What we’d like is a way to get the inputs to the target and have the
target execute it
 Tools such as BrowserFuzz have lightweight http servers that can
serve up the input to the target
 Processing Input
 Getting chrome to process our special URL (that points to our fuzz html
server) can be automated
 We can take advantage of the ActivityManager to start the browser
and tell it where to load content from via Intents
4) Monitoring for Crashes
Vulnerability Discovery on Android (The Steps)
Vulnerability Discovery: Monitoring for Crashes
 Key Concept: Monitoring the behavior of the target program is essential to
knowing whether you’ve discovered something that is noteworthy
 When a process on android crashes, debuggerd writes information about
the crash to the system log
 So we can monitor when the browser crashes by checking the system log.
Weaponizing and Deploying Exploits
Weaponizing and Deploying Exploits
 So we’ve found an exploit… How do we make it useful?
Weaponizing and Deploying Exploits
 The Steps (Browser exploit)
1. Choose the target
2. Develop or utilize an exploit delivery mechanism (e.g.
Metasploit)
3. Get in-between the victim and the network
4. Inject exploit code in the victim’s HTML traffic
5. Implant malware (e.g. key logger, screenscraper, etc..)
Weaponizing and Deploying Exploits(The Steps)
1) Choose the target
Weaponizing and Deploying Exploits
 PossibleTargets for Browser Exploit
 Note: This exploit technique can be applied to any computing
device (e.g. in-car entertainment system) that uses a browser
Weaponizing and Deploying Exploits
 For convenience, we’ll target a laptop
Weaponizing & Deploying:TheVM Setup
Choose the target
 We’ll target IE 8 (because there is a nice metasploit package for it)
2) Develop or utilize an exploit delivery
mechanism
Weaponizing and Deploying Exploits(The Steps)
Exploit delivery mechanism
 Metasploit will be our exploit delivery mechanism
Exploit delivery mechanism
 Note the IE exploit ie_cbutton_uaf (link)
use-after-free IE
exploit module
3) Get in-between the victim and the network
Weaponizing and Deploying Exploits(The Steps)
Man-in-the-middle target device
 EvilTwin Attack (link)
 We’ll setup a rogue access point with the ssid attwifi
 Most smartphones have attwifi as an ssid that they will automatically
try to connect to it
 Hardware for EvilTwin Attack
 We’ll need a wifi adapter that supports master mode
 master mode enables adapter to function as an AP
 TheTP-Link WN722N supports master mode and other modes
that include monitor mode
TP-LINKTL-WN722N
Man-in-the-middle target device
Man-in-the-middle target device
 Software for EvilTwin Attack
 hostapd allows for a softwareAP to be created
 Tool supports features includingWPA
attwifi ssid
Man-in-the-middle target device
 Software for EvilTwin Attack
 hostapd allows for a softwareAP to be created
 Tool supports features includingWPA
Man-in-the-middle target device
Client Connected
4) Inject exploit code in the victim’s HTML
traffic
Weaponizing and Deploying Exploits(The Steps)
Inject Exploit Code
 4a : DNS injection  url “gooogle.com”  exploit server 10.0.0.1”
URL resolves to
10.0.0.1 for victim
Tool dnsmasq configured
to resolve url ‘google’ to ip
address 10.0.0.1
Inject Exploit Code
 4a : DNS injection  url “gooogle.com”  exploit server 10.0.0.1”
URL resolves to
10.0.0.1 for victim
Inject Exploit Code
 4b : Serve up a modifed gooogle.com webpage to victim
URL resolves to
10.0.0.1 for
victim
gooogle.com
Me
Inject Exploit Code
 4c :Configure metasploit
Metasploit server
configuration parameters
Inject Exploit Code
 4d : Start the exploit server
Inject Exploit Code
 4e :Victim visits gooogle.com
Inject Exploit Code
 4f : Metasploit server injects exploit code
Exploit uploaded to
victims browser
5) Implant malware (e.g. key logger,
screenscraper, etc..)
Weaponizing and Deploying Exploits(The Steps)
Implant Malware
 5a : Reverse shell malware implanted on victim
10z
Reverse shell payload
implanted
Implant Malware
 5b :Use shell to access victim data
Reverse shell payload
implanted
Victim file:
‘private_stuff_demo.txt’
Implant Malware
 5b :Use shell to access victim data
The ‘private’ data
Implant Malware
 5b :Use shell to access victim data
The ‘private’ data
Demo:Weaponizing and Deploying
References
1. Joshua J. Drake, et al. (2014). Android Hacker's Handbook. Wiley
Publishing.
2. Allen Harper, Shon Harris, Jonathan Ness, Chris Eagle, Gideon
Lenkey, and Terron Williams. (2015). Gray Hat Hacking the Ethical
Hackers Handbook (4th ed.). McGraw-Hill Osborne Media.
3. Robert Seacord. (2013). Secure Coding in C and C++. Addison-
Wesley Professional.
4. Ralf-Philipp Weinmann. 2012. Baseband attacks: Remote exploitation
of memory corruptions in cellular protocol stacks. In Proceedings of
the 6th USENIX conference on Offensive Technologies (WOOT'12).
USENIX Association, Berkeley, CA, USA, 2-2.
5. Kleidermacher, D. & Kleidermacher, M. (2012). Embedded Systems
Security: Practical Methods for Safe and Secure Software and
Systems Development
6. Gebotys, C.H. (2009). Security in Embedded Devices. Springer

More Related Content

PPTX
Diabetes Mellitus
PPTX
Hypertension
PPTX
Republic Act No. 11313 Safe Spaces Act (Bawal Bastos Law).pptx
PPTX
Power Point Presentation on Artificial Intelligence
PDF
Caça palavras - Bullying
PPTX
PDF
Atividade ortográfica - Caçada aos erros
Diabetes Mellitus
Hypertension
Republic Act No. 11313 Safe Spaces Act (Bawal Bastos Law).pptx
Power Point Presentation on Artificial Intelligence
Caça palavras - Bullying
Atividade ortográfica - Caçada aos erros

What's hot (20)

PDF
Automating Analysis and Exploitation of Embedded Device Firmware
PDF
Cyber_Attack_Forecasting_Jones_2015
PPT
B-Sides Seattle 2012 Offensive Defense
PDF
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
PPT
The Future of Automated Malware Generation
PDF
IoT Malware: Comprehensive Survey, Analysis Framework and Case Studies
PPTX
Man in the NFC by Haoqi Shan and Qing Yang
PDF
Automated In-memory Malware/Rootkit Detection via Binary Analysis and Machin...
PPTX
Using Static Binary Analysis To Find Vulnerabilities And Backdoors in Firmware
PDF
The Finest Penetration Testing Framework for Software-Defined Networks
PDF
From Thousands of Hours to a Couple of Minutes: Automating Exploit Generation...
PPTX
BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...
PDF
Why is it so hard to make secure chips?
PDF
Ethical Hacking &amp; Penetration Testing
PDF
Full-System Emulation Achieving Successful Automated Dynamic Analysis of Evas...
PDF
Cissp cbk final_exam-answers_v5.5
PPTX
Detecting Evasive Malware in Sandbox
PDF
AI & ML in Cyber Security - Why Algorithms are Dangerous
PPTX
Understand How Machine Learning Defends Against Zero-Day Threats
Automating Analysis and Exploitation of Embedded Device Firmware
Cyber_Attack_Forecasting_Jones_2015
B-Sides Seattle 2012 Offensive Defense
Over-the-Air: How we Remotely Compromised the Gateway, BCM, and Autopilot ECU...
The Future of Automated Malware Generation
IoT Malware: Comprehensive Survey, Analysis Framework and Case Studies
Man in the NFC by Haoqi Shan and Qing Yang
Automated In-memory Malware/Rootkit Detection via Binary Analysis and Machin...
Using Static Binary Analysis To Find Vulnerabilities And Backdoors in Firmware
The Finest Penetration Testing Framework for Software-Defined Networks
From Thousands of Hours to a Couple of Minutes: Automating Exploit Generation...
BlueHat v17 || KERNELFAULT: R00ting the Unexploitable using Hardware Fault In...
Why is it so hard to make secure chips?
Ethical Hacking &amp; Penetration Testing
Full-System Emulation Achieving Successful Automated Dynamic Analysis of Evas...
Cissp cbk final_exam-answers_v5.5
Detecting Evasive Malware in Sandbox
AI & ML in Cyber Security - Why Algorithms are Dangerous
Understand How Machine Learning Defends Against Zero-Day Threats

Viewers also liked (20)

PPTX
Upfront adoption & migration of applications to latest jdk
PPTX
VULNERABILITIES AND EXPLOITATION IN COMPUTER SYSTEM – PAST, PRESENT, AND FUTURE
PPTX
Software Security : From school to reality and back!
PDF
D1T3-Anto-Joseph-Droid-FF
PDF
The Python bites your apple
PPTX
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
PPTX
What the fuzz
PDF
[CB16] About the cyber grand challenge: the world’s first all-machine hacking...
PDF
Henrique Dantas - API fuzzing using Swagger
PDF
50 Shades of Fuzzing by Peter Hlavaty & Marco Grassi
PDF
Bug Hunting with Media Formats
PPTX
American Fuzzy Lop
PPTX
Discovering Vulnerabilities For Fun and Profit
ODP
The Nightmare Fuzzing Suite and Blind Code Coverage Fuzzer
PPTX
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
PDF
High Definition Fuzzing; Exploring HDMI vulnerabilities
PDF
Hacking Web Apps by Brent White
PPT
Beyond Automated Testing - RVAsec 2016
PDF
Rainbow Over the Windows: More Colors Than You Could Expect
PDF
Fuzzing underestimated method of finding hidden bugs
Upfront adoption & migration of applications to latest jdk
VULNERABILITIES AND EXPLOITATION IN COMPUTER SYSTEM – PAST, PRESENT, AND FUTURE
Software Security : From school to reality and back!
D1T3-Anto-Joseph-Droid-FF
The Python bites your apple
BSides LV 2016 - Beyond the tip of the iceberg - fuzzing binary protocols for...
What the fuzz
[CB16] About the cyber grand challenge: the world’s first all-machine hacking...
Henrique Dantas - API fuzzing using Swagger
50 Shades of Fuzzing by Peter Hlavaty & Marco Grassi
Bug Hunting with Media Formats
American Fuzzy Lop
Discovering Vulnerabilities For Fun and Profit
The Nightmare Fuzzing Suite and Blind Code Coverage Fuzzer
You didnt see it’s coming? "Dawn of hardened Windows Kernel"
High Definition Fuzzing; Exploring HDMI vulnerabilities
Hacking Web Apps by Brent White
Beyond Automated Testing - RVAsec 2016
Rainbow Over the Windows: More Colors Than You Could Expect
Fuzzing underestimated method of finding hidden bugs

Similar to SmartphoneHacking_Android_Exploitation (20)

PPTX
Security Best Practices
ODP
Break it while you make it: writing (more) secure software
PPTX
Introduction to penetration testing
PDF
Building Custom Android Malware BruCON 2013
PDF
Stuxnet redux. malware attribution & lessons learned
PPT
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
PPT
4.Security Assessment And Testing
PDF
HackInBo2k16 - Threat Intelligence and Malware Analysis
PDF
An Introduction to Secure Application Development
PPT
3.Secure Design Principles And Process
PDF
Finding the needle in the hardware haystack - HRES (1)
PDF
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
PPT
Op Sy 03 Ch 61
PPT
Chapter 09
PPS
Workshop on BackTrack live CD
PPT
Kunal - Introduction to backtrack - ClubHack2008
PPT
Kunal - Introduction to BackTrack - ClubHack2008
PDF
Exploring the Social Engineering Toolkit (Set) Using Backtrack 5R3
PDF
20100309 03 - Vulnerability analysis (McCabe)
PPTX
Timothy Wright & Stephen Halwes - Finding the Needle in the Hardware – Identi...
Security Best Practices
Break it while you make it: writing (more) secure software
Introduction to penetration testing
Building Custom Android Malware BruCON 2013
Stuxnet redux. malware attribution & lessons learned
The Anatomy of Java Vulnerabilities (Devoxx UK 2017)
4.Security Assessment And Testing
HackInBo2k16 - Threat Intelligence and Malware Analysis
An Introduction to Secure Application Development
3.Secure Design Principles And Process
Finding the needle in the hardware haystack - HRES (1)
2013 Toorcon San Diego Building Custom Android Malware for Penetration Testing
Op Sy 03 Ch 61
Chapter 09
Workshop on BackTrack live CD
Kunal - Introduction to backtrack - ClubHack2008
Kunal - Introduction to BackTrack - ClubHack2008
Exploring the Social Engineering Toolkit (Set) Using Backtrack 5R3
20100309 03 - Vulnerability analysis (McCabe)
Timothy Wright & Stephen Halwes - Finding the Needle in the Hardware – Identi...

Recently uploaded (20)

PPTX
assetexplorer- product-overview - presentation
PPTX
Weekly report ppt - harsh dattuprasad patel.pptx
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
Complete Guide to Website Development in Malaysia for SMEs
PPTX
CHAPTER 2 - PM Management and IT Context
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PDF
Website Design Services for Small Businesses.pdf
PDF
CapCut Video Editor 6.8.1 Crack for PC Latest Download (Fully Activated) 2025
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Odoo Companies in India – Driving Business Transformation.pdf
PDF
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
Cost to Outsource Software Development in 2025
PDF
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
assetexplorer- product-overview - presentation
Weekly report ppt - harsh dattuprasad patel.pptx
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
17 Powerful Integrations Your Next-Gen MLM Software Needs
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
Complete Guide to Website Development in Malaysia for SMEs
CHAPTER 2 - PM Management and IT Context
Design an Analysis of Algorithms II-SECS-1021-03
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
Website Design Services for Small Businesses.pdf
CapCut Video Editor 6.8.1 Crack for PC Latest Download (Fully Activated) 2025
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
Operating system designcfffgfgggggggvggggggggg
Odoo Companies in India – Driving Business Transformation.pdf
CCleaner Pro 6.38.11537 Crack Final Latest Version 2025
Patient Appointment Booking in Odoo with online payment
Cost to Outsource Software Development in 2025
iTop VPN 6.5.0 Crack + License Key 2025 (Premium Version)
WiFi Honeypot Detecscfddssdffsedfseztor.pptx

SmartphoneHacking_Android_Exploitation

  • 1. Smartphone Hacking TheArt ofAndroid Exploitation By: Malachi Jones, PhD
  • 2. About Me  Education  Bachelors Degree: Computer Engineering (Univ. of Florida, 2007)  Master’s Degree: Computer Engineering (GeorgiaTech, 2009)  PhD: Computer Engineering (GeorgiaTech, 2013)  Cyber Security Experience  Harris: Cyber Software Engineer (2013-2014)  Harris: Vulnerability Researcher (2015)  BoozAllen DarkLabs : Embedded Security Researcher (2016- Present) https://www.linkedin.com/in/malachijonesphd
  • 3. About Dark Labs BoozAllen Dark Labs is an elite team of security researchers, penetration testers, reverse engineers, network analysts, and data scientists, dedicated to stopping cyber attacks before they occur.1 (1 http://darklabs.bah.com)
  • 4. 2015: AYear of Embedded Exploitation (Link)
  • 5. (Link) 2015: AYear of Embedded Exploitation
  • 6. (Link) 2015: AYear of Embedded Exploitation
  • 8. Outline  Motivation: Understanding both sides (offense & defense)  Objectives ofTalk  Review  Secure Coding  Vulnerability Research (VR)  Vulnerability Discovery on Android  Weaponizing & Deploying Exploits  Demo/Conclusion
  • 9. Motivation: Understanding Offense & Defense  DefensiveCyber Awareness  Understanding and implementation of current best practices (e.g. secure coding) to build a hardened security system  Successfully making tradeoffs between security, performance, and cost to develop a system that is useful, secure, and affordable
  • 10. Motivation: Understanding Offense & Defense  Offensive Cyber Awareness  Forefront of new attacks & techniques  Can help defenders develop mitigation techniques before a new attack can cause significant damage  Ability to think like the adversary to find and patch potential vulnerabilities before they do
  • 11. Objectives ofTalk  Discuss techniques (borrowed from hackers) that can allow the defender to find and patch vulnerabilities before a hacker does  Demonstrate how effortless it can be to weaponize a vulnerability to p0wn devices.
  • 12. Android Hacker’s Handbook  This presentation is based on material from the Handbook  Joshua Drake is the lead author and also the person who discovered the Android vulnerability dubbed StageFright  Handbook provides a lot more in-depth coverage onAndroid Hacking than we can cover in this presentation
  • 14. Review: Secure Coding  Low level code (e.g. drivers and kernels) of embedded devices such as smartphones are written in C/C++  The genius/curse of C/C++  Trust the programmer  Don’t prevent the programming from doing what needs to be done  Make it fast, even if it is not guaranteed to be portable  How does this translate to security and safety? It doesn’t…..
  • 15. Review: Secure Coding  Best practices for secure C/C++ coding written by Robert C. Seacord (CERT @ CMU)  Based on common mistakes that inexperienced and professional software developers make  Should be a mandatory reading for any aspiring C/C++ programmer
  • 16. Review: Secure Coding  Question: So, how can bugs still manifest even if best practices such as secure coding principles are adhered to?  Answer:An attacker can exploit bugs in the interactions (external and/or internal) of components in hardware and/or software systems  Case Study: Hot Potato Exploit (link)  Affects allWindows versions includingWindows 7 & 8  Exploits bugs in the interaction with legacy software components that include NetBIOS Name Service (NBNS)  Can enable remote code execution by an attacker
  • 18. Review:Vulnerability Research  Primary objective of Vulnerability Research (VR) is to find exploitable bugs (not all bugs are exploitable)  Often, a proof of concept (PoC) is desirable that demonstrates the extent to which the vulnerability can be weaponized in a reliable way to p0wn devices.
  • 19. Review:Vulnerability Research  Complications (in the exploitation of bug)  AddressSpace Layout Randomization (ASLR) : Randomizes base address of modules; difficult for attacker to know where to direct cpu to execute code  Data Execution Prevention (DEP) : Makes non-code memory regions not executable; no shell code execution  Reliability:The vulnerability may be difficult to consistently reproduce; vulnerability may require the system to be in an unlikely state for exploitation
  • 20. Review:Vulnerability Research  VR Process Overview  ProfilingTarget: Information gathering which includes port scanning and preliminary reviews of device services and security features (e.g. ASLR and SELinux)  InitialAccess: Preferably obtaining access to a shell or a debug serial port on a test device that is similar to target device  Vulnerability Discovery: Activities include static analysis, dynamic analysis, and fuzzing to discover an exploitable bug  Exploitation/Weaponization: Development of a proof-of-concept that demonstrates the exploit capabilities of bug.
  • 21. Review:Vulnerability Research  VR Process Overview  ProfilingTarget: Information gathering which includes port scanning and preliminary reviews of device services and security features (e.g. ASLR and SELinux)  InitialAccess: Preferably obtaining access to a shell or a debug serial port on a test device that is similar to target device  Vulnerability Discovery: Activities include static analysis, dynamic analysis, and fuzzing to discover an exploitable bug  Exploitation/Weaponization: Development of a proof-of-concept that demonstrates the exploit capabilities of bug. Presentation Focus
  • 22. Review:Vulnerability Research  Vulnerability Discovery  Static Analysis: Analyzing code and data in the application without directly executing the application; may require converting the binary from machine code to C-like code, aka decompiling.  DynamicAnalysis: Executing the application in an instrumented or monitored manner to garner more concrete information on behavior  Fuzzing: Dynamic method for testing software input validation by feeding it intentionally malformed input
  • 23. v bool validatePassword(char * usercredential, int password_len, int username_len) { char username[100]; char password[100]; //Get username memcpy(username, usercredential,username_len); char *p_password = usercredential+ username_len +1; //Get password memcpy(password, p_password,password_len); ………………………………………………………………………………………… } No check to make sure that the password length does not exceed the local buffer size of ‘100’ Password buffer has length of 100 Review:Vulnerability Research  Static Analysis  In the above example, there is a stack overflow vulnerability  By passing in a ‘password’ with a length greater than 100, possible to overflow buffer, which can allow for control of code execution
  • 24. Review:Vulnerability Research  Static Analysis  If the source is unavailable, then it may be necessary to decompile the binary into psuedo code  Tools such as IDA PRO can be used to aid in reversing Decompiled “Pseudo-C”ARM Dissassembly
  • 25. Review:Vulnerability Research  Dynamic Analysis  Can be used to step through the code to understand behavior  Variables and software state can be manipulated
  • 26. Review:Vulnerability Research  Fuzzing  A primary objective is to generate malformed input that will induce unexpected behavior in software that can include a crash  Additional static/dynamic analysis can then be used to determine root cause and whether or not the bug is exploitable Software Component Input Output Typical Scenario Fuzzing Scenario Software Component Output Fuzzer (Malformed Input) Input Crash
  • 27. Review:Vulnerability Research  Exploitation/Weaponization  RemoteAccess: Setting up a backdoor on the victim that allows for future command and control capabilities  Phoning home state of victim: Periodically updating the host about the current activities and state of victim  Persistence: Includes surviving a reboot of victim and attempts to remove installed ‘custom’ software
  • 28. Review:Vulnerability Research  Weaponization: Case Study of Regin (link)  Remote Access: Cyberattack platform that is deployed on victim networks for total remote control of host at all levels  Phoning Home State ofVictim: Forms a peer-to-peer network with other infected machines to send information back to the command and control center  Persistence: Covertly installs kernel modules and drivers 28
  • 29. Review:Vulnerability Research  Question: Are Hackers the only ones that conduct vulnerability research? If not, why would others do this type of research?  Answer:  The motivation behind this presentation is that the defenders should also be usingVR techniques to identify exploitable bugs.  Some companies have bug bounty hunting programs, where a white/grey hat identifies a bug in exchange for money  Others hireVR personnel onsite to hack into their own stuff. Example: Charlie Miller and ChrisValasek were hired by Uber after their Chrysler car hack demo (link).
  • 31. Vulnerability Discovery on Android  Important Note: Although concepts and techniques discussed in this section are targeted at the Android platform, they are also relevant for other platforms including iOS, Linux, andWindows.
  • 32. Vulnerability Discovery on Android Overall Goal: Exercise code on the target with malformed inputs that we generate
  • 33. Vulnerability Discovery on Android  Steps for Exploit Discovery using FuzzTesting 1. Choose a software target 2. Generate Inputs 3. Delivering & Processing Inputs 4. Monitor for crashes
  • 34. Vulnerability Discovery on Android (The Steps) 1) Choose a SoftwareTarget
  • 35. Vulnerability Discovery: Choosing aTarget  Objective 1.1: Find a software attack surface whose code can be exercised remotely by an adversary
  • 36. Vulnerability Discovery: Choosing aTarget  We’ll target the Android browser  Why?  Standard on all Android devices  Since web browsers focus on performance, much of the code is implemented in C/C++  Very complex with support for new technologies that include HTML5, and the browser is essentially a mini OS
  • 37. Vulnerability Discovery: Choosing aTarget  Objective 1.2: Select a web technology that the browser implements to focus on  Note: One of the most challenging aspects of fuzzing is to determining where to focus the fuzzing efforts
  • 38. Vulnerability Discovery: Choosing aTarget  We’ll focus on the Typed Array feature of HTML5  Why HTML5  Relatively new technologies, which means there are bound to be undiscovered bugs  Has a rich feature set that includes support for video and audio, which means high complexity;complexity often introduces bugs
  • 39. Vulnerability Discovery: Choosing aTarget  Background: Typed Arrays  Allows web developers access to a region of memory that is formatted as a native array  ExampleSnippet:  Snippet Explained : Creates an array of 16 elements and initializes them from 0 to 15 var arr = new Uint8Array(16); for (var n = 0; n < arr.length; n++) { arr[n] = n }
  • 40. Vulnerability Discovery: Choosing aTarget  Key Concepts:  The typed array is a native array, which means that it doesn’t need to be translated between JavaScript and native representation  Translating back and forth between JavaScript and native representation impacts performance  Browser can achieve greater performance through improved efficiency using this type of array var arr = new Uint8Array(16); for (var n = 0; n < arr.length; n++) { arr[n] = n }
  • 41. Vulnerability Discovery: Choosing aTarget  Previously disclosed bugs inTyped Array :  Researcher Pinkie Pie compromises of Chrome @ 2013 Mobile pwn2Own (link)  Researcher geohot compromises Chrome @ 2014 pwn2Own (link) var arr = new Uint8Array(16); for (var n = 0; n < arr.length; n++) { arr[n] = n }
  • 42. 2) Generating Inputs Vulnerability Discovery on Android (The Steps)
  • 43. Vulnerability Discovery: Generate Inputs  So now that we have our target, we’d like to generate inputs to see how the target handles it  Below is an example snippet that would generate different ‘types’ of Typed Arrays  Note: Generating ‘good’ inputs is not trivial. It requires an understanding of the target and the possible unaddressed corner cases and boundary conditions def generate_var(): vtype = random.choice(TYPEDARRAY_TYPES) vlen = rand_num() return “var array1 = new %s(%d);” % (vtype, vlen)
  • 44. Vulnerability Discovery on Android (The Steps) 3) Delivering & Processing Inputs
  • 45. Vulnerability Discovery: Delivering Inputs  Delivering Inputs  What we’d like is a way to get the inputs to the target and have the target execute it  Tools such as BrowserFuzz have lightweight http servers that can serve up the input to the target  Processing Input  Getting chrome to process our special URL (that points to our fuzz html server) can be automated  We can take advantage of the ActivityManager to start the browser and tell it where to load content from via Intents
  • 46. 4) Monitoring for Crashes Vulnerability Discovery on Android (The Steps)
  • 47. Vulnerability Discovery: Monitoring for Crashes  Key Concept: Monitoring the behavior of the target program is essential to knowing whether you’ve discovered something that is noteworthy  When a process on android crashes, debuggerd writes information about the crash to the system log  So we can monitor when the browser crashes by checking the system log.
  • 49. Weaponizing and Deploying Exploits  So we’ve found an exploit… How do we make it useful?
  • 50. Weaponizing and Deploying Exploits  The Steps (Browser exploit) 1. Choose the target 2. Develop or utilize an exploit delivery mechanism (e.g. Metasploit) 3. Get in-between the victim and the network 4. Inject exploit code in the victim’s HTML traffic 5. Implant malware (e.g. key logger, screenscraper, etc..)
  • 51. Weaponizing and Deploying Exploits(The Steps) 1) Choose the target
  • 52. Weaponizing and Deploying Exploits  PossibleTargets for Browser Exploit  Note: This exploit technique can be applied to any computing device (e.g. in-car entertainment system) that uses a browser
  • 53. Weaponizing and Deploying Exploits  For convenience, we’ll target a laptop
  • 55. Choose the target  We’ll target IE 8 (because there is a nice metasploit package for it)
  • 56. 2) Develop or utilize an exploit delivery mechanism Weaponizing and Deploying Exploits(The Steps)
  • 57. Exploit delivery mechanism  Metasploit will be our exploit delivery mechanism
  • 58. Exploit delivery mechanism  Note the IE exploit ie_cbutton_uaf (link) use-after-free IE exploit module
  • 59. 3) Get in-between the victim and the network Weaponizing and Deploying Exploits(The Steps)
  • 60. Man-in-the-middle target device  EvilTwin Attack (link)  We’ll setup a rogue access point with the ssid attwifi  Most smartphones have attwifi as an ssid that they will automatically try to connect to it
  • 61.  Hardware for EvilTwin Attack  We’ll need a wifi adapter that supports master mode  master mode enables adapter to function as an AP  TheTP-Link WN722N supports master mode and other modes that include monitor mode TP-LINKTL-WN722N Man-in-the-middle target device
  • 62. Man-in-the-middle target device  Software for EvilTwin Attack  hostapd allows for a softwareAP to be created  Tool supports features includingWPA attwifi ssid
  • 63. Man-in-the-middle target device  Software for EvilTwin Attack  hostapd allows for a softwareAP to be created  Tool supports features includingWPA
  • 65. 4) Inject exploit code in the victim’s HTML traffic Weaponizing and Deploying Exploits(The Steps)
  • 66. Inject Exploit Code  4a : DNS injection  url “gooogle.com”  exploit server 10.0.0.1” URL resolves to 10.0.0.1 for victim Tool dnsmasq configured to resolve url ‘google’ to ip address 10.0.0.1
  • 67. Inject Exploit Code  4a : DNS injection  url “gooogle.com”  exploit server 10.0.0.1” URL resolves to 10.0.0.1 for victim
  • 68. Inject Exploit Code  4b : Serve up a modifed gooogle.com webpage to victim URL resolves to 10.0.0.1 for victim gooogle.com Me
  • 69. Inject Exploit Code  4c :Configure metasploit Metasploit server configuration parameters
  • 70. Inject Exploit Code  4d : Start the exploit server
  • 71. Inject Exploit Code  4e :Victim visits gooogle.com
  • 72. Inject Exploit Code  4f : Metasploit server injects exploit code Exploit uploaded to victims browser
  • 73. 5) Implant malware (e.g. key logger, screenscraper, etc..) Weaponizing and Deploying Exploits(The Steps)
  • 74. Implant Malware  5a : Reverse shell malware implanted on victim 10z Reverse shell payload implanted
  • 75. Implant Malware  5b :Use shell to access victim data Reverse shell payload implanted Victim file: ‘private_stuff_demo.txt’
  • 76. Implant Malware  5b :Use shell to access victim data The ‘private’ data
  • 77. Implant Malware  5b :Use shell to access victim data The ‘private’ data
  • 79. References 1. Joshua J. Drake, et al. (2014). Android Hacker's Handbook. Wiley Publishing. 2. Allen Harper, Shon Harris, Jonathan Ness, Chris Eagle, Gideon Lenkey, and Terron Williams. (2015). Gray Hat Hacking the Ethical Hackers Handbook (4th ed.). McGraw-Hill Osborne Media. 3. Robert Seacord. (2013). Secure Coding in C and C++. Addison- Wesley Professional. 4. Ralf-Philipp Weinmann. 2012. Baseband attacks: Remote exploitation of memory corruptions in cellular protocol stacks. In Proceedings of the 6th USENIX conference on Offensive Technologies (WOOT'12). USENIX Association, Berkeley, CA, USA, 2-2. 5. Kleidermacher, D. & Kleidermacher, M. (2012). Embedded Systems Security: Practical Methods for Safe and Secure Software and Systems Development 6. Gebotys, C.H. (2009). Security in Embedded Devices. Springer