Mobile Application Security
Mobile Application Security
Overview
Security leaks and confidential data disclosure from web and mobile apps are
quite common today. With the increasing number of technologically rich mobile
applications hitting the market, mobile phones have become the new target for
hackers.
Android is one of the most popular mobile phone operating systems and is
claimed to hold more than 36% of the market share. Due to its popularity,
Android is more prone to attacks.
Objective
This white paper elucidates the necessity of security testing mobile
applications, the major threats that mobile applications are susceptible to,
methodologies and tools used for mobile application security testing, best
practices to create a robust mobile app, and some important guidelines for
users and developers.
Audience
Testers who want to specialize in mobile application security testing.
Developers can refer to this white paper to develop secure applications.
Mobile phone users can understand threats and learn how to
protect themselves from attacks.
Scope
The report covers security testing of Android applications. It does not include
mobile application development, application installation or similar areas.
What is Mobile Application Security
Testing?
Mobile phone usage is growing by the day. Unlike the situation a decade ago,
today, people feel handicapped and uncomfortable without their mobile device
close at hand. There have been great advances in mobile computing. People can
download apps that help them socialize, keep fit, get directions, transact, shop,
and much more. There are millions of mobile applications available in app stores
that make our simple life simpler.
Amidst all the great things that have been accomplished in the mobility space,
there is a global community of hackers who have been watching the mobile
space closely. They use newer and bolder techniques to break into mobiles
and applications, so app developers need to be cautious.
While there’s one exact carry-over from the 2014 top 10 mobile risks list,
the 2016 top 10 mobile risks list is mainly different in terms of the categories
break down. For example, in the 2016 list, one of the items from the 2014 list
was removed and two new risks were added. They also split some categories in
half to address them separately.
The latest OWASP mobile top 10 list ranks improper platform usage as the
leading mobile security vulnerability. Whether you’re an Android user or an iOS
customer, each of these platforms are expected to adhere to certain
developmental guidelines for security purposes. However, apps may
unintentionally violate these published guidelines, best practices, or goof up in
their implementation process. That is what this first mobile security risk talks
about.
This threat refers to the misuse of any platform feature of the Android or iOS
operating system or failure to incorporate platform security controls. This
includes issues concerning improper use of security controls and platform
features that are a part of the mobile operating system, such as:
Misuse of the iOS Touch ID feature, which can result in unauthorized access to
the device.
Incorrect use of the iOS Keychain for instance by storing session keys in the app
local storage,
Requesting excessive or wrong platform permissions,
Android intents (used to request an action from another app component) that
are marked public may reveal sensitive information or permit unauthorized
execution.
Restricting apps from communicating with each other, limit access, implement
restrictive file permissions, etc.
Applying the most restrictive protection class for iOS keychains and adopt best
practices to avoid weak implementation of any controls.
M2. Insecure Data Storage
Next on the OWASP mobile top 10 list is insecure data storage. Your mobile
device may get lost or stolen and land in the hands of an adversary. Or a piece of
malware, acting on the attacker’s behalf, may execute on the device, and the
attacker might be able to exploit vulnerabilities that leak personal information
and gain access to sensitive data.
While it isn’t always feasible to have apps that don’t store data, it is crucial to
store that data securely in a place that won’t be accessible to another app or an
individual jailbreak or rooting a mobile device is sufficient to dodge encryption
protection, and dev teams must never assume that attackers won’t have access
to filesystems if they’re easily accessible.
Assess whether encryption is applied effectively and how the encryption keys are
protected.
Implement technologies to harden the code against tampering by using
obfuscation, protection against buffer overflows and so on,
Avoid storing/caching data where feasible, and
Deploy sound authentication and authorization checks.
Deploy SSL/TLS certificates from trusted certificate authorities (CA) to secure all
communication channels.
Alert users if an invalid SSL/TLS certificate is detected or if the certificate chain
verification process fails.
1. The underlying algorithm used for encryption and decryption might be weak, or
2. The cryptographic process itself has implementation flaws.
Broken cryptography in mobile apps can be the result of one of several factors.
This list of potential causes includes:
An attacker may pass crafted inputs to function calls made within an app in an
attempt to execute them or observe the application’s behaviour. It may lead to
degradation of performance, increased memory usage, etc. Note that the
mistakes in code need to be fixed in a localized way since they arise on the
mobile client and are different from server-side coding errors. There could be
code-level mistakes in mobile apps that may lead to issues such as:
Format-string vulnerabilities,
Buffer overflows,
Integration with insecure third-party libraries,
Remote code execution
Several apps rely on third-party libraries to build their applications, which often
contain bugs and are not well tested. These issues are outside the control of the
app developer since they don’t own the code. More often than not with code-
level bugs, the solution is to rewrite some of the code running on the device. But
what else can you do?
Test for buffer overflows, memory leaks, etc. using automated tools, rely on
source code reviews, and write code that’s easy to understand and well
documented.
Use consistent coding patterns across the organization.
M8. Code Tampering
App stores sometimes contain tampered versions of mobile apps. An example of
a modified app is where a hacker modifies the app’s binary to include malicious
content, install a backdoor, etc. Attackers can re-sign these counterfeit apps and
publish the modified version onto third-party app stores. They can also deliver
them to a victim directly via a phishing attack to trick them into downloading the
app.
The app must be able to identify any code integrity violation (if additional code
has been added or modified) and react suitably to it at runtime. Using something
like a code signing certificate could help to let users know about the code
alterations.
Implement anti-tamper techniques that prevent illicit apps from executing via
implementation of checksums, digital signatures, code hardening, and other
validation methods.
Examine the mobile app’s configuration settings to detect any hidden switches.
Ensure that the logs don’t hold exceedingly descriptive statements about
backend systems.
With static analysis, the business logic and the security of the application are
covered. The code reviewer tests the application for each taint location in the
application.
Hackers attack an application with the intention to derive certain value. The
more valuable the target is, the more prone it is to attacks. For developers, the
data contained in the application is valuable. Every piece of data that the
application handles is significant and developers must handle it with care.
Protection of data should be one of the primary goals of a mobile developer.
Qasat
Qasat is an Android static analyzer. The application helps code reviewers
decompose an Android Package File (APK) and understand the application
better. The analyzer decomposes an APK file into its components. The assets in
the applications are enumerated as lists. Qasat also enumerates code
fragments that are considered sensitive. Qasat allows the user to save the
code into a location of their choice. This helps the code reviewer to review the
code.
Android Emulator
Android Emulator is an application that emulates and tests virtual android
devices. Applications can be installed on virtual machines and used as if they
are installed on a real device. Emulator is free to download and easy to install.
The emulator is also included in the Android SDK.