appsec eu 2016: automated mobile application security assessment with mobsf

38
Ajin Abraham Automated Mobile Application Security Testing with Mobile Security Framework

Upload: ajin-abraham

Post on 07-Jan-2017

1.315 views

Category:

Mobile


2 download

TRANSCRIPT

Page 1: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Ajin Abraham

Automated Mobile Application Security

Testing with Mobile Security

Framework

Page 2: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

About MeSecurity Engineering @

Next Gen Runtime Application Self Protection (RASP)

Author of OWASP Xenotix XSS Exploit Framework, Mobile Security Framework.Teach Security via https://opsecx.comBlog about Security: http://opensecurity.in

Page 3: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

The Takeaways A FREE and Open Source Security Tool for Mobile App Security Assessment.Mobile App Pentesters/Mobile Malware Analysts - How to make your job easier with MobSF.Developers – Build secure mobile Apps identifying vulnerabilities at all stages of development. (SDLC Integration)Web Pentesters – REST API Fuzzer capable of detecting vulnerabilities like SSRF, XXE, IDOR etc.

Page 4: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

AgendaWhat is MobSF?MobSF Architecture

Static AnalyzerDynamic AnalyzerWeb API Fuzzer

Static Analysis Static Analysis & some StatisticsTop Indian and European Bank Mobile AppsTop Indian and European Wallet Mobile Apps Observations

Dynamic AnalysisDynamic SSL TestingExported Activity TesterChallenges in Dynamic AnalysisDynamic Analysis on Custom VM/ Rooted Android Device.

Web API FuzzerVulnerabilities API Fuzzer detects.Explains the API Fuzzer Logic.

Conclusion

Page 5: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

What is MobSF?Mobile Security Framework is an open source mobile application (Android/iOS) automated pentesting framework capable of performing end to end security testing of mobile Apps.

Android iOS

Page 6: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Hosted in your environment. Your application and data is never send to the cloud.

Page 7: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

MobSF Architecture

Page 8: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Static Analyzer

Mobile Security Framework

INPUT OUTPUT

REPORT

Page 9: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

DemoStatic Analysis & Report

Generation

Page 10: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Static Analysis & Some Statistics

Static Analysis on Top Financial Apps - Criteria

SSL bypass in Native CodeSSL bypass in WebViewWeak CryptoRemote Web View DebuggingHardcoded Secrets

Page 11: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Top Indian Bank Apps Analyzed

Page 12: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Face palm

Page 13: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Top Indian Wallet Apps Analyzed

Page 14: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Top EU Bank Apps Analyzed

Page 15: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Top EU Wallet Apps Analyzed

Page 16: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

ObservationsState of Mobile App Security, Not evolved as Web Security.Most common issue are:

Indian Apps: SSL Bypass in (Both Native Code and WebView)European Apps : Weak Crypto and Hardcoded Secrets

SSL Error bypassed in WebViews are really really bad.

Page 17: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Real-world Exploitation

Page 18: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Dynamic Analyzer

Mobile Security Framework

INPUT Android VMOr

Android DeviceREPORT

OUTPUT

Page 19: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Dynamic Analyzer - Architecture

Dynamic Analyzer

AGENTS

Install and Run APK

HTTP(S) Proxy

Invoke Agents in VMResults

HTTP(S) Traffic

Android VM/Device

Application DataAgent Collected Information

Start HTTP(S) Web Proxy

Page 20: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

DEMO(LockX)

Page 21: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Dynamic SSL TestingDynamically verify if SSL connections are securely implemented.Disable JustTrustMe and Remove MobSF Root CA.If you can still access the decrypted HTTPS Web Traffic then that means the app is bypassing SSL errors.

Page 22: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Exported Activity TesterAndroid Exported Activities.

DEMO

Page 23: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Challenges in Dynamic AnalysisSome Android Apps are built with security in mind.

Anti VM DetectionAnti Root DetectionAnti MITM with Certificate Pinning.Missing Libraries/DependenciesSome Apps / Malwares have sophisticated methods to detect Virtual Machines.

Page 24: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

How to deal with these ChallengesAPI overriding with Xposed Framework

Anti VM Detection Bypass –> Android Blue PillAnti Root Detection Bypass -> RootCloakAnti MITM Certificate Pinning Bypass -> JustTrustMe

APK smali Patching, Custom Xposed ModuleFor sophisticated apps and malware, Use a real device for dynamic analysis.

Page 26: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Web API Fuzzer• Login API• Pin API• Register

API• Logout API

Select• Select Scope URLs of Scan• Select Scope Vulnerabilities

Web API Fuzzing Logic

REPORT

OUTPUT

Web Request

DB

Page 27: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Fuzzing REST APIsWhy most web scanners suck at API Testing?We have knowledge about the application and generic API routes (Login, Logout, Register).So we use more of Whitebox approach than Blackbox approach.Detects vulnerabilities like IDOR, SSRF and XXE.

Page 28: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

What We DetectXXE

SSRF

IDOR

Directory Traversal or Path Traversal

Logical and Session Related

API Rate Limiting

Page 29: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

How we Detect

Page 30: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

SSRF & XXEAPI Server

Web API Fuzzer

MobSF Cloud Server

Fuzz

Poll

Cloud Server: APITester/cloud/cloud_server.py

Page 31: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Insecure Direct Object Reference (IDOR)Without Credentials.

With multiple user credentials (needs two login attempts)

Web API Fuzzer API Server

Request with Auth Header/ Cookie

Request without Auth Header/ Cookie

API ServerWeb API Fuzzer

Request with User1’s Auth Header/Cookie

Repeat the Request with a User2’s Auth Header/Cookie

Page 32: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Session Related ChecksWeb API Fuzzer API Server

Calls Logout APIAccess Resource with expired Auth Header/Cookie

Access Resource with Auth Header/Cookie

Page 33: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Rate LimiterWeb API Fuzzer API ServerBrute force Login API and Register API

Page 34: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

Other ChecksSecurity Headers and Info GatheringDirectory/ Path Traversal

Page 35: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

DEMO

Page 36: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

What's Coming Soon?Windows App Security Analyzer.iOS App Dynamic Analysis with Device.API Fuzzer to support detection of SQLi and RCE.Export Proxy logs to BurpSuite/IronWASP/ZAP

Page 38: AppSec EU 2016: Automated Mobile Application Security Assessment with MobSF

QA

@[email protected]

Thanks & Credits• Sachinraj Shetty• Kamaiah Nadavala• Bharadwaj Machiraju• Yashin Mehboobe• Anto Joseph• Tim Brown• Thomas Abraham• Graphics/Image Owners