APK Structure and Manifest Analysis
What you'll learn: How to dissect an APK file to uncover security-relevant configurations, permissions, and potential vulnerabilities before an app even runs.
Why This Matters
An APK (Android Package) is essentially a ZIP archive containing everything needed to run an Android app. Understanding its structure and manifest lets you identify security risks before installation—like reviewing a building's blueprints before entering.
APK File Structure
When you unzip an APK, you'll find:
AndroidManifest.xml– The app's DNA: permissions, components, configurationsclasses.dex– Compiled Java/Kotlin code (Dalvik bytecode)resources.arsc– Compiled resources (strings, layouts)lib/– Native libraries (.so files for different CPU architectures)assets/andres/– Raw files and UI resourcesMETA-INF/– Code signatures and certificate information
AndroidManifest.xml Deep Dive
This XML file is your security audit starting point. Key elements to examine:
Permissions: Does the app request READ_CONTACTS, ACCESS_FINE_LOCATION, or CAMERA? Are they justified by functionality?
Components: Exported activities, services, broadcast receivers, or content providers (android:exported="true") are publicly accessible—potential attack entry points.
Intent filters: Which actions can external apps trigger? Unprotected deep links can be exploited.
debuggable flag: If true in production, attackers can attach debuggers and manipulate runtime behavior.
Network security config: Does the app allow cleartext HTTP traffic or trust custom CAs?
Backup settings: android:allowBackup="true" may expose sensitive data through ADB backups.
Analysis Workflow
Use tools like apktool to decompile and read the manifest in human-readable format, then systematically check each permission and exported component against the app's stated purpose.
Key Takeaway: The APK structure and AndroidManifest.xml reveal an app's attack surface, permission abuse, and misconfigurations—making static analysis your first line of defense in mobile security assessments.