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.

[![Screen Shot 2014-12-21 at 4.16.26 AM](https://blog.attify.com/content/images/2014/12/Screen-Shot-2014-12-21-at-4.16.26-AM.png)](https://blog.attify.com/content/images/2014/12/Screen-Shot-2014-12-21-at-4.16.26-AM.png)source : [https://code.google.com/p/android-apktool/issues/detail?id=664](https://code.google.com/p/android-apktool/issues/detail?id=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,

./gradlew build fatJar

Once the build is successful, traverse to libs folder

./brut.apktool/apktool-cli/build/libs/

-Rename the file from apktool-.jar to apktool.jar

-Give execute permission to apktool.jar

sudo chmod +x 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.

sudo mv apktool.jar /usr/bin/

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



comments powered by Disqus
Tags
Android android application security android hands on security and exploitation training android security Apktool application auditing application security auditing appsec usa appwatch attify attify badge attify training binwalk blackberry pentesting blackhat ble BLE hacking and exploitation BLE sniffing box brut Exception chroot cloud based mobile application security scanner consulting CTF Damn Vulnerable iOS App devops dumping memory embedded hacking exploitation exploiting smart devices Firmware hacking frida hackfest hacking smart devices how to secure iot device IDA internet of things Internet of Things Security ios application security ios security iot iot device IoT Exploitation iot hacking iot pentest iot pentesting iot security iot security training iotsecurity jtag jtag debugging mobile app mobile application security mobile application security testing mobile security ninja recon technique offensive iot exploitation ola cabs owasp owasp appsec penetration testing pentesting pentesting mobile apps powerofcommunity PrinterSecurity qemu quizup radio communication protocol radio coomunication Reversing sdr secure coding guidelines security security issue security services security training security vulnerability smart devices social networking spi threat modeling training uart vulnerability writeups xposed hooking zigbee zigbee exploitation zigbee security zwave firmware reverse engineering firmware emulation firmware analysis toolkit firmadyne getting started with firmware hacking iot penetration testing

Instagram