I came across an Android application which runs normally on the device but raised an error when I tried to unzip its APK - it requires me to provide the password in order to decompress the APK file. After doing some research, I realize BlueBlox - a security group has worked on this problem long ago, and they called it DalvikBytecodeTampering

Basically, the first flag_bit is changed from 0 to 1, which makes the unzip utility (for example, winrar) think that the file is encrypted (protected with password) while it is actually not.

I would like to ask: how can one change the last flag bit of files (for example, AndroidManifest.xml, classes.dex, etc.) inside an APK , zip them (to create an APK) and sign them, then run the APK on the device without any problem? It is obviously not following normal format of an APK, which can be unzipped easily.

I already understand the reverse process, which try to normalize the last flag_bit from "1" to "0" (please read the attached URL). But I do not understand how is it possible. My guess is Android unzip utility does not check if the APK is password protected or not, it just decompresses (unpack) the APK during installation process.

Any comments / instructions are highly appreciated. Thank you!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.