pentesting android apps

30
Pentesting Android Apps Abdelhamid Limami IT Security Consultant @ ITDefence

Upload: abdelhamid-limami

Post on 13-Feb-2017

208 views

Category:

Technology


5 download

TRANSCRIPT

Page 1: Pentesting Android Apps

Pentesting Android Apps

Abdelhamid LimamiIT Security Consultant @ ITDefence

Page 2: Pentesting Android Apps

Overview What is Android ?

Android Architecture Android Applications Security Environment Setup Exploiting Apps Vulnerabilities

OWASP Top 10 Mobile Demo(s)

Tips for Developers Q&A

Page 3: Pentesting Android Apps

Past years… Mobile Phones :

Phone calls Sending text message or MMS Alarm clock Calculator & Calendar Listen on Radio Playing the snake game

Page 4: Pentesting Android Apps

And Now… Smart Phones !

Sending email Watching Tv & Movies Surf The internet Booking Flights & Hotels Online Banking transactions Social Network (Facebook, Twitter, Instagram, Etc …)

3G , 4G , 5G Mobile Network & WIFI & NFC support

Page 5: Pentesting Android Apps

What is Android ? Android is a Linux based platform developed by Google and

the open handset alliance.

Application programming for it is done in java (include XML & support HTML).

The android operating system software stack consist of java applications running on a Dalvik virtual machine (DVK).

Applications similars to web apps.

Page 6: Pentesting Android Apps

Android Architecture

Page 7: Pentesting Android Apps

Android Applications Security

Page 8: Pentesting Android Apps

Attack Surfaces

Client Software on Android Device

Communications Channel

Server Side Infrastructure

Page 9: Pentesting Android Apps

Client Software

Packages are Installed from Play Store , Company Website, Third party apps/websites

Access All the files of the application in the local system (Need Root)

Can be Tampered , Decomplied & Reverse Engineered

Page 10: Pentesting Android Apps

Client Software What exactly should I look for ?

Files on the local file system Application authentication & authorization Error Handling & Session Management Logic Flaws Decompiling and Analyzing

Page 11: Pentesting Android Apps

Communications Channel Channel between the client and the server (HTTP(s),

3G…)

Testing with HTTP Proxy (Burp, ZAP) to intercept and manipulate data

If the application does not use the HTTP protocol, can use transparent TCP and UDP proxy like Mallory

Page 12: Pentesting Android Apps

Communications Channel

What exactly Should I look For ?

Sniff sensitive information

Replay attack vulnerabilities

Secure transfer of sensitive information

Page 13: Pentesting Android Apps

Server-Side Infrastructure Vulns in the the web servers behind a mobile

application: OWASP TOP 10 Web (SQLI,RCE,CSRF…)

Perform host and service scans on the target system to identify running services : Information gathering (whois,host,dns….) Running services and version (scanning ports) Infrastructure vulnerability scanning

Page 14: Pentesting Android Apps

Environment Setup

Page 15: Pentesting Android Apps

Environment Setup Root Your Device !

Install Xposed + JustTrustMe (SSL Killer) / Android-SSL-TrustKiller

Configure your Proxy (Burp, Zap…)

Requirements: A Computer Java Eclipse (include ADT plugin) – Android Studio Android SDK

Page 16: Pentesting Android Apps

Exploiting Apps Vulnerabilities

Page 17: Pentesting Android Apps

App Analysis Insecure Storage

Capturing Requests

Reversing the Application Package

Logical Flaws / Malicious activities

Page 18: Pentesting Android Apps

Reading Stored Data Android Applications store the data in

/data/data/[PACKAGE_NAME] sharedpreferences

Context.MODE_PRIVATE Context.MODE_WORLD_READABLE Context.MODE_WORLD_WRITEABLE

Files may be stored using the filesystem at /data/data/[PACKAGE_NAME]/files/filename

Storage in the SQLite databases

Page 19: Pentesting Android Apps

Local Data Storage flaws

Page 20: Pentesting Android Apps

Capturing Requests Capture HTTP requests & responses

Parameter Manipulation and Data Tampering.

Set up a proxy in between the server & the client to intercept.

Page 21: Pentesting Android Apps

Capturing Requests

Page 22: Pentesting Android Apps

Reverse Engineering Reverse Engineer the application logic and source code Identify the flaws in the code base to exploit them Look for sensitive data like passwords, encryption algorithms

and keys of DB(s) JD-GUI

Dex2Jar

.apk .dex .class .java

Page 23: Pentesting Android Apps

Reverse Engineering

Page 24: Pentesting Android Apps

Logical Flaws Insecure Login:

Page 25: Pentesting Android Apps

Malicious Activities Identity Decloaking:

Page 26: Pentesting Android Apps

OWASP Top 10 Mobile

Page 27: Pentesting Android Apps

Showtime !

Page 28: Pentesting Android Apps

Developer Tips

Page 29: Pentesting Android Apps

Secure Your App ! Do Not store sensitive data locally (login creds, pwd, DB …) Do Not use weak encryption in your code (base64, md5 …) Do Not send sensitive data in Plain text requests (Token ,

Sessions , logins) Encrypt the stored data If using a webserver protect it against application layer

attacks Sanitize inputs, use prepared statements (protection

against client side injection) Encode your code before producing or at least use an

obfuscator

Page 30: Pentesting Android Apps

Thank You

Q&A ?