Exodus-Privacy / exodus-core

Core functionality of εxodus
GNU Affero General Public License v3.0
18 stars 17 forks source link

Rework get_embedded_classes #68

Closed jspricke closed 1 year ago

jspricke commented 2 years ago
jspricke commented 2 years ago

I took get_embedded_classes as a basis to implement this into fdroidserver: https://gitlab.com/fdroid/fdroidserver/-/merge_requests/1110

Would be great to get feedback to synchronize both implementations.

U039b commented 2 years ago

Thank you @jspricke! I think that the code could even simpler since it possible to run dexdump directly on an APK file. If we want to support AppBundle, we should just check if the downloaded Zip archive contains a file base.apk. If so, unzip the aab and run dexdump on base.apk, otherwise, just run dexdump on the downloaded file.

@pnu-s any thoughts about that?

eighthave commented 2 years ago

I think this approach of looking for nested APKs is good for a number of reasons:

As for letting dexdump find the classes.dex itself, it is hard to say whether that's a better approach or not IMHO. @U039b do you know more about that? I suppose in the future, if Google changes something about how the Java code is bundled, they would also update dexdump, but my gut feeling is that they are also about as likely to do something weird in dexdump that breaks our usage. Do you think its a mistake to go with the current approach?

eighthave commented 2 years ago

I just had one other thought, but perhaps this could be left til later: the recursive search for ZIP files could actually check the first 4 bytes of each file to see if it is a ZIP rather than looking only at the extension. Maybe this is more a malware trick, so isn't so important for privacy scanning of legitimate apps.

pnu-s commented 1 year ago

@U039b I approved this PR but I'll wait for your approval before merging it!

U039b commented 1 year ago

Looks good to me :) In a near future I will propose an even better, faster and pure python way to grab embedded classes names. I am currently working on this exact same feature on DexTerity which is still private for the moment.

eighthave commented 1 year ago

To detect things hidden in nested ZIPs, we've added robust recursion to this work: https://gitlab.com/fdroid/fdroidserver/-/merge_requests/1123