sensepost / objection

📱 objection - runtime mobile exploration
GNU General Public License v3.0
7.46k stars 854 forks source link

Manually parse AndroidManifest.xml for launchable <actitivy> tags in addition to <activity-alias> #370

Closed mtschirs closed 4 years ago

mtschirs commented 4 years ago

Currently, when aapt fails to identify a launchable activity, the AndroidManifest.xml is manually parsed for <activity-alias> tags with an android.intent.category.LAUNCHER category.

Recently, I observed an issue with aapt failing due to an error ERROR getting 'android:icon' attribute: attribute is not a string value. The AndroidManifest.xml contained an <activity> tag with an android.intent.category.LAUNCHER category, but no <activity-alias>. Since objection only searches for the later when manually parsing the AndroidManifest.xml, it failed to identify any launchable activity.

Moving to aapt2 solved this issue in this case, but I would still like to suggest a more robust manual parsing of AndroidManifest.xml by also scanning for <activity> tags.

leonjza commented 4 years ago

Does it not make sense to just default to aapt2 here (we support it with the -2 flag at the moment). I have increasingly needed to use this to patch.

mtschirs commented 4 years ago

@leonjza Good idea. Perhaps you could then introduce another flag to switch back to the old aapt? AFAIK the new aapt2 might throw an error in some cases for which aapt works just fine, so older apps / apps build with an older SDK might require the use of aapt instead of aapt2 (?)

leonjza commented 4 years ago

Yeah, basically invert the current default.

leonjza commented 4 years ago

@mtschirs want to update the PR to default just to aapt2?

leonjza commented 4 years ago

Feel free to make a fresh PR for this when you have some spare cycles.