Sitemap
mpast

mpast

Application Security Engineer

Android Code Security — Part I

3 min readMay 2, 2021

--

To begin with, we are going to enumerate the different parts of the architecture in Android.

Press enter or click to view image in full size
Android Architecture
  • Linux Kernel, which is an interface that provides a way to interact between the OS and the hardware of the device.
  • Libraries, (C/C++ Native) for the following capabilities: 3D/2D, media (mp3, photos), SSL, sqlite…
  • Runtime, core runtime libraries that provide most of the functionality of the Java programming language,and Dalvik VM/ART, to execute the applications.
  • Java Framework, all the Android OS functions are available using APIs in Java. These contains the different components thatare used to develop Android Applications: Content Providers, Activities…
  • System Apps, are included by default in the devices, they provide esential capabilities that can be accessed by the applications developed, like SMS, Camera, Browser…

Types of Android Applications

  • Native apps: written for the specific platform. In Android is in Java or Kotlin.
Native apps

Some of the advantages of native apps are:

Advantages of native apps
  • Hybrid apps: written in multiple platforms.
Hybrid apps

Some of the advantages of hybrid apps are:

Advantages of hybrid apps

How are Android Apps

Android apps are developed in Java and bytecode-compiled into a DEX format.

Java -> DEX

This bytecode is interpreted by Android Virtual Machine to be rendered in the device.

  • Android <= 4.4 (Kitkat) : Dalvik Virtual Machine (DVM)
  • Android 5 (Lollipop): Android Runtime (ART)
Press enter or click to view image in full size
Dalvik -> DEX -> App

Components of an Android App

An Android App is a file with .APK extension. This is essentially a compressed file with a determined structure.

Press enter or click to view image in full size
Components of Android APK
  • Manifest
  • Signatures
  • Assets
  • Resources
  • Compiled resources
  • Native libraries
  • Dalvik Bytecode

Security Assessment for Android Apps

To end this post, there are two types of security assesments to have full knowledge of the security of an application:

  • Static analysis: source code analysis.
  • Dinamic analysis: requires execution of the application.

In an Android security assesment, there are the following steps:

  • Obtain the application to analyze (apk).
  • Reversing (decompilation of the code).
  • Code analysis.
  • Dinamic analysis.
  • Results and triage: obtain the different vulnerabilities and remove the false positives (not an issue).
  • Results elaboration and report.
Press enter or click to view image in full size
Security Assesment of an Android Application

In the next post, there will be an explanation of each of the steps.

Get mpast’s stories in your inbox

Join Medium for free to get updates from this writer.

Also, I will give you a link of an application that performs all the security assesment and malware analysis of an Android Application automatically.

https://github.com/mpast/mobileAudit

--

--

mpast
mpast

Application Security Engineer