-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BadZip + fails to unpack #4
Comments
Thanks for heads up. I manually patched androguard to bypass crc checks. This case should be decrypted in this function here. To debug such cases as this, try to add -vvv as parameter I've added third plan for finding key in multidex. Now key is found as "捨뺑戚\ue684聳踖曡㒕躚\udafdﶃ킎" but fails to decrypt payload. I will try debug the decryption function. |
Found the issue, key is incorrect.
There are two reasons we fail here: Androguard (v3.3.5) prints second unicode with additional "\" . Now deep diving into androguard source code, changing this line to just I've committed unicode handling to multidex loader, can you test it again by changing androguard source code? My output for this sample :
|
Upgrading to androguard v3.4.0a1 fixed the extra "\" issue. |
Yep, it works on the patched file now cool :) |
AFAIK only way is to edit zipfile library |
@cryptax @eybisi androguard 4.0.0 has https://github.com/erev0s/apkInspector integrated which means that it is now capable of parsing badly formatted apk files. This means that it is very likely you will not have an issue with this I can see kavanoz uses the version 3.4.0 of Androguard and in order to integrate the latest version(4.0.0) some adjustments are required as Androguard has changed a lot in the past years. If i have enough time in the upcoming weeks i will create a PR to try out the new version of Androguard in combination with kavanoz. Also @cryptax please share any apk that could be used as a POC to try out edge cases. Also please keep in mind that apkInspector can also fetch the AndroidManifest from packed APKs, but it will be more on the "raw" side. |
This sample: 0070bc10699a982a26f6da48452b8f5e648e1e356a7c1667f393c5c3a1150865 fails to be be processed by Kavanoz currently.
The first issue is a bad CRC32 for AndroidManifest.xml in the ZIP.
Kavanoz is indeed right: the CRC32 for that file is wrong.
If we fix it with the correct value, Kavanoz still fails to unpack and says the sample is not packed.
This is incorrect. The encrypted payload is present in
./assets/moqls/oxcsbcc.joi
.The file is decrypted, dumped, dynamically loaded and deleted.
See my blog post for more info if you wish: https://cryptax.medium.com/bad-zip-and-new-packer-for-android-bianlian-5bdad4b90aeb
I attempted to write a very quick static decryptor, but it's not working yet. The code is basically copy pasted from the malware.
The text was updated successfully, but these errors were encountered: