Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Mobile App Reverse Engineering
  • Table Of Contents Toc
  • Feedback & Rating feedback
Mobile App Reverse Engineering

Mobile App Reverse Engineering

By : Mishra
4.3 (6)
close
close
Mobile App Reverse Engineering

Mobile App Reverse Engineering

4.3 (6)
By: Mishra

Overview of this book

Mobile App Reverse Engineering is a practical guide focused on helping cybersecurity professionals scale up their mobile security skills. With the IT world’s evolution in mobile operating systems, cybercriminals are increasingly focusing their efforts on mobile devices. This book enables you to keep up by discovering security issues through reverse engineering of mobile apps. This book starts with the basics of reverse engineering and teaches you how to set up an isolated virtual machine environment to perform reverse engineering. You’ll then learn about modern tools such as Ghidra and Radare2 to perform reverse engineering on mobile apps as well as understand how Android and iOS apps are developed. Next, you’ll explore different ways to reverse engineer some sample mobile apps developed for this book. As you advance, you’ll learn how reverse engineering can help in penetration testing of Android and iOS apps with the help of case studies. The concluding chapters will show you how to automate the process of reverse engineering and analyzing binaries to find low-hanging security issues. By the end of this reverse engineering book, you’ll have developed the skills you need to be able to reverse engineer Android and iOS apps and streamline the reverse engineering process with confidence.
Table of Contents (13 chapters)
close
close
1
Section 1: Basics of Mobile App Reverse Engineering, Common Tools and Techniques, and Setting up the Environment
4
Section 2: Mobile Application Reverse Engineering Methodology and Approach
8
Section 3: Automating Some Parts of the Reverse Engineering Process

iOS application fundamentals

Similar to Android, iOS applications also come in a specific zipped format called IPA, or an iOS App Store Package. iOS application packages can also be renamed by changing the extension to ZIP and then the components can be extracted, though the components of an iOS application package differ from those of an Android one.

iOS apps are mainly built using Objective-C and Swift, both of which can be disassembled using a disassembler such as Hopper or Ghidra. In Objective-C applications, methods are called via dynamic function pointers, which are resolved by name during runtime. These names are stored intact in the binary, making the disassembled code more readable. Unlike Android, in iOS, the application code is compiled to machine code that can be analyzed using a disassembler.

The following are the major components of an iOS application package:

  • Info.plist: Similar to the Android manifest file in an APK, this information property list file contains key-value pairs that specify essential runtime-configuration information for the application. The iOS operating system relies on the presence of this file to identify relevant information about the application and related files.
  • Executable: The file that runs on the device, containing the application's main entry point and code that was statically linked to the application target.
  • Resource files: Files that are required by the executable file, and are required for the application to properly run. This may contain images, nib files, string files, and configuration files.

The following diagram illustrates the iOS architecture overview:

Figure 1.13 – iOS architecture

Figure 1.13 – iOS architecture

Let's see how to create a simple hello world application for iOS and then unzip it and look at its components:

  1. iOS apps are developed using Xcode. Download the latest version of Xcode from the App Store on Mac.
Figure 1.14 – Creating an Xcode project

Figure 1.14 – Creating an Xcode project

  1. On the next screen, choose the default App template for your new project:
Figure 1.15 – Selecting the project template

Figure 1.15 – Selecting the project template

  1. On the next screen, provide a product name (any name you like), select a team, and provide an organization identifier. To create and export an IPA from Xcode, you need to have an Apple Developer license:
Figure 1.16 – Providing project details

Figure 1.16 – Providing project details

  1. Select a location to save the project on your computer.

Xcode will now create a simple hello world application and you will see the following default code in the Xcode window:

Figure 1.17 – Project details

Figure 1.17 – Project details

  1. Now you can try and run this app on one of the built-in iOS simulators. To do so, select one of the available simulators (just click on the name of simulator from top bar, and a list will open) as shown in the following screenshot:
Figure 1.18 – Selecting a simulator

Figure 1.18 – Selecting a simulator

The app should run on the selected simulator:

Figure 1.19 – App running on the simulator

Figure 1.19 – App running on the simulator

  1. Now, let's export the IPA from this Xcode project. To do so, select the Any iOS Device (arm64) option from the simulator options.
  2. Then, go to Product | Archive and select the Distribute App option:
Figure 1.20 – Exporting the application package

Figure 1.20 – Exporting the application package

  1. On the next screen, select Development and leave the options on the subsequent screens at their defaults.
  2. Finally, you will be able to export the IPA together with some other compiled project files:
Figure 1.21 – Exporting the application package (cont.)

Figure 1.21 – Exporting the application package (cont.)

  1. Once the IPA is exported, simply change the extension of the file to .zip:
Figure 1.22 – Diagram explaining the application (IPA) extraction process via renaming

Figure 1.22 – Diagram explaining the application (IPA) extraction process via renaming

  1. Use any tool to unzip the file and extract its contents:
    # unzip MARE-Chapter-1.zip

The following screenshot shows the results for reference:

Figure 1.23 – Extracting the content of the IPA after renaming it to ZIP

Figure 1.23 – Extracting the content of the IPA after renaming it to ZIP

  1. Go into the Payload directory and then inside the MobileAppReverseEngg-App-1.app file:
    # cd Payload 
    # cd MobileAppReverseEngg-App-1.app
  2. Let's analyze the components inside the IPA and compare it with the list here (iOS application fundamentals):
Figure 1.24 – Extracted content of the IPA

Figure 1.24 – Extracted content of the IPA

The following diagram illustrates the process of reverse engineering an iOS application:

Figure 1.25 – Overview of the reverse engineering process of an IPA

Figure 1.25 – Overview of the reverse engineering process of an IPA

Have a look at Figure 1.3 to understand how a disassembled binary looks in Hopper disassembler.

Visually different images
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Mobile App Reverse Engineering
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon