Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Android Security Cookbook
Android Security Cookbook

Android Security Cookbook: Practical recipes to delve into Android's security mechanisms by troubleshooting common vulnerabilities in applications and Android OS versions

eBook
€20.98 €29.99
Paperback
€36.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Android Security Cookbook

Chapter 2. Engaging with Application Security

In this chapter, we will cover the following recipes:

  • 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

Introduction

In this chapter, we are going to see some components of the Android security architecture in action by directly engaging with them, specifically those focused on protecting applications. "You never really understand anything until you get your hands dirty." This is what this chapter tries to inspire; actually getting down and dirty with some of the security mechanisms, dissecting them, and really getting to know what they are all about.

We're going to cover just the bare minimum here, the tips and tricks that'll get you the information you need from an application, should you ever want to reverse engineer it or perform a pervasive hands-on security assessment for Android applications, or if you're just purely interested in finding out more about application security.

Inspecting application certificates and signatures

Application certificates are what developers use to declare their trust in the applications they publish to the application market. This is done by declaring their identities and associating them to their application(s) cryptographically. Application signatures make sure that no application can impersonate another by providing a simple and effective mechanism to determine and enforce the integrity of Android applications. It is a requirement that all applications be signed with certificates before they are installed.

Android application signing is a repurposing of JAR signing. It works by applying a cryptographic hash function to an application's contents. We will soon see exactly which of the contents in the APK files are hashed. The hashes are then distributed with a certificate that declares the developer's identity, associating it to the developer's public key and effectively, his/her private key, since they are related...

Signing Android applications

All Android applications are required to be signed before they are installed on an Android device. Eclipse and other IDEs pretty much handle application signing for you; but for you to truly understand how application signing works, you should try your hand at signing an application yourself using the tools in the Java JDK and Android SDK.

First, a little background on application signing. Android application signing is simply a repurposing of the JAR signing. It has been used for years to verify the authenticity of Java class file archives. Android's APK files aren't exactly like JAR files and include a little more metadata and resources than JAR files; so, the Android team needed to gear the JAR signing to suit the APK file's structure. They did this by making sure that the extra content included in an Android application forms part of the signing and verification process.

So, without giving away too much about application signing, let's...

Verifying application signatures

In the previous recipes, we walked through how applications are signed and how to generate keys securely to sign them. This recipe will provide details on how application signatures are verified. Being able to do this "by hand" is pretty important because it not only gives you insight into how verification actually works, but also serves as a gateway to deeper introspection of cryptographic application security.

Getting ready

To be able to perform this recipe, you will need the following:

  • The JDK
  • A sample signed application to verify

That's about all that you need for this one. Let's get going!

How to do it...

To verify application signatures, you will need to perform the following steps:

  1. The Java JDK has a tool called jarsigner that will be able to handle all of the hard labor; all you need to do is execute the following command:
    jarsigner –verify –verbose [path-to-your-apk]
    
  2. All you need to do now is look for the jar verified string...

Inspecting the AndroidManifest.xml file

The application manifest is probably the most important source of information for Android application security specialists. It contains all of the information regarding an application's permissions and which components form part of an application, and it gives us quite some details about how these components will be allowed to interact with the rest of the applications on your platform. I'm going to use this recipe as a good excuse to talk about the application manifest, how it's structured, and what each component in the sample manifest means.

Getting ready

Before you can get going, you will need to have the following software:

  • WinZip for Windows
  • The Java JDK
  • A handy text editor; usually Vi/Vim does the trick, but Emacs, Notepad++, and Notepad are all cool; we don't need anything fancy here
  • The Android SDK (no surprise here!)

You may also need to go get something called apktool; it makes decoding the AndroidManifest.xml file really...

Introduction


In this chapter, we are going to see some components of the Android security architecture in action by directly engaging with them, specifically those focused on protecting applications. "You never really understand anything until you get your hands dirty." This is what this chapter tries to inspire; actually getting down and dirty with some of the security mechanisms, dissecting them, and really getting to know what they are all about.

We're going to cover just the bare minimum here, the tips and tricks that'll get you the information you need from an application, should you ever want to reverse engineer it or perform a pervasive hands-on security assessment for Android applications, or if you're just purely interested in finding out more about application security.

Inspecting application certificates and signatures


Application certificates are what developers use to declare their trust in the applications they publish to the application market. This is done by declaring their identities and associating them to their application(s) cryptographically. Application signatures make sure that no application can impersonate another by providing a simple and effective mechanism to determine and enforce the integrity of Android applications. It is a requirement that all applications be signed with certificates before they are installed.

Android application signing is a repurposing of JAR signing. It works by applying a cryptographic hash function to an application's contents. We will soon see exactly which of the contents in the APK files are hashed. The hashes are then distributed with a certificate that declares the developer's identity, associating it to the developer's public key and effectively, his/her private key, since they are related semantically....

Left arrow icon Right arrow icon

Key benefits

  • Analyze the security of Android applications and devices, and exploit common vulnerabilities in applications and Android operating systems
  • Develop custom vulnerability assessment tools using the Drozer Android Security Assessment Framework
  • Reverse-engineer Android applications for security vulnerabilities
  • Protect your Android application with up to date hardening techniques

Description

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.

Who is this book 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.

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

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Dec 24, 2013
Length: 350 pages
Edition : 1st
Language : English
ISBN-13 : 9781782167167
Vendor :
Google
Category :
Languages :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Dec 24, 2013
Length: 350 pages
Edition : 1st
Language : English
ISBN-13 : 9781782167167
Vendor :
Google
Category :
Languages :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 106.97
Android Application Security Essentials
€36.99
Android Security Cookbook
€36.99
Asynchronous Android
€32.99
Total 106.97 Stars icon

Table of Contents

10 Chapters
1. Android Development Tools Chevron down icon Chevron up icon
2. Engaging with Application Security Chevron down icon Chevron up icon
3. Android Security Assessment Tools Chevron down icon Chevron up icon
4. Exploiting Applications Chevron down icon Chevron up icon
5. Protecting Applications Chevron down icon Chevron up icon
6. Reverse Engineering Applications Chevron down icon Chevron up icon
7. Secure Networking Chevron down icon Chevron up icon
8. Native Exploitation and Analysis Chevron down icon Chevron up icon
9. Encryption and Developing Device Administration Policies Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.8
(6 Ratings)
5 star 83.3%
4 star 16.7%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Philip Arad Mar 27, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Android has quickly become one of the most popular mobile operating system with more than 46% share, not only to users but also developers and companies.Companies that are looking to be fully adapted to the mobile world, develop their own applications on the Android platform.These applications have seen massive growth in capability and complexity and became quite popular to malicious adversaries.Android users and developers express a need to be constantly aware of their mobile security risks and, because of this need, mobile security and risk assessment specialists and security engineers are in high demand.To address this problem efficiently, I recommend reading the book 'Android Security Cookbook' from 'Packt Publishing' (see[.......] )'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.'Android Security Cookbook' is aimed at anyone who is interested in 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.
Amazon Verified review Amazon
Eli Apr 22, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book was a great Introduction to almost every aspect of Android Security. It covered all bases and didn't leave out any major topics (SQL Injection, ensuring Permissions are set correctly, and decompiling just to name a few). I would say that the prerequisites for reading this book are the basics of android and some Java programming. The author clearly explains every concept, describes how to accomplish the goal, and then explains why we accomplish the goal in the way that we did. I would recommend this book for anyone that is new to Android Security.
Amazon Verified review Amazon
Aditya Gupta Apr 09, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Being a Android Security Researcher myself, I was expecting a lot from this book. And to my surprise, this book has all the elements needed in an Android Security book, which is required for learning in depths of Android Security.I personally liked the Native Exploitation chapter the most, as it goes much beyond the normal application level, and gives you a clear picture of how exactly exploits work.If you are planning to get into Android Application Auditing, this is one of the must have books for you. Nothing less than what I was expected. Surely deserves a 5/5 rating.
Amazon Verified review Amazon
Venkata subramanian c. CVS. Jun 18, 2015
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Introduction itselfe is appealing, will submit my full review after completestudy.CVS.
Amazon Verified review Amazon
Benjamin Watson Mar 26, 2014
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book has been a great resource for me when needing to quickly up my IQ in assessing Android mobile applications. The authors have done a great job a laying out many resources and techniques. I would recommend this book to anyone who wants a solid introduction into Android Security concepts.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.