SlideShare a Scribd company logo
Mobile
Security
part-1
Android
apps
Pen testing
Null Mumbai
PuliyaWorkshop
25 November
2017
RomanshYadav
copyright 2017 | Romansh Yadav | All right reserved.
Content
Copyright 2017 | Romansh Yadav | All right reserved.
What is mobile
Security
Types of mobile
security
what is Android
Android
architecture
Process of app
development.
Android apps file
structure.
Tools for the app
pen testing setup a lab owasp top 10
Power of Drozer MobSF
The power of
smart phone
.
• Smartphones have change our life.As IOT is coming the
number of smartphone uses will increased.
• Smartphone is like our new part of body.
• Company know the next market of business will be IOT
devices.
• Here mobile apps play a great role.
• You need to make sure you customer can use your
mobile apps with confidence.
copyright 2017 | Romansh Yadav | All right reserved.
What is mobile security
• Mobile application security testing can help ensure there aren’t any
loopholes in the software that may cause data loss.
• The sets of tests are meant to attack the app to identify possible
threats and vulnerabilities that would allow external persons or
systems to access private information stored on the mobile device.
copyright 2017 | Romansh Yadav | All right reserved.
Types of mobile apps security testing
• Static mobile apps security testing.
• Dynamic mobile apps security testing.
copyright 2017 | Romansh Yadav | All right reserved.
Static mobile apps security testing
• In the static mobile apps security testing ,we do testing when the code is in
rest mode.
• We review the source code and check hashing algorithm used in the code.
• We analysis the manifest.xml file.
copyright 2017 | Romansh Yadav | All right reserved.
Dynamic mobile apps security testing
• In the dynamic testing we do testing when the app is running or we can say
at the run time label.
• We analysis the flow and try to call the activity and many more .
copyright 2017 | Romansh Yadav | All right reserved.
Platform
for mobile
security
testing
Android Windows iOS Blackberry etc
copyright 2017 | Romansh Yadav | All right reserved.
What is Android
•Android is an operating system
bought by google in 2005.
•Originally developed by Andy
Rubin, Rich Miner, Nick Sears, and
Chris White at Android Inc.
•It is based on Linux kernel.
•Ore0 upcoming android version 8.1
copyright 2017 | Romansh Yadav | All right reserved.
Android architecture
copyright 2017 | Romansh Yadav | All right reserved.
• Application
• Application framework
• Libraries
• Android Runtime
• Hardware abstraction Layer
• Linux Kernel
Application
Layer
•Android app are written in
java programming language.
•Java compiler convert java
code into .class file or byte
code
•The dex tool converts the .class
files to Dalvik byte code. Any 3rd
party libraries and .class files that
you have included in your project
are also converted into .dex files
so that they can be packaged
into the final .apk file.
copyright 2017 | Romansh Yadav | All right reserved.
copyright 2017 | Romansh Yadav | All right reserved.
• All non-compiled resources (such
as images), compiled resources,
and the .dex files are sent to the
apkbuilder tool to be packaged
into an .apk file.
• Once the .apk is built, it must be
signed with either a debug or
release key before it can be
installed to a device.
Application
Framework
• The Application Framework layer provides many higher-
level services to applications in the form of Java classes.
Application developers are allowed to make use of these
services in their applications
copyright 2017 | Romansh Yadav | All right reserved.
Libraries
• The libraries shown in the image are very necessary
without which application will not run likeWebkit library
is used for browsing the web , SQLite library is used for
maintaining SQL database and so on.
copyright 2017 | Romansh Yadav | All right reserved.
Dalvik virtual
Machine
• DalvikVirtual Machine is to execute application written
for Android . Each app running in the Android Device has
its own DalvikVirtual Machine.
copyright 2017 | Romansh Yadav | All right reserved.
Android runtime
• Android Runtime (ART) is a alternative to DalvikVirtual
Machine. New in ART is because of Ahead-of-time(AOT)
Compilation and Garbage Collection. InAhead-of-
time(AOT) Compilation ,android apps will be compiled
when user installs them on their device whereas in the
Dalvik used Just-in-time(JIT) compilation in which
bytecode are compiled when user runs the app.
copyright 2017 | Romansh Yadav | All right reserved.
Hardware abstraction Layer
• Hardware Abstraction Layer just gives Applications direct access to the
Hardware resources
copyright 2017 | Romansh Yadav | All right reserved.
Linux Kernel
Android is built up on the
Linux Kernel.
Linux Kernel provides basic
system functionality like
process management,
memory management,
device management like
camera, keypad, display etc
As a multiuser operating
system, a fundamental
security objective of the
Linux kernel is to isolate user
resources from one another.
Prevents userA from
reading user B’s files
Ensures that user A does not
exhaust user B’s memory
Ensures that user A does not
exhaust user B’s CPU
resources
copyright 2017 | Romansh Yadav | All right reserved.
Development tools
• An Integrated Development Environment (IDE) is a
software application that provides comprehensive
facilities to computer programmers for software
development
• A software development kit (SDK or devkit) is
typically a set of software development tools that
allows the creation of applications for a
certain software package, software framework,
hardware platform, computer system, video game
console, operating system, or similar development
platform.(wikipedia)
IDE
SDK
copyright 2017 | Romansh Yadav | All right reserved.
Developed an android app
copyright 2017 | Romansh Yadav | All right reserved.
Demo with Android Studio
Android file structure
copyright 2017 | Romansh Yadav | All right reserved.
AndroidManifest.xml File
• AndroidManifest.xml is the control file in every app.
• Every service, ContentProvider, activity, Broadcast Receiver need to be
mentioned in the AndroidManifest.xml file.
• We will explore this file in details in our testing module.
copyright 2017 | Romansh Yadav | All right reserved.
Component of android apps
• Activity
• Content Provider
• Services
• Broadcast Receiver
copyright 2017 | Romansh Yadav | All right reserved.
BasicTools for android apps
Pen testing
• Drozer(Best for dynamic)
• mobSF(Mobile security framework-Best for static)
• dex2jar
• Jd-gui
• A proxy tools like brup Suite or Zap
• Appie(set of many tools for windows)
• Santaku(an operating system for mobile apps pen testing like Kali)
copyright 2017 | Romansh Yadav | All right reserved.
Setup small Lab
• Download Genymotion with virtual machine and install.
• Download Appie(only for windows) tool kit and install.
• Drozer
• mobSF
• Alternative emulator nox
copyright 2017 | Romansh Yadav | All right reserved.
Vulnerable apps
• Sieve
• Diva.
• FourGoats.
• Herd-Financial.
copyright 2017 | Romansh Yadav | All right reserved.
Owasp top 10 -2014
for Mobile security
copyright 2017 | Romansh Yadav | All right reserved.
M1-weak server side
control
copyright 2017 | Romansh Yadav | All right reserved.
• A testing web server was setup to provide web service for mobile websites
to access. It demonstrated how weak server side controls would result in
unintended access of the web services.
• In order for this vulnerability to be exploited, the organization must expose
a web service orAPI call that is consumed by the mobile app.
copyright 2017 | Romansh Yadav | All right reserved.
• The exposed service or API call is implemented using insecure coding
techniques that produce an OWASPTopTen vulnerability within the server.
Through the mobile interface, an attacker is able to feed malicious inputs or
unexpected sequences of events to the vulnerable endpoint.
copyright 2017 | Romansh Yadav | All right reserved.
M2-Insecure data storage
copyright 2017 | Romansh Yadav | All right reserved.
• In this vulnerability developer stored data locally.
• By default, files that you create on internal storage are accessible only to
your app.This protection is implemented by Android and is sufficient for
most applications.
copyright 2017 | Romansh Yadav | All right reserved.
• But developers often use MODE_WORLD_READBALE &
MODE_WORLD_WRITABLE to provide those file to some application but
this doesn’t limit other apps(Malicious) from accessing them.
• Path for local storage- data/data/app-package-name/
• Many time it can be stored in external storage
copyright 2017 | Romansh Yadav | All right reserved.
Demo
• Let’s check data/data/app-package-name/ directory
• Let’s check either application is using any content provide with exported
permission.
• Let’s also check the external storage(sdcard)
copyright 2017 | Romansh Yadav | All right reserved.
M3-Insufficient transport
layer protection
copyright 2017 | Romansh Yadav | All right reserved.
• Transfer data from client to server in plain text.
• Now a days most application prefer to send data over Secure Channel to
prevent interception and leaking to an malicious user.
• We can check this kind of vulnerability by any proxy tool.
• We will use burpsuite.
copyright 2017 | Romansh Yadav | All right reserved.
• Now we are going to set a proxy in our android device/emulator to intercept
the traffic between application and the server. If you are using
Genymotionor Nox then go toWifi under Settings. TapWiredSSID for a
While and then tap on Modify Network.
• In proxy settings, choose manual then enter IP Address and port on which
Burp Suite is listening.
• Now device http traffic can be intercepted by Burp Suite.
copyright 2017 | Romansh Yadav | All right reserved.
For https traffic
• For https traffic we have to install the burp self sign certificate.
• Just type https://burp or https://ipwithlistinerport.
• Download certificate and go to security install from the sd card, give a name
with .cert extension.
• Go to trusted credential and look user tab, you will find a PortSwigger CA.
copyright 2017 | Romansh Yadav | All right reserved.
SSl Certificate Pinning
• It means hard-coding the certificate known to be used by the server in the
mobile application.The app can then ignore the device’s trust store and rely
on its own, and allow only SSL connections to hosts signed with certificates
stored inside the application.
copyright 2017 | Romansh Yadav | All right reserved.
Bypassing ssl certificate pinning
• There are two bypass SSL Certificate Pinning, first by changing the source
code and other by Android-SSL-Trust-Killer. Changing source code is
always a tedious Job, because every Application has it’s own
implementation of Encryption.
copyright 2017 | Romansh Yadav | All right reserved.
• We would instead take a simpler path for now, will install Android SSL-
Trust-Killer application in the android device which will bypass SSL
Certificate Pinning for nearly all application.
• Let’s do this.
copyright 2017 | Romansh Yadav | All right reserved.
M4-unintended data
leakage
copyright 2017 | Romansh Yadav | All right reserved.
• It also called Logging based vulnerability.
• When application accidently leaks the data.
• If an application crashes during runtime and it saves logs somewhere.
copyright 2017 | Romansh Yadav | All right reserved.
• Often Developers leave debugging information publicly. So any application
with READ_LOGS permission can access those logs and can gain sensitive
information through that.
• We can use logcat or pidcat for checking this kind of vulnerability.
• Let’s do this.
• adb logcat pid or packagename
copyright 2017 | Romansh Yadav | All right reserved.
M5-poor authentication
and authorization
copyright 2017 | Romansh Yadav | All right reserved.
• After authentication on an Android Application , it shift to a new activity
which basically users are aware off. But developers keep those activities
exported and even without custom permissions.
• Example – directly start a after login activity without login
• Directly open OTP activity without card number and pin or cvs.
• Username enumeration via Reset password.
• Let’s do this.
copyright 2017 | Romansh Yadav | All right reserved.
• run app.activity.start --component org.owasp.goatdroid.herdfinancial
org.owasp.goatdroid.herdfinancial.activities.Main
copyright 2017 | Romansh Yadav | All right reserved.
• In the authorization vulnerability we simply bypass the privilege, we can also
called it privilege escalation
• Horizontally -: normal user to normal user
• Vertical -: normal user to root user.
• Let’s do this.
copyright 2017 | Romansh Yadav | All right reserved.
M6-Broken cryptography
copyright 2017 | Romansh Yadav | All right reserved.
• This kind of vulnerability occur when we hardcoded the sensitive
information like username, password.
• Managing Private key of any encryption algorithm.
• Using poor algorithm (RC4, MD4,SHA1).
• Let’s do this.
copyright 2017 | Romansh Yadav | All right reserved.
.
• Jg-Gui and open up the StatmentDBHelper class.
• you can open UserInfoDBHelper class .
• You can see above that password for encrypting db files are stored in
HerdFinancial Application. Passwords
are hammer and havey0us33nb@seball . So anyone with HerdFinancial
Application can get password using reverse engineering and then decrypt
the content using those keys
copyright 2017 | Romansh Yadav | All right reserved.
M7-client side injection
copyright 2017 | Romansh Yadav | All right reserved.
• Sql injection-simple as we used in web application(Boolean based )
• JavaScript Injection: - If you have yourGoogle account attached to device
then you can use yourGoogle account in Android Browser without
authentication.
• Let’s see Diva input validation 1 example
copyright 2017 | Romansh Yadav | All right reserved.
• Mobile malware or other malicious apps may perform a binary attack
against the presentation layer (HTML, JavaScript, Cascading Style Sheets )
or the actual binary of the mobile app’s executable.These code injections
are executed either by the mobile app’s framework or the binary itself at
run-time
copyright 2017 | Romansh Yadav | All right reserved.
M8-security decision via
untrusted data
copyright 2017 | Romansh Yadav | All right reserved.
• Your mobile application can accept data from all kinds of sources. In most
cases this will be an Inter Process Communication (IPC) mechanism.
• Inter Process Communication happened with the help of the intent.
• intent is basically a message that is passed between components (such as
Activities, Services, Broadcast Receivers, and Content Providers)
copyright 2017 | Romansh Yadav | All right reserved.
To be simple Intent can be used for
• To start anActivity, typically opening a user interface for an app
• As broadcasts to inform the system and apps of changes
• To start, stop, and communicate with a background service
• To access data via ContentProviders
• As callbacks to handle events.
copyright 2017 | Romansh Yadav | All right reserved.
• run app.package.attacksurface com.mwr.example.sieve
• wecan see there are two exported Content Providers.
• run app.provider.finuri com.mwr.example.sieve
• So by using the app.provider.finduri modules we have found some of the
exported content provider URIs which can access by other apps installed on
the same devices.
• We can see that there are two similar URIS
copyright 2017 | Romansh Yadav | All right reserved.
• content://com.mwr.example.sieve.DBContentProvider/keys
• content://com.mwr.example.sieve.DBContentProvider/keys/
• run app.provider.query
content://com.mwr.example.sieve.DBContentProvider/keys
• We can also access the password’s saved in this Password Manager App by
query another exported URI.
• run app.provider.query
content://com.mwr.example.sieve.DBContentProvider/password
copyright 2017 | Romansh Yadav | All right reserved.
M9-Improper session
handling
copyright 2017 | Romansh Yadav | All right reserved.
• Session handling is very important part after authentication has been done.
• No session destruction at server side-
when user opt for logout then applications just send a null cookie that
session cookie is valid on server side and is not destroyed after user opted
for logout feature.
• Cookie not set as Secure
The secure flag is an option that can be set by the application server when
sending a new cookie to the user within an HTTP Response.
copyright 2017 | Romansh Yadav | All right reserved.
M10-Binary Protection
copyright 2017 | Romansh Yadav | All right reserved.
• Android Application are delivered through an .apk file format which an
adversary can reverse engineer it and can see all the code contained in it.
• D2j-dex2jar.
• Then open the jar file with jd-gui.
• Also attacker can also insert the malicious code, recompile it and deliver to
normal users.
• Let’s do a reverse shell demo.
copyright 2017 | Romansh Yadav | All right reserved.
The power of drozer
• Drozer is a framework forAndroid security assessments developed by MWR
Labs.
• It is one of the best Android security assessment tools available forAndroid
Security Assessments.
• https://www.mwrinfosecurity.com/products/drozer/community-edition/
copyright 2017 | Romansh Yadav | All right reserved.
• To start working with Drozer for your assessments, we need to connect the
Drozer console we have on the workstation and agent sitting on the
emulator.
• To do this, start the agent on your emulator and run the following command
to port forward. Make sure you are running the embedded server when
launching the agent.
• adb forward tcp:31415 tcp:31415
• Drozer console connect
copyright 2017 | Romansh Yadav | All right reserved.
mobSF
copyright 2017 | Romansh Yadav | All right reserved.
• https://github.com/MobSF/Mobile-Security-Framework-MobSF
• Python 2.7 –download and install
• Oracle JDK 1.7 or above
• c:python27python.exe -m pip install -r "pathrequirements.txt“
• c:python27python.exe "pathmanage.py“ runserver
copyright 2017 | Romansh Yadav | All right reserved.
• You can navigate to http://localhost:8000/ to access the MobSFWeb
interface.
• The pip command is a tool for installing and managing Python packages.
copyright 2017 | Romansh Yadav | All right reserved.
copyright 2017 | Romansh Yadav | All right reserved.
Thank you
I hope this information help you to
become a mobile Security Expert
copyright 2017 | Romansh Yadav | All
right reserved.

More Related Content

What's hot

Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Ajin Abraham
 
Security Testing Mobile Applications
Security Testing Mobile ApplicationsSecurity Testing Mobile Applications
Security Testing Mobile Applications
Denim Group
 
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...
Ajin Abraham
 
Pentesting Android Applications
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android Applications
Cláudio André
 
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSFAppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
Ajin Abraham
 
Android Pentesting
Android PentestingAndroid Pentesting
OWASP Mobile Top 10 Deep-Dive
OWASP Mobile Top 10 Deep-DiveOWASP Mobile Top 10 Deep-Dive
OWASP Mobile Top 10 Deep-Dive
Prathan Phongthiproek
 
Pwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreakPwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreak
Abraham Aranguren
 
Android pentesting
Android pentestingAndroid pentesting
Android pentesting
Mykhailo Antonishyn
 
OWASP Mobile Security: Top 10 Risks for 2017
OWASP Mobile Security: Top 10 Risks for 2017OWASP Mobile Security: Top 10 Risks for 2017
OWASP Mobile Security: Top 10 Risks for 2017
TecsyntSolutions
 
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web ServicesXXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
Abraham Aranguren
 
OWASP Top 10 2021 What's New
OWASP Top 10 2021 What's NewOWASP Top 10 2021 What's New
OWASP Top 10 2021 What's New
Michael Furman
 
OWASP Mobile Top 10
OWASP Mobile Top 10OWASP Mobile Top 10
OWASP Mobile Top 10
NowSecure
 
Getting started with Android pentesting
Getting started with Android pentestingGetting started with Android pentesting
Getting started with Android pentesting
Minali Arora
 
Mobile Application Penetration Testing
Mobile Application Penetration TestingMobile Application Penetration Testing
Mobile Application Penetration Testing
BGA Cyber Security
 
Hacking and securing ios applications
Hacking and securing ios applicationsHacking and securing ios applications
Hacking and securing ios applications
Satish b
 
Unrestricted file upload CWE-434 - Adam Nurudini (ISACA)
Unrestricted file upload CWE-434 -  Adam Nurudini (ISACA)Unrestricted file upload CWE-434 -  Adam Nurudini (ISACA)
Unrestricted file upload CWE-434 - Adam Nurudini (ISACA)
Adam Nurudini
 
Security testing in mobile applications
Security testing in mobile applicationsSecurity testing in mobile applications
Security testing in mobile applications
Jose Manuel Ortega Candel
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
n|u - The Open Security Community
 
Android Security
Android SecurityAndroid Security
Android Security
Suminda Gunawardhana
 

What's hot (20)

Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...Automated Security Analysis of Android & iOS Applications with Mobile Securit...
Automated Security Analysis of Android & iOS Applications with Mobile Securit...
 
Security Testing Mobile Applications
Security Testing Mobile ApplicationsSecurity Testing Mobile Applications
Security Testing Mobile Applications
 
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...
Nullcon Goa 2016 - Automated Mobile Application Security Testing with Mobile ...
 
Pentesting Android Applications
Pentesting Android ApplicationsPentesting Android Applications
Pentesting Android Applications
 
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSFAppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF
 
Android Pentesting
Android PentestingAndroid Pentesting
Android Pentesting
 
OWASP Mobile Top 10 Deep-Dive
OWASP Mobile Top 10 Deep-DiveOWASP Mobile Top 10 Deep-Dive
OWASP Mobile Top 10 Deep-Dive
 
Pwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreakPwning mobile apps without root or jailbreak
Pwning mobile apps without root or jailbreak
 
Android pentesting
Android pentestingAndroid pentesting
Android pentesting
 
OWASP Mobile Security: Top 10 Risks for 2017
OWASP Mobile Security: Top 10 Risks for 2017OWASP Mobile Security: Top 10 Risks for 2017
OWASP Mobile Security: Top 10 Risks for 2017
 
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web ServicesXXE Exposed: SQLi, XSS, XXE and XEE against Web Services
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
 
OWASP Top 10 2021 What's New
OWASP Top 10 2021 What's NewOWASP Top 10 2021 What's New
OWASP Top 10 2021 What's New
 
OWASP Mobile Top 10
OWASP Mobile Top 10OWASP Mobile Top 10
OWASP Mobile Top 10
 
Getting started with Android pentesting
Getting started with Android pentestingGetting started with Android pentesting
Getting started with Android pentesting
 
Mobile Application Penetration Testing
Mobile Application Penetration TestingMobile Application Penetration Testing
Mobile Application Penetration Testing
 
Hacking and securing ios applications
Hacking and securing ios applicationsHacking and securing ios applications
Hacking and securing ios applications
 
Unrestricted file upload CWE-434 - Adam Nurudini (ISACA)
Unrestricted file upload CWE-434 -  Adam Nurudini (ISACA)Unrestricted file upload CWE-434 -  Adam Nurudini (ISACA)
Unrestricted file upload CWE-434 - Adam Nurudini (ISACA)
 
Security testing in mobile applications
Security testing in mobile applicationsSecurity testing in mobile applications
Security testing in mobile applications
 
Api security-testing
Api security-testingApi security-testing
Api security-testing
 
Android Security
Android SecurityAndroid Security
Android Security
 

Similar to Mobile security part 1(Android Apps Pentesting)- Romansh yadav

Mobile security part 2
Mobile security part 2Mobile security part 2
Mobile security part 2
Romansh Yadav
 
ATAGTR2017 Cost-effective Security Testing Approaches for Web, Mobile & Enter...
ATAGTR2017 Cost-effective Security Testing Approaches for Web, Mobile & Enter...ATAGTR2017 Cost-effective Security Testing Approaches for Web, Mobile & Enter...
ATAGTR2017 Cost-effective Security Testing Approaches for Web, Mobile & Enter...
Agile Testing Alliance
 
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
Denim Group
 
A DevOps Approach for Building 100 iOS Apps
A DevOps Approach for Building 100 iOS AppsA DevOps Approach for Building 100 iOS Apps
A DevOps Approach for Building 100 iOS Apps
TechWell
 
Introduction to android - SpringPeople
Introduction to android - SpringPeopleIntroduction to android - SpringPeople
Introduction to android - SpringPeople
SpringPeople
 
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM France Lab
 
How to Integrate AppSec Testing into your DevOps Program
How to Integrate AppSec Testing into your DevOps Program How to Integrate AppSec Testing into your DevOps Program
How to Integrate AppSec Testing into your DevOps Program
Denim Group
 
Android @ Neev
Android @ NeevAndroid @ Neev
Android @ Neev
Neev Technologies
 
IBM Innovate DevOps for Mobile Apps
IBM Innovate DevOps for Mobile Apps IBM Innovate DevOps for Mobile Apps
IBM Innovate DevOps for Mobile Apps
Sanjeev Sharma
 
Demystifying the Mobile Container - PART I
Demystifying the Mobile Container - PART IDemystifying the Mobile Container - PART I
Demystifying the Mobile Container - PART I
Relayware
 
Nader Dabit - Introduction to Mobile Development with AWS.pdf
Nader Dabit - Introduction to Mobile Development with AWS.pdfNader Dabit - Introduction to Mobile Development with AWS.pdf
Nader Dabit - Introduction to Mobile Development with AWS.pdf
Amazon Web Services
 
Continuous security: Bringing agility to the secure development lifecycle
Continuous security: Bringing agility to the secure development lifecycleContinuous security: Bringing agility to the secure development lifecycle
Continuous security: Bringing agility to the secure development lifecycle
Rogue Wave Software
 
Android Security Humla Part 1
Android Security Humla Part 1Android Security Humla Part 1
Android Security Humla Part 1
Nikhil Kulkarni
 
(Isc)² secure johannesburg
(Isc)² secure johannesburg (Isc)² secure johannesburg
(Isc)² secure johannesburg
Tunde Ogunkoya
 
Popular App Development Frameworks used by App Developers.
Popular App Development Frameworks used by App Developers.Popular App Development Frameworks used by App Developers.
Popular App Development Frameworks used by App Developers.
Techugo
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android Security
Marakana Inc.
 
Ongoing management of your PHP 7 application
Ongoing management of your PHP 7 applicationOngoing management of your PHP 7 application
Ongoing management of your PHP 7 application
Zend by Rogue Wave Software
 
AppSphere 15 - How AppDynamics is Shaking up the Synthetic Monitoring Product...
AppSphere 15 - How AppDynamics is Shaking up the Synthetic Monitoring Product...AppSphere 15 - How AppDynamics is Shaking up the Synthetic Monitoring Product...
AppSphere 15 - How AppDynamics is Shaking up the Synthetic Monitoring Product...
AppDynamics
 
Android- Introduction for Beginners
Android- Introduction for BeginnersAndroid- Introduction for Beginners
Android- Introduction for Beginners
Tripti Tiwari
 
Android Documentation
Android DocumentationAndroid Documentation
Android Documentation
Raj Dubey
 

Similar to Mobile security part 1(Android Apps Pentesting)- Romansh yadav (20)

Mobile security part 2
Mobile security part 2Mobile security part 2
Mobile security part 2
 
ATAGTR2017 Cost-effective Security Testing Approaches for Web, Mobile & Enter...
ATAGTR2017 Cost-effective Security Testing Approaches for Web, Mobile & Enter...ATAGTR2017 Cost-effective Security Testing Approaches for Web, Mobile & Enter...
ATAGTR2017 Cost-effective Security Testing Approaches for Web, Mobile & Enter...
 
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
Monitoring Application Attack Surface to Integrate Security into DevOps Pipel...
 
A DevOps Approach for Building 100 iOS Apps
A DevOps Approach for Building 100 iOS AppsA DevOps Approach for Building 100 iOS Apps
A DevOps Approach for Building 100 iOS Apps
 
Introduction to android - SpringPeople
Introduction to android - SpringPeopleIntroduction to android - SpringPeople
Introduction to android - SpringPeople
 
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
IBM BlueMix Presentation - Paris Meetup 17th Sept. 2014
 
How to Integrate AppSec Testing into your DevOps Program
How to Integrate AppSec Testing into your DevOps Program How to Integrate AppSec Testing into your DevOps Program
How to Integrate AppSec Testing into your DevOps Program
 
Android @ Neev
Android @ NeevAndroid @ Neev
Android @ Neev
 
IBM Innovate DevOps for Mobile Apps
IBM Innovate DevOps for Mobile Apps IBM Innovate DevOps for Mobile Apps
IBM Innovate DevOps for Mobile Apps
 
Demystifying the Mobile Container - PART I
Demystifying the Mobile Container - PART IDemystifying the Mobile Container - PART I
Demystifying the Mobile Container - PART I
 
Nader Dabit - Introduction to Mobile Development with AWS.pdf
Nader Dabit - Introduction to Mobile Development with AWS.pdfNader Dabit - Introduction to Mobile Development with AWS.pdf
Nader Dabit - Introduction to Mobile Development with AWS.pdf
 
Continuous security: Bringing agility to the secure development lifecycle
Continuous security: Bringing agility to the secure development lifecycleContinuous security: Bringing agility to the secure development lifecycle
Continuous security: Bringing agility to the secure development lifecycle
 
Android Security Humla Part 1
Android Security Humla Part 1Android Security Humla Part 1
Android Security Humla Part 1
 
(Isc)² secure johannesburg
(Isc)² secure johannesburg (Isc)² secure johannesburg
(Isc)² secure johannesburg
 
Popular App Development Frameworks used by App Developers.
Popular App Development Frameworks used by App Developers.Popular App Development Frameworks used by App Developers.
Popular App Development Frameworks used by App Developers.
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android Security
 
Ongoing management of your PHP 7 application
Ongoing management of your PHP 7 applicationOngoing management of your PHP 7 application
Ongoing management of your PHP 7 application
 
AppSphere 15 - How AppDynamics is Shaking up the Synthetic Monitoring Product...
AppSphere 15 - How AppDynamics is Shaking up the Synthetic Monitoring Product...AppSphere 15 - How AppDynamics is Shaking up the Synthetic Monitoring Product...
AppSphere 15 - How AppDynamics is Shaking up the Synthetic Monitoring Product...
 
Android- Introduction for Beginners
Android- Introduction for BeginnersAndroid- Introduction for Beginners
Android- Introduction for Beginners
 
Android Documentation
Android DocumentationAndroid Documentation
Android Documentation
 

Mobile security part 1(Android Apps Pentesting)- Romansh yadav

  • 1. Mobile Security part-1 Android apps Pen testing Null Mumbai PuliyaWorkshop 25 November 2017 RomanshYadav copyright 2017 | Romansh Yadav | All right reserved.
  • 2. Content Copyright 2017 | Romansh Yadav | All right reserved. What is mobile Security Types of mobile security what is Android Android architecture Process of app development. Android apps file structure. Tools for the app pen testing setup a lab owasp top 10 Power of Drozer MobSF
  • 3. The power of smart phone . • Smartphones have change our life.As IOT is coming the number of smartphone uses will increased. • Smartphone is like our new part of body. • Company know the next market of business will be IOT devices. • Here mobile apps play a great role. • You need to make sure you customer can use your mobile apps with confidence. copyright 2017 | Romansh Yadav | All right reserved.
  • 4. What is mobile security • Mobile application security testing can help ensure there aren’t any loopholes in the software that may cause data loss. • The sets of tests are meant to attack the app to identify possible threats and vulnerabilities that would allow external persons or systems to access private information stored on the mobile device. copyright 2017 | Romansh Yadav | All right reserved.
  • 5. Types of mobile apps security testing • Static mobile apps security testing. • Dynamic mobile apps security testing. copyright 2017 | Romansh Yadav | All right reserved.
  • 6. Static mobile apps security testing • In the static mobile apps security testing ,we do testing when the code is in rest mode. • We review the source code and check hashing algorithm used in the code. • We analysis the manifest.xml file. copyright 2017 | Romansh Yadav | All right reserved.
  • 7. Dynamic mobile apps security testing • In the dynamic testing we do testing when the app is running or we can say at the run time label. • We analysis the flow and try to call the activity and many more . copyright 2017 | Romansh Yadav | All right reserved.
  • 8. Platform for mobile security testing Android Windows iOS Blackberry etc copyright 2017 | Romansh Yadav | All right reserved.
  • 9. What is Android •Android is an operating system bought by google in 2005. •Originally developed by Andy Rubin, Rich Miner, Nick Sears, and Chris White at Android Inc. •It is based on Linux kernel. •Ore0 upcoming android version 8.1 copyright 2017 | Romansh Yadav | All right reserved.
  • 10. Android architecture copyright 2017 | Romansh Yadav | All right reserved. • Application • Application framework • Libraries • Android Runtime • Hardware abstraction Layer • Linux Kernel
  • 11. Application Layer •Android app are written in java programming language. •Java compiler convert java code into .class file or byte code •The dex tool converts the .class files to Dalvik byte code. Any 3rd party libraries and .class files that you have included in your project are also converted into .dex files so that they can be packaged into the final .apk file. copyright 2017 | Romansh Yadav | All right reserved.
  • 12. copyright 2017 | Romansh Yadav | All right reserved. • All non-compiled resources (such as images), compiled resources, and the .dex files are sent to the apkbuilder tool to be packaged into an .apk file. • Once the .apk is built, it must be signed with either a debug or release key before it can be installed to a device.
  • 13. Application Framework • The Application Framework layer provides many higher- level services to applications in the form of Java classes. Application developers are allowed to make use of these services in their applications copyright 2017 | Romansh Yadav | All right reserved.
  • 14. Libraries • The libraries shown in the image are very necessary without which application will not run likeWebkit library is used for browsing the web , SQLite library is used for maintaining SQL database and so on. copyright 2017 | Romansh Yadav | All right reserved.
  • 15. Dalvik virtual Machine • DalvikVirtual Machine is to execute application written for Android . Each app running in the Android Device has its own DalvikVirtual Machine. copyright 2017 | Romansh Yadav | All right reserved.
  • 16. Android runtime • Android Runtime (ART) is a alternative to DalvikVirtual Machine. New in ART is because of Ahead-of-time(AOT) Compilation and Garbage Collection. InAhead-of- time(AOT) Compilation ,android apps will be compiled when user installs them on their device whereas in the Dalvik used Just-in-time(JIT) compilation in which bytecode are compiled when user runs the app. copyright 2017 | Romansh Yadav | All right reserved.
  • 17. Hardware abstraction Layer • Hardware Abstraction Layer just gives Applications direct access to the Hardware resources copyright 2017 | Romansh Yadav | All right reserved.
  • 18. Linux Kernel Android is built up on the Linux Kernel. Linux Kernel provides basic system functionality like process management, memory management, device management like camera, keypad, display etc As a multiuser operating system, a fundamental security objective of the Linux kernel is to isolate user resources from one another. Prevents userA from reading user B’s files Ensures that user A does not exhaust user B’s memory Ensures that user A does not exhaust user B’s CPU resources copyright 2017 | Romansh Yadav | All right reserved.
  • 19. Development tools • An Integrated Development Environment (IDE) is a software application that provides comprehensive facilities to computer programmers for software development • A software development kit (SDK or devkit) is typically a set of software development tools that allows the creation of applications for a certain software package, software framework, hardware platform, computer system, video game console, operating system, or similar development platform.(wikipedia) IDE SDK copyright 2017 | Romansh Yadav | All right reserved.
  • 20. Developed an android app copyright 2017 | Romansh Yadav | All right reserved. Demo with Android Studio
  • 21. Android file structure copyright 2017 | Romansh Yadav | All right reserved.
  • 22. AndroidManifest.xml File • AndroidManifest.xml is the control file in every app. • Every service, ContentProvider, activity, Broadcast Receiver need to be mentioned in the AndroidManifest.xml file. • We will explore this file in details in our testing module. copyright 2017 | Romansh Yadav | All right reserved.
  • 23. Component of android apps • Activity • Content Provider • Services • Broadcast Receiver copyright 2017 | Romansh Yadav | All right reserved.
  • 24. BasicTools for android apps Pen testing • Drozer(Best for dynamic) • mobSF(Mobile security framework-Best for static) • dex2jar • Jd-gui • A proxy tools like brup Suite or Zap • Appie(set of many tools for windows) • Santaku(an operating system for mobile apps pen testing like Kali) copyright 2017 | Romansh Yadav | All right reserved.
  • 25. Setup small Lab • Download Genymotion with virtual machine and install. • Download Appie(only for windows) tool kit and install. • Drozer • mobSF • Alternative emulator nox copyright 2017 | Romansh Yadav | All right reserved.
  • 26. Vulnerable apps • Sieve • Diva. • FourGoats. • Herd-Financial. copyright 2017 | Romansh Yadav | All right reserved.
  • 27. Owasp top 10 -2014 for Mobile security copyright 2017 | Romansh Yadav | All right reserved.
  • 28. M1-weak server side control copyright 2017 | Romansh Yadav | All right reserved.
  • 29. • A testing web server was setup to provide web service for mobile websites to access. It demonstrated how weak server side controls would result in unintended access of the web services. • In order for this vulnerability to be exploited, the organization must expose a web service orAPI call that is consumed by the mobile app. copyright 2017 | Romansh Yadav | All right reserved.
  • 30. • The exposed service or API call is implemented using insecure coding techniques that produce an OWASPTopTen vulnerability within the server. Through the mobile interface, an attacker is able to feed malicious inputs or unexpected sequences of events to the vulnerable endpoint. copyright 2017 | Romansh Yadav | All right reserved.
  • 31. M2-Insecure data storage copyright 2017 | Romansh Yadav | All right reserved.
  • 32. • In this vulnerability developer stored data locally. • By default, files that you create on internal storage are accessible only to your app.This protection is implemented by Android and is sufficient for most applications. copyright 2017 | Romansh Yadav | All right reserved.
  • 33. • But developers often use MODE_WORLD_READBALE & MODE_WORLD_WRITABLE to provide those file to some application but this doesn’t limit other apps(Malicious) from accessing them. • Path for local storage- data/data/app-package-name/ • Many time it can be stored in external storage copyright 2017 | Romansh Yadav | All right reserved.
  • 34. Demo • Let’s check data/data/app-package-name/ directory • Let’s check either application is using any content provide with exported permission. • Let’s also check the external storage(sdcard) copyright 2017 | Romansh Yadav | All right reserved.
  • 35. M3-Insufficient transport layer protection copyright 2017 | Romansh Yadav | All right reserved.
  • 36. • Transfer data from client to server in plain text. • Now a days most application prefer to send data over Secure Channel to prevent interception and leaking to an malicious user. • We can check this kind of vulnerability by any proxy tool. • We will use burpsuite. copyright 2017 | Romansh Yadav | All right reserved.
  • 37. • Now we are going to set a proxy in our android device/emulator to intercept the traffic between application and the server. If you are using Genymotionor Nox then go toWifi under Settings. TapWiredSSID for a While and then tap on Modify Network. • In proxy settings, choose manual then enter IP Address and port on which Burp Suite is listening. • Now device http traffic can be intercepted by Burp Suite. copyright 2017 | Romansh Yadav | All right reserved.
  • 38. For https traffic • For https traffic we have to install the burp self sign certificate. • Just type https://burp or https://ipwithlistinerport. • Download certificate and go to security install from the sd card, give a name with .cert extension. • Go to trusted credential and look user tab, you will find a PortSwigger CA. copyright 2017 | Romansh Yadav | All right reserved.
  • 39. SSl Certificate Pinning • It means hard-coding the certificate known to be used by the server in the mobile application.The app can then ignore the device’s trust store and rely on its own, and allow only SSL connections to hosts signed with certificates stored inside the application. copyright 2017 | Romansh Yadav | All right reserved.
  • 40. Bypassing ssl certificate pinning • There are two bypass SSL Certificate Pinning, first by changing the source code and other by Android-SSL-Trust-Killer. Changing source code is always a tedious Job, because every Application has it’s own implementation of Encryption. copyright 2017 | Romansh Yadav | All right reserved.
  • 41. • We would instead take a simpler path for now, will install Android SSL- Trust-Killer application in the android device which will bypass SSL Certificate Pinning for nearly all application. • Let’s do this. copyright 2017 | Romansh Yadav | All right reserved.
  • 42. M4-unintended data leakage copyright 2017 | Romansh Yadav | All right reserved.
  • 43. • It also called Logging based vulnerability. • When application accidently leaks the data. • If an application crashes during runtime and it saves logs somewhere. copyright 2017 | Romansh Yadav | All right reserved.
  • 44. • Often Developers leave debugging information publicly. So any application with READ_LOGS permission can access those logs and can gain sensitive information through that. • We can use logcat or pidcat for checking this kind of vulnerability. • Let’s do this. • adb logcat pid or packagename copyright 2017 | Romansh Yadav | All right reserved.
  • 45. M5-poor authentication and authorization copyright 2017 | Romansh Yadav | All right reserved.
  • 46. • After authentication on an Android Application , it shift to a new activity which basically users are aware off. But developers keep those activities exported and even without custom permissions. • Example – directly start a after login activity without login • Directly open OTP activity without card number and pin or cvs. • Username enumeration via Reset password. • Let’s do this. copyright 2017 | Romansh Yadav | All right reserved.
  • 47. • run app.activity.start --component org.owasp.goatdroid.herdfinancial org.owasp.goatdroid.herdfinancial.activities.Main copyright 2017 | Romansh Yadav | All right reserved.
  • 48. • In the authorization vulnerability we simply bypass the privilege, we can also called it privilege escalation • Horizontally -: normal user to normal user • Vertical -: normal user to root user. • Let’s do this. copyright 2017 | Romansh Yadav | All right reserved.
  • 49. M6-Broken cryptography copyright 2017 | Romansh Yadav | All right reserved.
  • 50. • This kind of vulnerability occur when we hardcoded the sensitive information like username, password. • Managing Private key of any encryption algorithm. • Using poor algorithm (RC4, MD4,SHA1). • Let’s do this. copyright 2017 | Romansh Yadav | All right reserved.
  • 51. . • Jg-Gui and open up the StatmentDBHelper class. • you can open UserInfoDBHelper class . • You can see above that password for encrypting db files are stored in HerdFinancial Application. Passwords are hammer and havey0us33nb@seball . So anyone with HerdFinancial Application can get password using reverse engineering and then decrypt the content using those keys copyright 2017 | Romansh Yadav | All right reserved.
  • 52. M7-client side injection copyright 2017 | Romansh Yadav | All right reserved.
  • 53. • Sql injection-simple as we used in web application(Boolean based ) • JavaScript Injection: - If you have yourGoogle account attached to device then you can use yourGoogle account in Android Browser without authentication. • Let’s see Diva input validation 1 example copyright 2017 | Romansh Yadav | All right reserved.
  • 54. • Mobile malware or other malicious apps may perform a binary attack against the presentation layer (HTML, JavaScript, Cascading Style Sheets ) or the actual binary of the mobile app’s executable.These code injections are executed either by the mobile app’s framework or the binary itself at run-time copyright 2017 | Romansh Yadav | All right reserved.
  • 55. M8-security decision via untrusted data copyright 2017 | Romansh Yadav | All right reserved.
  • 56. • Your mobile application can accept data from all kinds of sources. In most cases this will be an Inter Process Communication (IPC) mechanism. • Inter Process Communication happened with the help of the intent. • intent is basically a message that is passed between components (such as Activities, Services, Broadcast Receivers, and Content Providers) copyright 2017 | Romansh Yadav | All right reserved.
  • 57. To be simple Intent can be used for • To start anActivity, typically opening a user interface for an app • As broadcasts to inform the system and apps of changes • To start, stop, and communicate with a background service • To access data via ContentProviders • As callbacks to handle events. copyright 2017 | Romansh Yadav | All right reserved.
  • 58. • run app.package.attacksurface com.mwr.example.sieve • wecan see there are two exported Content Providers. • run app.provider.finuri com.mwr.example.sieve • So by using the app.provider.finduri modules we have found some of the exported content provider URIs which can access by other apps installed on the same devices. • We can see that there are two similar URIS copyright 2017 | Romansh Yadav | All right reserved.
  • 59. • content://com.mwr.example.sieve.DBContentProvider/keys • content://com.mwr.example.sieve.DBContentProvider/keys/ • run app.provider.query content://com.mwr.example.sieve.DBContentProvider/keys • We can also access the password’s saved in this Password Manager App by query another exported URI. • run app.provider.query content://com.mwr.example.sieve.DBContentProvider/password copyright 2017 | Romansh Yadav | All right reserved.
  • 60. M9-Improper session handling copyright 2017 | Romansh Yadav | All right reserved.
  • 61. • Session handling is very important part after authentication has been done. • No session destruction at server side- when user opt for logout then applications just send a null cookie that session cookie is valid on server side and is not destroyed after user opted for logout feature. • Cookie not set as Secure The secure flag is an option that can be set by the application server when sending a new cookie to the user within an HTTP Response. copyright 2017 | Romansh Yadav | All right reserved.
  • 62. M10-Binary Protection copyright 2017 | Romansh Yadav | All right reserved.
  • 63. • Android Application are delivered through an .apk file format which an adversary can reverse engineer it and can see all the code contained in it. • D2j-dex2jar. • Then open the jar file with jd-gui. • Also attacker can also insert the malicious code, recompile it and deliver to normal users. • Let’s do a reverse shell demo. copyright 2017 | Romansh Yadav | All right reserved.
  • 64. The power of drozer • Drozer is a framework forAndroid security assessments developed by MWR Labs. • It is one of the best Android security assessment tools available forAndroid Security Assessments. • https://www.mwrinfosecurity.com/products/drozer/community-edition/ copyright 2017 | Romansh Yadav | All right reserved.
  • 65. • To start working with Drozer for your assessments, we need to connect the Drozer console we have on the workstation and agent sitting on the emulator. • To do this, start the agent on your emulator and run the following command to port forward. Make sure you are running the embedded server when launching the agent. • adb forward tcp:31415 tcp:31415 • Drozer console connect copyright 2017 | Romansh Yadav | All right reserved.
  • 66. mobSF copyright 2017 | Romansh Yadav | All right reserved.
  • 67. • https://github.com/MobSF/Mobile-Security-Framework-MobSF • Python 2.7 –download and install • Oracle JDK 1.7 or above • c:python27python.exe -m pip install -r "pathrequirements.txt“ • c:python27python.exe "pathmanage.py“ runserver copyright 2017 | Romansh Yadav | All right reserved.
  • 68. • You can navigate to http://localhost:8000/ to access the MobSFWeb interface. • The pip command is a tool for installing and managing Python packages. copyright 2017 | Romansh Yadav | All right reserved.
  • 69. copyright 2017 | Romansh Yadav | All right reserved.
  • 70. Thank you I hope this information help you to become a mobile Security Expert copyright 2017 | Romansh Yadav | All right reserved.