Solving brut.android Exception

Written by | Android Security

Solving brut.android exception

Apktool is one of the de-facto tool for Android application reversing.
In the process of penetration testing at Attify, we faced an issue while reversing new Android apps. In most of the cases, the apps that were build using build-tools version 21.x raised few exceptions.
After a little research, we found that apktool was failing to decode arsc file because of large StringPools and even raised IO exception reading few header files.

The exception pointed to brut.androlib.AndroidlibException : Issue 664.

The official apktool sources provided with apktool-rc2 version as a patch for above mentioned issue but somehow the workaround failed to work at our end and generated new types of exceptions. Same was the case with rc3 version.

Well, this blog post is regarding how we solved the issue of apktool, so we won’t be discussing exceptions here in depth.

TL;DR
Without getting much into details of exception and issues, lets focus on how we solved it.

We built apktool from its source which is present at its official website. 
You can get the source code here.

Following are the steps : 

-Download the source code and extract its content.
-Traverse into the extracted folder. The contents should be as shown below:

Screen Shot 2014-12-21 at 3.24.58 AM

-Build source,

Once the build is successful, traverse to libs folder

-Rename the file from apktool-<version>.jar to  apktool.jar

-Give execute permission to apktool.jar

-Place the apktool.jar  to ‘bin‘  directory along with apktool config file.  (Note: bin folder location may depend on operating systems used.)
For example, here is the command for Mac OS X.

You can now continue to enjoy with your reversing and auditing fun. 🙂

Last modified: March 26, 2017

Leave a Reply

Your email address will not be published. Required fields are marked *