securing your mobile applications 2014-09-23 v1

49
Securing your Mobile Applications Karson Chan Security Consultant

Upload: phu-cong-le

Post on 13-Jul-2016

221 views

Category:

Documents


1 download

DESCRIPTION

Nothing to say at here.

TRANSCRIPT

Page 1: Securing Your Mobile Applications 2014-09-23 v1

Securing your Mobile Applications

Karson Chan

Security Consultant

Page 2: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

NTT Com SecurityThreat can come from anywhere – that’s why we are everywhere

Public-Approved-

v05

Risk and Information Security focus

Consulting, managed and technology services

Investing for the long term

Global reach/local engagement

Two decades of deep technology partnerships

Our knowledge is your security

1,000+Staff

8,000+Customers

20+ yearsexperience Offices across

EuropeAmerica &Asia-Pacific

Page 3: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security 3

Our Information Security Risk Service Offering

Information Risk Management

• Risk Insight (Risk Assessment)

• Security Strategy/Policy

• Security Control Framework / Standard /

Guidelines

• Information Classification

• Data Protection Assessment and Planning

• Identity Management

Compliance and Governance

• Security Standards (ISO/IEC 27001/Cobit5)

• Industry Best Practices (NIST, ISF, SANS,

CIS, OGCIO, AUS DOD, PII)

• Regulatory Standards (HKMA, SFC, MAS,

FISC, PDPO)

• PCI QSA Assessment and Compliance

Business Continuity/ Disaster Recovery

• Business Continuity Plan

Development/Testing

• Disaster Recovery Plan

Development/Testing

• Incident Response Plan

Development/Testing

Security Assessment

• PCI ASV Scan

• Gap Analysis / Security Audit

• Penetration Testing – Web Application,

Mobile Application, Wireless

• Source Code Review

• Cloud Security Assessment

Incident Response

• Social Engineering

• Incident Response

• Security Incident Drill Test

Security Awareness/Training

• Security Awareness Training for General

Users and IT Users

• Incident Response Training

• Product and Technical Skill Transfer such

as Penetration Testing

• Phishing Email Awareness

Security Technology Integration Service

• Staging

• Commissioning Support

• Installation and Configuration Review

• Upgrade

Quality Assurance

• Security Architecture Review

• Firewall Policy Review

• Technology Assessment

• SIEM Rationalization

• Emerging Technology Assessment

Project Management

• Infrastructure Change Management

• Project Resourcing

Governance, Risk Management and Compliance

Security Consulting Assessment Services

Security Implementation Services

Security Operations

Managed Security Services

• Device Management

• Security Analysis

• Security Enrichment – advisory and remediation

Security Operating Center

• Security Monitoring and Notification

• Security Incident Management

• Security Management Lifecycle

Page 4: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Agenda

4

1. What is Offensive Security

2. Recent Security Breaches

3. Application Security: Latest Trends

4. Mobile Application Threat Model

5. Mobile Application Attack Surface

6. Coffee Break

7. Demo

8. Q&A

Page 5: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Offensive SecurityWhat is it?

• It’s largely proactive

• To defend against ever changing threats, it helps to be able to think like the bad

guys do

• It’s not a replacement for reactive and defensive security. It complements them

• You have already put defenses in place. How would they fare against a real attack?

• Provides an indication of how secure you really are

• Black Box, White Box, and hybrid penetration testing

5

Offensive Security Testing

TechnologyProcessPeople

Page 6: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Offensive SecurityThe Approach

• Penetration Testing

• Web Application Assessment

• Mobile App Assessment

• Wireless (802.11)

• “Anything with in IP”

• Code Review

• Threat Modeling

• Code Analysis

• Secure Coding Workshop

6

Page 7: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Different between Vulnerability Assessment and Penetration Test

7

Vu

lne

rab

ilit

y A

sse

ssm

en

t Automatic assessment

Reveals isolated vulnerabilities

No human intelligence

Fast and efficient to identify most of vulnerabilities

Not able to address logic flaw

Vulnerabilities are possible false positive

Pe

ne

tra

tio

n T

est Manual assessment

Human intelligence

Able to address logic flaw

Identifies what data was actually compromised

Show how damaging a flaw could be in a real attack rather than find every flaw in a system

Page 8: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Penetration Testing

8

Tra

dit

ion

al

Test

ing Single Vector

Only identify vulnerabilities for single vector

Sce

na

rio

Ba

sed Testing multiple

disciplines simultaneously

Shows potential breaches through combined vulnerabilities

Simulate an APT threat in order to test if your APT defense is effective

Page 9: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Multiple Vectors

9

Web

ApplicationsNetwork Hacking Wireless

Malicious USB

Physical Infiltration

Social Engineering

Email

Phishing

Mobile Devices

Page 10: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Security Management,

Operation and Services

Application Protection

ToolsStandards,

Guidelines and

Tools

Secure Development

Life Cycle

Web Application Security

Governance• Standards &

Fundamentals

• Guidelines and

Procedures Checklists

• Concepts & Processes

• Topology /

Infrastructure

• Hardening /

Patch Management

Secure Application

Development• Software security

specifications

• Secure Design

• Secure coding

training

• Coding guidelines

• Tool based code

analysis

Management• Operating

• Maintaining

• Administration

• Incident-Handling

• Managed Services

Advanced-Security• Whitelist / Blacklist

• Proxy

• DOS Protection

• Web Application

Firewall

• SSL Termination/

Offload

• XML/SOAP-Firewall

• Authentication/SSO

Information Security StrategyRisk Analysis, PCI DSS, Compliance

VA, Code Review, Technical Audit & Pen Tests

Page 11: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Application Security:Disruption from operation to business loss

11

• Old Days -> Bugs, impact to business

operation and within company

• Nowadays -> Cybercrime, business

and brand damage

Page 12: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Major Security Breaches

12

1. Home Depot (Sept 2014)

Criminals used unique, custom-built malware to steal

credit card numbers from Home Depot’s point-of-sale

systems, may have affected 56 million credit and debit

cards in Canada and the U.S.

2. Celebrity Photo Leakage (Aug 2014)

a collection of almost 200 private pictures of various

celebrities leaked

3. eBay (May 2014)

Possibly 112 million customers password has been stolen

Page 13: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Major Security Breaches - Mobile Application

13

1. Fake Flappy Bird App Planted by Hackers to Steal Photos

from Device

2. Instagram’s Android users risk having their accounts hijacked

According to Gartner, over the next year and through the end of

2015, more than three-quarters of mobile apps will fail "basic

security tests.”

Page 14: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Breaches Statictics

14

Source: Verizon DBIR 2013

Page 15: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Attack Methods

15

Source: Verizon DBIR 2013

Page 16: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Application Security:Latest Trends

16

1. Single Vector to Multiple Vectors Attack

2. Mobile App Security

Page 17: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Latest Trend 1: A Multiple Vector Attack

17

Target Company

• An attacker will usually try the external vectors first (web applications,

network infrastructure) but may not be successful

• If they are determined enough, then a multi-vector attack would come next

Page 18: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

A Multiple Vector AttackAnalysis of the Attack

• In the previous example, the attacker combined 3 different attack vectors

together:

• This is a real-world example, it happens more than you would think

• Difficult to spot: Yes.

• All it takes is one user to fall for it

• Once reported and handled by incident response teams, the attacker may

already be connected to the VPN and carried out his deeds

18

Web

ApplicationsEmail

PhishingSocial Engineering

Page 19: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Latest Trend 2: Mobile App Security

19

Page 20: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Mobile Applications - How many do you have?

With the ubiquitous usage of smart phones and PDAs the Web Application market has

exploded

What started primarily as games and productivity aids have developed into business and

corporate tools

> Evolving from static content to highly interactive user interfaces exchanging data and

information of all types

> The line between the personal world and the business world is almost non-existent

A lack of development standards, frameworks, and language have inadvertently opened

up a vast, new targeted threat landscape

These threats, and how to deal with them, represent one of today’s single largest

information Security risks

Page 21: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Some Interesting Statistics

Android holds the current market share (around 84.7%)

There are other players:

> Apple – 11.7%

> Windows – 2.5%

> BlackBerry – 0.5%

> Other – 0.7%

73% of organizations have been hacked at least once in the past two

years through insecure web applications

On average, every web application has an average of 12 vulnerabilities

Page 22: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Differences with Web and Mobile Applications

A large number of web application security vulnerabilities are generally

associated with a lack of input validation (SQL Injection, XSS, Open Redirects,

Remote File Includes, etc)

With web applications, attackers generally attack from a pure black-box

methodology.

In general, greater skill and knowledge around reverse engineering is required

for assessing and attacking mobile applications because the code is already in

the hands of the attackers

22

Page 23: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Mobile Application Threat Model

23

Mobile Phone

Mobile Application

Web

Services

3rd Party

Libraries

An

dro

id V

uln

era

bilitie

sA

nd

roid

Vu

lne

rab

ilities

Ma

liciou

s Ap

plica

tion

sM

alicio

us A

pp

licatio

ns

Jailb

rea

k / R

oo

ting

Jailb

rea

k / R

oo

ting

Malicious

User

File

System

File

System

Page 24: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Mobile Application Attack Surfaces

The Application and Code

> Identification and manipulation of client side logic

Permissions

> Are application components sufficiently protected

Data-in-Transit

> Is the data protected as it’s sent to the server

Data-at-Rest

> Is the data stored on the device secured

The Server

> Does the server validate data from the mobile application

Page 25: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Application and Code

Both Android and iOS applications can be extracted from the phone in

their binary format

> Android: Java compiled to DEX VM bytecode

> iOS: Obj-C compiled to ARM binaries

A mixture of techniques is then used to decompose the application:

> Analysis of the AndroidManifest.xml File

> Static Analysis

> File System Analysis

> Dynamic Analysis

> Reverse Engineering

Page 26: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Application and Code It’s in the attacker’s hands

Compilation and de-obfuscation introduce a degree of difficulty for an attacker

attempting to retrieve the code in its original form, however it’s possible for

the determined and capable hacker

Dynamic analysis allows for an application to be extracted from a mobile device

and executed within an emulator

Execution within an emulator can highlight exactly what API calls are being

executed, and which files on the underlying file system are being accessed

Page 27: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Application and Code Getting back to the Source Code (Android)

classes.dex contains the Java bytecode in Dalvik compatible form

Continue to decompile it back into Java source code

Page 28: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Application and Code Getting back to the Source Code (Android)

Page 29: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Application and Code Getting back to the Source Code (Android)

Other applications haven’t been obfuscated at the compilation stage

The source code in this case is very close to the original

Page 30: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Application and Code Getting back to the Source Code (Android)

Developers who don’t obfuscate their code prior to release are helping the bad guys out

Simply by reading through the source code you can determine:

> How the application communicates to the server

> The types of requests sent to remote servers and their format

> If the application interacts with other components on the phone

> If the application is writing files to the underlying operating system

> Cryptographic Functions

> Third party libraries in use

All this helps in identifying potential attack surfaces of the application

One of the best ways to attack a client-server application is to write your own client to communicate to the server

Page 31: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Application and Code Getting back to the Source Code (Android)

The RequestAuthorization class shows exactly how the authentication token is

created (along with the secret key)

Page 32: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Mobile ApplicationLogical Flaws

We looked at a popular game which requires purchases of “gold” to progress further – it could probably get quite expensive

Upon decompiling the application and navigating through the obfuscated code, we were drawn to this call to a file on the device itself:

The gold value is stored in this preferences file on the device

A simple edit and you’re a millionaire within the game

> We had gold but now we have !

The server doesn’t keep track of this value!

> Not stored on the server

> Not validates

Page 33: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The Mobile ApplicationLogical Flaws

Mobile application research, shows that developers are implementing

business logic into their applications

Developers are often under the impression that if their code is

obfuscated, it cannot be decompiled

> Thus they decide to implement logic into the applications which should be

done on the server side

An application that hasn’t been obfuscated means that logic flaws can

usually be identified quickly!

Page 34: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Permissions

Mobile applications are installed with different privilege levels

A user’s mobile device will usually have applications from unknown

developers alongside applications they trust for everyday tasks

> For example, their mobile banking application and free games

Under the Android security model every application runs in its own

process and using a low-privileged user ID

Applications can only access their own files by default

With this isolation in place, applications are able to communicate via

different components

These communications between components are a critical area of

focus for assessing the security of a mobile application

Page 35: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Permissions

Android Applications are typically made up of multiple components:

> Activities

> Services

> Content Providers

> Broadcast Receivers

Permissions are granted to each component for as long as the application is installed on the device

If these components are not properly secured, malicious or other rogue programs can interact with them

Most applications that we have looked at recently do not have well defined permissions

Page 36: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

PermissionsWhat did we find?

Poorly protected components for a number of well known and popular applications

> Poorly protected activities (GUI screens) can be launched instead of the intended Activity

> Exported Activities can be launched by other applications (think CSRF for mobile applications)

> Broadcast messages vulnerable to eavesdropping or DoS (Denial of Service)

Our evaluation showed that most Android applications do not adequately

place permissions around their components

Some applications were found to contain the ‘debug’ flag. Even though

this is removed by default within the Eclipse ID, it still managed to end up

in the production application!

Page 37: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Permissions

android:debuggable=”true”

If you find the above line in the AndroidManifest.xml file, the application

is debuggable and it can be exploited.

Page 38: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Data-In-Transit

Most applications will at some point communicate with a server endpoint

Confidentiality and strong authentication is a must

Authentication:

> Verify the entity that the application is communicating with

Confidentiality:

> Prevent snooping

> Man-in-the-middle attacks

Page 39: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Data-At-Rest

One of the largest challenges with mobile applications is how they secure

data on the device

Many popular applications use SQLite database files which are not

adequately protected

If the device is lost or stolen, it would be trivial for an attacker to pull these

databases and view the records

On both Android, and iOS it’s fairly easy to get root access and access

application data and configuration files

> These files contain usernames, passwords, encryption keys, and other sensitive

account information

Page 40: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The ServerHistory Repeats Itself

Through our analysis of popular mobile applications, we continued to find old web application vulnerabilities:

> Username Enumeration

> SQL Injection

> Broken session management

> Information Disclosure

Does the server perform strong validation on these requests

Does the server allow the client to make logic decisions (this should be a big NO-NO, but happens all the time)

Does the server validate the mobile application

> A common tactic is to reverse engineer the mobile application and write a rogue client that communicates with the server

> Are clients validated

Page 41: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The ServerHarvesting User Information

The mobile application communicates to the server over HTTPS (good) and using JSON requests. It looks something like this:

The server would then respond to this request, with the user’s account information

What happens if we change the username parameter… ?

Page 42: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The ServerHarvesting User Information

The server responds with the user information for that user

This isn’t good. There’s obviously an authentication problem here

HTTP Request

HTTP Response

Page 43: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

The ServerHarvesting User Information

This is a serious vulnerability but unfortunately it happens quite a lot

All an attacker needs to have is a valid username and by exploiting the

vulnerability, he is able to obtain:

> The user’s mobile phone number

> The user’s email address

Through social engineering he may further his attacks against the user

He could also write a script to enumerate valid users within the system and

obtain their information

This application has been downloaded millions of times!

Page 44: Securing Your Mobile Applications 2014-09-23 v1

BREAK

Page 45: Securing Your Mobile Applications 2014-09-23 v1

DEMO

Page 46: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

Summary

46

> The threat surface of mobile applications differs significantly from that of web

applications

> Web application security has improved, but 5 year old vulnerabilities are still

common

> Development of mobile application development guidelines and assessment

capabilities are needed

> The risk of liability to corporations

> Organizations should have a framework for regular assessment and a solution for

assuring the security of applications

Page 47: Securing Your Mobile Applications 2014-09-23 v1

© NTT Com Security

A Holistic Approach to Application SecurityThe ‘ideal’ way to ensure your applications are secure

47

Threat Modeling

• Design Stage

• Identify Attack Surfaces

• Counter-measures

Secure Coding

Workshop

• Writing Secure Code

• Tailored to development frameworks

Code Analysis

• Combination of dynamic and static analysis

• Assess the code

• Identify vulnerabilities and potential logical issues

Vulnerability Assessment

• Catch the “low hanging” fruit

• Bi-Yearly / Quarterly

• Manual Verification

Penetration Testing

• Attacks directed at the application

• Enumerate attack surfaces

• Attack each layer of the application architecture

Page 48: Securing Your Mobile Applications 2014-09-23 v1

Questions?

Page 49: Securing Your Mobile Applications 2014-09-23 v1

Thank You