Adding Multidex Support To Ensure All APK Classes are Scanned #9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
CryptoGuard currently does not properly scan multidex apk file, and only looks at
classes.dex
file regardless of the dex files included in an apk file.CryptoGuard uses Soot and dexlib2 for analyzing apks. However, the followings were found:
As a result, apks were not being properly analyzed. To fix that, the following changes were necessary
Change in ApkAnalyzer.java
This allows
Soot
to handle multidex based class files.Change in Utils.java and dexlib2 version
Several necessary changes are happening here:
classes.dex
file, we are now looking at all of theclasses<n>.dex
files.zipContainer.getDexEntryNames()
zipContainer.getDexEntryNames()
is buggy in the used version ofdexlib2
, and returns an empty String array. Therefore, upgrading it was necessary. We went for the latest stable release, versiondexlib2-2.4.0
based on the commit5339a81f
in repository https://github.com/JesusFreke/smali. Since the mentioned repository maintainers do not offer a precompiled version for specificallydexlib2
, we compiled it ourselves based on the same commit5339a81f
.