Who This Book Is For

"Android Security Cookbook" is aimed at anyone who is curious about Android app security and wants to be able to take the necessary practical measures to protect themselves; this means that Android application developers, security researchers and analysts, penetration testers, and generally any CIO, CTO, or IT managers facing the impeding onslaught of mobile devices in the business environment will benefit from reading this book.

Table of Contents

Chapter 1: Android Development Tools

Introduction

Installing the Android Development Tools (ADT)

Installing the Java Development Kit (JDK)

Updating the API sources

Alternative installation of the ADT

Installing the Native Development Kit (NDK)

Emulating Android

Creating Android Virtual Devices (AVDs)

Using the Android Debug Bridge (ADB) to interact with the AVDs

Copying files off/onto an AVD

Installing applications onto the AVDs via ADB

Chapter 2: Engaging with Application Security

Introduction

Inspecting application certificates and signatures

Signing Android applications

Verifying application signatures

Inspecting the AndroidManifest.xml file

Interacting with the activity manager via ADB

Extracting application resources via ADB

Chapter 3: Android Security Assessment Tools

Introduction

Installing and setting up Santoku

Setting up drozer

Running a drozer session

Enumerating installed packages

Enumerating activities

Enumerating content providers

Enumerating services

Enumerating broadcast receivers

Determining application attack surfaces

Launching activities

Writing a drozer module – a device enumeration module

Writing an application certificate enumerator

Chapter 4: Exploiting Applications

Introduction

Information disclosure via logcat

Inspecting network traffic

Passive intent sniffing via the activity manager

Attacking services

Attacking broadcast receivers

Enumerating vulnerable content providers

Extracting data from vulnerable content providers

Inserting data into content providers

Enumerating SQL-injection vulnerable content providers

Exploiting debuggable applications

Man-in-the-middle attacks on applications

Chapter 5: Protecting Applications

Introduction

Securing application components

Protecting components with custom permissions

Protecting content provider paths

Defending against the SQL-injection attack

Application signature verification (anti-tamper)

Tamper protection by detecting the installer, emulator, and debug flag

Removing all log messages with ProGuard

Advanced code obfuscation with DexGuard

Chapter 6: Reverse Engineering Applications

Introduction

Compiling from Java to DEX

Decompiling DEX files

Interpreting the Dalvik bytecode

Decompiling DEX to Java

Decompiling the application's native libraries

Debugging the Android processes using the GDB server

Chapter 7: Secure Networking

Introduction

Validating self-signed SSL certificates

Using StrongTrustManager from the OnionKit library

SSL pinning

Chapter 8: Native Exploitation and Analysis

Introduction

Inspecting file permissions

Cross-compiling native executables

Exploitation of race condition vulnerabilities

Stack memory corruption exploitation

Automated native Android fuzzing

Chapter 9: Encryption and Developing Device Administration Policies

Introduction

Using cryptography libraries

Generating a symmetric encryption key

Securing SharedPreferences data

Password-based encryption

Encrypting a database with SQLCipher

Android KeyStore provider

Setting up device administration policies

What You Will Learn

Set up the Android development tools and frameworks

Engage in Application security concepts

Use the Drozer Android Security Assessment Framework

Customize and develop your own plugins for the Drozer Framework

Exploit, enumerate, and analyze common application level exploits

Protect applications from common vulnerabilities and exploits

Reverse-engineer applications for common code level vulnerabilities

Secure application networking, SSL/TLS

Encryption to protect application data

In Detail

Android Security Cookbook discusses many common vulnerabilities and security related shortcomings in Android applications and operating systems. The book breaks down and enumerates the processes used to exploit and remediate these vulnerabilities in the form of detailed recipes and walkthroughs.

The book also teaches readers to use an Android Security Assessment Framework called Drozer and how to develop plugins to customize the framework.

Other topics covered include how to reverse-engineer Android applications to find common vulnerabilities, and how to find common memory corruption vulnerabilities on ARM devices. In terms of application protection this book will show various hardening techniques to protect application components, the data stored, secure networking. In summary, Android Security Cookbook provides a practical analysis into many areas of Android application and operating system security and gives the reader the required skills to analyze the security of their Android devices.

Authors

Keith Makan

Keith Makan is the lead author of Android Security Cookbook, Packt Publishing. He is an avid computer security enthusiast and a passionate security researcher. Keith has published numerous vulnerabilities in Android applications, WordPress plugins, and popular browser security software such as Firefox's NoScript and Google Chrome's XSS Auditor. His research has also won him numerous listings on the Google Application Security Hall of Fame. Keith has been working as a professional security assessment specialist, penetration tester, and security advisory for over 2 years.

Scott Alexander-Bown

Scott Alexander-Bown is an accomplished developer with experience in financial services, software development, and mobile app agencies. He lives and breathes Android, and has a passion for mobile app security.

In his current role as senior developer, Scott specializes in mobile app development, reverse engineering, and app hardening. He also enjoys speaking about app security and has presented at various conferences for mobile app developers internationally.

Table of Contents

Chapter 1: Android Development Tools

Introduction

Installing the Android Development Tools (ADT)

Installing the Java Development Kit (JDK)

Updating the API sources

Alternative installation of the ADT

Installing the Native Development Kit (NDK)

Emulating Android

Creating Android Virtual Devices (AVDs)

Using the Android Debug Bridge (ADB) to interact with the AVDs

Copying files off/onto an AVD

Installing applications onto the AVDs via ADB

Chapter 2: Engaging with Application Security

Introduction

Inspecting application certificates and signatures

Signing Android applications

Verifying application signatures

Inspecting the AndroidManifest.xml file

Interacting with the activity manager via ADB

Extracting application resources via ADB

Chapter 3: Android Security Assessment Tools

Introduction

Installing and setting up Santoku

Setting up drozer

Running a drozer session

Enumerating installed packages

Enumerating activities

Enumerating content providers

Enumerating services

Enumerating broadcast receivers

Determining application attack surfaces

Launching activities

Writing a drozer module – a device enumeration module

Writing an application certificate enumerator

Chapter 4: Exploiting Applications

Introduction

Information disclosure via logcat

Inspecting network traffic

Passive intent sniffing via the activity manager

Attacking services

Attacking broadcast receivers

Enumerating vulnerable content providers

Extracting data from vulnerable content providers

Inserting data into content providers

Enumerating SQL-injection vulnerable content providers

Exploiting debuggable applications

Man-in-the-middle attacks on applications

Chapter 5: Protecting Applications

Introduction

Securing application components

Protecting components with custom permissions

Protecting content provider paths

Defending against the SQL-injection attack

Application signature verification (anti-tamper)

Tamper protection by detecting the installer, emulator, and debug flag

Alerts & Offers

Series & Level

We understand your time is important. Uniquely amongst the major publishers, we seek to develop and publish the broadest range of learning and information products on each technology. Every Packt product delivers a specific learning pathway, broadly defined by the Series type. This structured approach enables you to select the pathway which best suits your knowledge level, learning style and task objectives.

Learning

As a new user, these step-by-step tutorial guides will give you all the practical skills necessary to become competent and efficient.

Beginner's Guide

Friendly, informal tutorials that provide a practical introduction using examples, activities, and challenges.

Essentials

Fast paced, concentrated introductions showing the quickest way to put the tool to work in the real world.

Cookbook

A collection of practical self-contained recipes that all users of the technology will find useful for building more powerful and reliable systems.

Blueprints

Guides you through the most common types of project you'll encounter, giving you end-to-end guidance on how to build your specific solution quickly and reliably.

Mastering

Take your skills to the next level with advanced tutorials that will give you confidence to master the tool's most powerful features.

Starting

Accessible to readers adopting the topic, these titles get you into the tool or technology so that you can become an effective user.

Progressing

Building on core skills you already have, these titles share solutions and expertise so you become a highly productive power user.