SlideShare a Scribd company logo
ANDROID SECURITY
& PENETRATION TESTING
Subho Halder
@sunnyrockzzs #AFE
Monday, 23 September 13
./AboutMe.sh
Information Security Researcher
Trainer at BlackHat, OWASP AppSec, ToorCon, SysCan.
Lead Developer of AFE (Android Framework for Exploitation)
Python Lovers
Co-founder of XYSEC (http://xysec.com)
Have found bug in some famous websites including Google, Apple, Microsoft,
Skype, Adobe and many more
Monday, 23 September 13
Some Companies I have found Vulnerabilities in .....
And many more...
Monday, 23 September 13
./Agenda
Quick Introduction to Android Internals
Android Security Model
Android Coding Best Practices
Android Malware, Technique, Effectiveness using AFE (Android Framework for
Exploitation)
Small Social Experiment !
Monday, 23 September 13
Android Internals.exe
Based on Linux kernel version 3.x (version 2.6 prior to Android 4.0 ICS)
Application runs through Dalvik VM (Dalvik Virtual Machine)
Dalvik VM runs executable files like dex (Dalvik executable) or apk files
apk files are zipped content of Resources, Signatures, classes.dex and
AndroidManifest.xml file
Monday, 23 September 13
Android Security Model.txt
Application are sandboxed (Runs with different UID and GID)
Zygote spawns a new process for each Application
Each Application runs with a separate instance of Dalvik VM
Special Permissions are provided to access Hardware API’s
Permissions are mentioned in AndroidManifest.xml file.
Monday, 23 September 13
Android Application.apk
Just an Archive !
Written mainly in Java and XML
Multiple Entry-points, such as Activity, Services,
Intents, Content Providers, etc.
Monday, 23 September 13
AndroidManifest.xml
Monday, 23 September 13
CAN THESE PERMISSION BE BYPASSED?
Monday, 23 September 13
Uploading a sensitive file from SD-Card to
Remote Server without any Permission!
Read Files from
SD-Card
Uploads File to
Remote Server
Upload a file through
Browser
Permission not
Required for
READING files from
SD Card
Opening Browser
through INTENT
doesn’t requires
Permission
Intent(Intent.ACTION_VIEW, Uri.parse("http://google.com/"));
Save theValue in the
GET parameter to a
file in Server
Monday, 23 September 13
QUICK-DEMO ( SHOULD I ) ?
Monday, 23 September 13
Android Coding Best Practices
Follow -> http://developer.android.com/guide/practices/index.html
Top 10 Mobile Risks (Outdated) -> https://www.owasp.org/index.php/
Projects/OWASP_Mobile_Security_Project_-_Top_Ten_Mobile_Risks
Attend more GDG Talks and other Security Conferences
Shoot me a tweet @sunnyrockzzs
Monday, 23 September 13
AndroidManifest.xml OMG !
Activities, Services, Receivers should not be exported or else you
can bypass those activities !
Monday, 23 September 13
AndroidManifest.xml OMG ! (Contd.)
android:exported= “True” in <provider> will turn into a nightmare !
BTW by default it is “True” if either android:minSdkVersion or
android:targetSdkVersion to “16” or lower. For applications that set either of
these attributes to “17” or higher, the default is “false”.
Monday, 23 September 13
AndroidManifest.xml OMG ! (Contd.)AndroidManifest.xml OMG ! (Contd.)
AndroidManifest.xml OMG ! (Contd.)
AndroidManifest.xml OMG ! (Contd.)
AndroidManifest.xml OMG ! (Contd.)AndroidManifest.xml OMG ! (Contd.)
AndroidManifest.xml OMG ! (Contd.)
AndroidManifest.xml OMG ! (Contd.)Monday, 23 September 13
ANDROID MALWARE
Monday, 23 September 13
Android Malware (Common Features)
Send SMS to premium Number
Subscribe to premium Services
Dial Premium number
Steal messages, contact list, logs
Steal SD-Card files
Auto-respond to attackers’s text messages !
Monday, 23 September 13
Creating a Malware.vbs
Use CONTENT PROVIDERS
Make use of CURSORS & SQLITE databases
Write JAVA codes like crazy
Set up Server component
Get frustrated, start from bullet-point one.
Monday, 23 September 13
If you don’t have past relationship with JAVA
Monday, 23 September 13
Android Framework for Exploitation
Monday, 23 September 13
Let’s Create a Malware !
Monday, 23 September 13
What about GOOGLE?
Presenting GOOGLE Bouncer !
Monday, 23 September 13
“I am not Afraid” - Eminem
Monday, 23 September 13
Faking Legitimate Application?
Malware services generally injected in legitimate applications
How to do it?
legitimate	 apk Smali/Java
Add	 malicious	 
services/classes
RecompileFinal	 malware
Monday, 23 September 13
USE AFE TO AUTOMATE !!
Monday, 23 September 13
Android Framework for Exploitation.py
To make your life easier !
Find security vulnerabilities in your device+apps
Protect your device against malwares
Create automated malwares/botnets + send the data to a python listener
Inject malicious services in another applications
Use Android Exploits Crypt existing malwares to make them FUD
Monday, 23 September 13
AFE Perspective.c
Offensive Defensive
Malware Creation
BotNet Automation
Crypting
Injecting
Content Query
App Assesment
Fuzzing
Kernel Assesment
Monday, 23 September 13
AFE Internals.py
Python
Based
Plugin Based
Architecure
Modules Libraries
Monday, 23 September 13
Let’s Make it FUD
Matches the signature with its
database
Checks the activity, service and
other class names
checks the names of the variables
Checks the control flow graph
Monday, 23 September 13
Let’s Make it FUD
Matches the signature with its
database
Checks the activity, service and
other class names
checks the names of the variables
Checks the control flow graph
Rebuild + Zipalign
Monday, 23 September 13
Let’s Make it FUD
Matches the signature with its
database
Checks the activity, service and
other class names
checks the names of the variables
Checks the control flow graph
Modifies the classnames and all its
references within files
Example: Converts com.example.org to com.omg.lol
Monday, 23 September 13
Let’s Make it FUD
Matches the signature with its
database
Checks the activity, service and
other class names
checks the names of the variables
Checks the control flow graph
Split variables into two, and
append at runtime
Example:
String a = “hello”
Will now become
String aa = “hel”
String ab = “lo”
String a = aa + ab
Monday, 23 September 13
Let’s Make it FUD
Matches the signature with its
database
Checks the activity, service and
other class names
checks the names of the variables
Checks the control flow graph
Add dummy loops to change
CFG
Example:
goto end;
start: //everything in this label will execute, only when it is called
........
end: //everything in this label will execute, only when it is called
goto start;
Monday, 23 September 13
Statistics? ? ? ? ? ? ?.xls
Earlier Detection: 30/46
Monday, 23 September 13
Statistics? ? ? ? ? ? ?.xls
Detection after Crypting: 4/46
Monday, 23 September 13
OOPS CRYPTING MODULE IS NOT
PUBLIC :)
Monday, 23 September 13
./Conclusion -h
Be safe
Don’t download apps from 3rd party markets
Turn USB debugging OFF
Anti-virus vendors -> Switch to dynamic analysis Focus on BYOD security
We also conduct trainings on Advanced Mobile Hands-on Security/Exploitation
for both Android and iOS
Monday, 23 September 13
HEY WAIT!! WHERE IS THE
SOCIAL EXPERIMENT ?
Monday, 23 September 13
./QUESTIONS
subho.halder@gmail.com
security@xysec.com
http://xysec.com
@sunnyrockzzs
Monday, 23 September 13
STILL CURIOUS ??
MEET ME NOW !!!
Monday, 23 September 13

More Related Content

PPTX
Android Application Penetration Testing - Mohammed Adam
PPTX
Pentesting Android Apps
PDF
Android Security
PPTX
Android pentesting
PDF
Android Hacking
PPTX
Pentesting Android Applications
PDF
Security Testing Mobile Applications
PPTX
Android security
Android Application Penetration Testing - Mohammed Adam
Pentesting Android Apps
Android Security
Android pentesting
Android Hacking
Pentesting Android Applications
Security Testing Mobile Applications
Android security

What's hot (20)

PDF
Mobile Application Penetration Testing
PDF
A Hacker's perspective on AEM applications security
PPTX
Understanding android security model
PPTX
Mobile security
PDF
Red Team Methodology - A Naked Look
PPTX
iOS-Application-Security-iAmPr3m
PPTX
PDF
Android application security testing
PDF
Embedded Android : System Development - Part IV (Android System Services)
PDF
Android pentesting
PPTX
Android security
PPTX
Android Security
PPT
Hacking web applications
PDF
Api security-testing
PPTX
Secure coding practices
PPTX
Flutter Intro
PDF
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
PDF
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...
PPTX
Practical Malware Analysis: Ch 0: Malware Analysis Primer & 1: Basic Static T...
PPTX
Finalppt metasploit
Mobile Application Penetration Testing
A Hacker's perspective on AEM applications security
Understanding android security model
Mobile security
Red Team Methodology - A Naked Look
iOS-Application-Security-iAmPr3m
Android application security testing
Embedded Android : System Development - Part IV (Android System Services)
Android pentesting
Android security
Android Security
Hacking web applications
Api security-testing
Secure coding practices
Flutter Intro
How to steal and modify data using Business Logic flaws - Insecure Direct Obj...
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...
Practical Malware Analysis: Ch 0: Malware Analysis Primer & 1: Basic Static T...
Finalppt metasploit
Ad

Viewers also liked (20)

PPTX
Android pen test basics
PDF
My Null Android Penetration Session
PPT
PPTX
[Wroclaw #1] Android Security Workshop
PDF
Deep Dive Into Android Security
PDF
Brief Tour about Android Security
PPTX
Android ppt
PPTX
Presentation on Android operating system
PPTX
Android Application Security Awareness Talk, OWASP MEETUP Q3, 2015
PDF
Sperasoft talks: Android Security Threats
PDF
Security testing in mobile applications
PPTX
Information Security and Privacy
PPTX
Untitled 1
PDF
Art of Thinking [Re-write]
PDF
Axoss Wireless Penetration Testing Services
PDF
Firebase analytics for_android _ i_os
PDF
Security in Android Application, Александр Смирнов, RedMadRobot, Москва
PPT
Data Storage In Android
PDF
Introduction to iOS Penetration Testing
PPTX
Android pen test basics
My Null Android Penetration Session
[Wroclaw #1] Android Security Workshop
Deep Dive Into Android Security
Brief Tour about Android Security
Android ppt
Presentation on Android operating system
Android Application Security Awareness Talk, OWASP MEETUP Q3, 2015
Sperasoft talks: Android Security Threats
Security testing in mobile applications
Information Security and Privacy
Untitled 1
Art of Thinking [Re-write]
Axoss Wireless Penetration Testing Services
Firebase analytics for_android _ i_os
Security in Android Application, Александр Смирнов, RedMadRobot, Москва
Data Storage In Android
Introduction to iOS Penetration Testing
Ad

Similar to Android Security & Penetration Testing (20)

PDF
Hacking your Android (slides)
PPT
Bypassing the Android Permission Model
PDF
DEF CON 24 - Dinesh and Shetty - practical android application exploitation
PPTX
Advanced malware analysis training session8 introduction to android
PDF
Hacking your Droid (Aditya Gupta)
PPTX
Hacker Halted 2014 - Reverse Engineering the Android OS
PPTX
Advanced Malware Analysis Training Session 8 - Introduction to Android
PPTX
Android security by ravi-rai
PDF
Stealing sensitive data from android phones the hacker way
PDF
Securing Android
PPTX
Getting started with android
PDF
9 Writing Secure Android Applications
PDF
Introduction to Android Development and Security
PDF
Overtaking Firefox Profiles: Vulnerabilities in Firefox for Android
PDF
Multiple Vulnerabilities in Mozilla Firefox for Android
PDF
Android Security - Common Security Pitfalls in Android Applications
PDF
ToorCon 14 : Malandroid : The Crux of Android Infections
PDF
Droidcon it-2014-marco-grassi-viaforensics
PDF
Android "Fight Club" : In pursuit of APPiness -- null Humla Delhi Chapter
PDF
Android security and penetration testing | DIVA | Yogesh Ojha
Hacking your Android (slides)
Bypassing the Android Permission Model
DEF CON 24 - Dinesh and Shetty - practical android application exploitation
Advanced malware analysis training session8 introduction to android
Hacking your Droid (Aditya Gupta)
Hacker Halted 2014 - Reverse Engineering the Android OS
Advanced Malware Analysis Training Session 8 - Introduction to Android
Android security by ravi-rai
Stealing sensitive data from android phones the hacker way
Securing Android
Getting started with android
9 Writing Secure Android Applications
Introduction to Android Development and Security
Overtaking Firefox Profiles: Vulnerabilities in Firefox for Android
Multiple Vulnerabilities in Mozilla Firefox for Android
Android Security - Common Security Pitfalls in Android Applications
ToorCon 14 : Malandroid : The Crux of Android Infections
Droidcon it-2014-marco-grassi-viaforensics
Android "Fight Club" : In pursuit of APPiness -- null Humla Delhi Chapter
Android security and penetration testing | DIVA | Yogesh Ojha

More from Subho Halder (6)

PDF
Unicom Conference - Mobile Application Security
PDF
Outsmarting Hackers before your App gets Hacked - iOS Conf SG 2016
PDF
Securing Mobile Apps - Appfest Version
PDF
Security, Privacy & Convenience – key drivers for mobile adoption from a cons...
PDF
Android App (Vulner)ability - Teaser
PDF
iOS (Vulner)ability
Unicom Conference - Mobile Application Security
Outsmarting Hackers before your App gets Hacked - iOS Conf SG 2016
Securing Mobile Apps - Appfest Version
Security, Privacy & Convenience – key drivers for mobile adoption from a cons...
Android App (Vulner)ability - Teaser
iOS (Vulner)ability

Recently uploaded (20)

PDF
Review of recent advances in non-invasive hemoglobin estimation
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
cuic standard and advanced reporting.pdf
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Network Security Unit 5.pdf for BCA BBA.
PPTX
A Presentation on Artificial Intelligence
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
NewMind AI Monthly Chronicles - July 2025
PDF
Empathic Computing: Creating Shared Understanding
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
Big Data Technologies - Introduction.pptx
PDF
Approach and Philosophy of On baking technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Review of recent advances in non-invasive hemoglobin estimation
20250228 LYD VKU AI Blended-Learning.pptx
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
NewMind AI Weekly Chronicles - August'25 Week I
cuic standard and advanced reporting.pdf
Chapter 3 Spatial Domain Image Processing.pdf
Network Security Unit 5.pdf for BCA BBA.
A Presentation on Artificial Intelligence
Diabetes mellitus diagnosis method based random forest with bat algorithm
Understanding_Digital_Forensics_Presentation.pptx
NewMind AI Monthly Chronicles - July 2025
Empathic Computing: Creating Shared Understanding
Building Integrated photovoltaic BIPV_UPV.pdf
Unlocking AI with Model Context Protocol (MCP)
Advanced methodologies resolving dimensionality complications for autism neur...
Big Data Technologies - Introduction.pptx
Approach and Philosophy of On baking technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...

Android Security & Penetration Testing

  • 1. ANDROID SECURITY & PENETRATION TESTING Subho Halder @sunnyrockzzs #AFE Monday, 23 September 13
  • 2. ./AboutMe.sh Information Security Researcher Trainer at BlackHat, OWASP AppSec, ToorCon, SysCan. Lead Developer of AFE (Android Framework for Exploitation) Python Lovers Co-founder of XYSEC (http://xysec.com) Have found bug in some famous websites including Google, Apple, Microsoft, Skype, Adobe and many more Monday, 23 September 13
  • 3. Some Companies I have found Vulnerabilities in ..... And many more... Monday, 23 September 13
  • 4. ./Agenda Quick Introduction to Android Internals Android Security Model Android Coding Best Practices Android Malware, Technique, Effectiveness using AFE (Android Framework for Exploitation) Small Social Experiment ! Monday, 23 September 13
  • 5. Android Internals.exe Based on Linux kernel version 3.x (version 2.6 prior to Android 4.0 ICS) Application runs through Dalvik VM (Dalvik Virtual Machine) Dalvik VM runs executable files like dex (Dalvik executable) or apk files apk files are zipped content of Resources, Signatures, classes.dex and AndroidManifest.xml file Monday, 23 September 13
  • 6. Android Security Model.txt Application are sandboxed (Runs with different UID and GID) Zygote spawns a new process for each Application Each Application runs with a separate instance of Dalvik VM Special Permissions are provided to access Hardware API’s Permissions are mentioned in AndroidManifest.xml file. Monday, 23 September 13
  • 7. Android Application.apk Just an Archive ! Written mainly in Java and XML Multiple Entry-points, such as Activity, Services, Intents, Content Providers, etc. Monday, 23 September 13
  • 9. CAN THESE PERMISSION BE BYPASSED? Monday, 23 September 13
  • 10. Uploading a sensitive file from SD-Card to Remote Server without any Permission! Read Files from SD-Card Uploads File to Remote Server Upload a file through Browser Permission not Required for READING files from SD Card Opening Browser through INTENT doesn’t requires Permission Intent(Intent.ACTION_VIEW, Uri.parse("http://google.com/")); Save theValue in the GET parameter to a file in Server Monday, 23 September 13
  • 11. QUICK-DEMO ( SHOULD I ) ? Monday, 23 September 13
  • 12. Android Coding Best Practices Follow -> http://developer.android.com/guide/practices/index.html Top 10 Mobile Risks (Outdated) -> https://www.owasp.org/index.php/ Projects/OWASP_Mobile_Security_Project_-_Top_Ten_Mobile_Risks Attend more GDG Talks and other Security Conferences Shoot me a tweet @sunnyrockzzs Monday, 23 September 13
  • 13. AndroidManifest.xml OMG ! Activities, Services, Receivers should not be exported or else you can bypass those activities ! Monday, 23 September 13
  • 14. AndroidManifest.xml OMG ! (Contd.) android:exported= “True” in <provider> will turn into a nightmare ! BTW by default it is “True” if either android:minSdkVersion or android:targetSdkVersion to “16” or lower. For applications that set either of these attributes to “17” or higher, the default is “false”. Monday, 23 September 13
  • 15. AndroidManifest.xml OMG ! (Contd.)AndroidManifest.xml OMG ! (Contd.) AndroidManifest.xml OMG ! (Contd.) AndroidManifest.xml OMG ! (Contd.) AndroidManifest.xml OMG ! (Contd.)AndroidManifest.xml OMG ! (Contd.) AndroidManifest.xml OMG ! (Contd.) AndroidManifest.xml OMG ! (Contd.)Monday, 23 September 13
  • 17. Android Malware (Common Features) Send SMS to premium Number Subscribe to premium Services Dial Premium number Steal messages, contact list, logs Steal SD-Card files Auto-respond to attackers’s text messages ! Monday, 23 September 13
  • 18. Creating a Malware.vbs Use CONTENT PROVIDERS Make use of CURSORS & SQLITE databases Write JAVA codes like crazy Set up Server component Get frustrated, start from bullet-point one. Monday, 23 September 13
  • 19. If you don’t have past relationship with JAVA Monday, 23 September 13
  • 20. Android Framework for Exploitation Monday, 23 September 13
  • 21. Let’s Create a Malware ! Monday, 23 September 13
  • 22. What about GOOGLE? Presenting GOOGLE Bouncer ! Monday, 23 September 13
  • 23. “I am not Afraid” - Eminem Monday, 23 September 13
  • 24. Faking Legitimate Application? Malware services generally injected in legitimate applications How to do it? legitimate apk Smali/Java Add malicious services/classes RecompileFinal malware Monday, 23 September 13
  • 25. USE AFE TO AUTOMATE !! Monday, 23 September 13
  • 26. Android Framework for Exploitation.py To make your life easier ! Find security vulnerabilities in your device+apps Protect your device against malwares Create automated malwares/botnets + send the data to a python listener Inject malicious services in another applications Use Android Exploits Crypt existing malwares to make them FUD Monday, 23 September 13
  • 27. AFE Perspective.c Offensive Defensive Malware Creation BotNet Automation Crypting Injecting Content Query App Assesment Fuzzing Kernel Assesment Monday, 23 September 13
  • 29. Let’s Make it FUD Matches the signature with its database Checks the activity, service and other class names checks the names of the variables Checks the control flow graph Monday, 23 September 13
  • 30. Let’s Make it FUD Matches the signature with its database Checks the activity, service and other class names checks the names of the variables Checks the control flow graph Rebuild + Zipalign Monday, 23 September 13
  • 31. Let’s Make it FUD Matches the signature with its database Checks the activity, service and other class names checks the names of the variables Checks the control flow graph Modifies the classnames and all its references within files Example: Converts com.example.org to com.omg.lol Monday, 23 September 13
  • 32. Let’s Make it FUD Matches the signature with its database Checks the activity, service and other class names checks the names of the variables Checks the control flow graph Split variables into two, and append at runtime Example: String a = “hello” Will now become String aa = “hel” String ab = “lo” String a = aa + ab Monday, 23 September 13
  • 33. Let’s Make it FUD Matches the signature with its database Checks the activity, service and other class names checks the names of the variables Checks the control flow graph Add dummy loops to change CFG Example: goto end; start: //everything in this label will execute, only when it is called ........ end: //everything in this label will execute, only when it is called goto start; Monday, 23 September 13
  • 34. Statistics? ? ? ? ? ? ?.xls Earlier Detection: 30/46 Monday, 23 September 13
  • 35. Statistics? ? ? ? ? ? ?.xls Detection after Crypting: 4/46 Monday, 23 September 13
  • 36. OOPS CRYPTING MODULE IS NOT PUBLIC :) Monday, 23 September 13
  • 37. ./Conclusion -h Be safe Don’t download apps from 3rd party markets Turn USB debugging OFF Anti-virus vendors -> Switch to dynamic analysis Focus on BYOD security We also conduct trainings on Advanced Mobile Hands-on Security/Exploitation for both Android and iOS Monday, 23 September 13
  • 38. HEY WAIT!! WHERE IS THE SOCIAL EXPERIMENT ? Monday, 23 September 13
  • 40. STILL CURIOUS ?? MEET ME NOW !!! Monday, 23 September 13