reversing an ios app - itsecx.fhstp.ac.at · what you need to develop an ios app macos xcode some...

36
Reversing an iOS App With Threat Modeling Insights.

Upload: others

Post on 25-Jul-2020

0 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Reversing an iOS App

With Threat Modeling Insights.

Page 2: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

2

Page 3: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

In today‘s Presentation…

Mobile Penetration Testing Basics

Mobile OWASP Top 10 2016

Software Engineering of an iOS App

Reversing the iOS App

How to prevent Security Issues with Threat Modeling

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at3

Page 4: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Mobile Penetration Testing Basics

Page 5: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

(SECURE) Software Development Life Cycle

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at5

Page 6: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

DevSecOps

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at6

Page 7: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Phases of Mobile Penetration Tests

Preparation

Intelligence Gathering

Mapping the Application

Exploitation

Reporting

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at7

Page 8: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Testing Principles

White-Box Testing

Black-Box Testing

Gray-Box Testing

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at8

Page 9: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

SAST VS. DAST

• Manual Code Review• Automated Source Code Analysis

Static Source Code Analysis

• Automated Scanning Tools à FALSE-POSITIVES!

• Clipboard• Fuzzing à “Spray and Pray!“• Penetration Testing

Dynamic Source Code Analysis

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at9

Page 10: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

What Tools and Gear do you need?

macOS

Xcode and its simulator

Some jailbroken iPhones…

USB Cable for Connection

Cydia, Needle, Frida and a Reverse Enginnering Tool (e.g. Hopper), Burp Suite (Pro), Wireshark

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at10

Page 11: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

OWASP Mobile Top 10 2016

Page 12: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

OWASP Mobile Top 10 – Part 1

M1 – Improper Plattform Usage

M2 – Insecure Data Storage

M3 – Insecure Communication

M4 – Insecure Authentication

M5– Insecure Cryptography

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at12

Page 13: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

OWASP Mobile Top 10 – Part 2

M6 – Insecure Authorization

M7 – Client Code Quality

M8 – Code Tampering

M9 – Reverse Engineering à The all time winner

M10 – Extraneous Functionality

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at13

Page 14: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Software Engineering of an iOS App

Page 15: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Types of Apps

Native Apps

Web Apps

Hybrid Apps

Progressiv Web Apps

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at15

Page 16: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

What you need to develop an iOS App

macOS

Xcode

Some kind of an idea

A tiny little bit of software engineering skills

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at16

Page 17: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Coding our first iOS App in Swift

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at 17

Page 18: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Deploying our first iOS App to the Simulator

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at 18

Page 19: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Testing our first iOS App in the Simulator

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at 19

Page 20: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Shipping to the Customer JBecause it seems really secure!

Page 21: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Hang on a minute!„There is something missing, is not it?“

„What is this security thing? It is overrated^^“

21

Page 22: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Reversing the iOS App

”Reversing will always win the fight”

Page 23: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Preparing the IPADipl.-Ing. Daniel Mrskos, BSc | snapsec.at 23

Page 24: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Unzip the IPA for HopperDipl.-Ing. Daniel Mrskos, BSc | snapsec.at 24

Page 25: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Loading the Binary in Hopper

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at 25

Page 26: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Searching for the string „wrong“

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at 26

Page 27: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Examing data stored as CString

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at 27

Page 28: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Finding the unlock key stored in plain text

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at 28

Page 29: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Trying out the found unlock key J

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at 29

Page 30: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Let’s take a look at the Code to identify the Issue

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at 30

Page 31: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

How to prevent Security Issues with Threat

Modeling

31

Page 32: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Drawing a Data Flow Diagram of the Application

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at32

Page 33: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Using STRIDE per Interaction to Identify Threats in our Scenario

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at33

Interaction S T R I D E

User sends key X X X X

Checking the plaintext key

X

Design Issue found: Key is stored in plaintext!

Page 34: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Using Attack Libraries to identify Threats as well

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at34

Page 35: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Threat Modeling combined with iOS App Development

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at35

Page 36: Reversing an iOS App - itsecx.fhstp.ac.at · What you need to develop an iOS App macOS Xcode Some kind of an idea A tiny little bit of software engineering skills 16 Dipl.-Ing. Daniel

Thanks for your attention!

• #[email protected]

• #InteresstedInMobilePentesting?OWASP MSTG

• #ThanksToFHSTPfhstp.ac.at

Dipl.-Ing. Daniel Mrskos, BSc | snapsec.at