![]()
Security testing of Android apps often starts with identifying attack surfaces. One of the most critical is exported components. These are parts of an app (Activities, Services, Broadcast Receivers, Content Providers) that are exposed to other apps and can be invoked externally. If improperly secured, exported components become easy entry points for attackers to execute arbitrary code, access sensitive data, or manipulate the app’s behavior.
To make this discovery process faster and more efficient, a new tool — APK Components Inspector. It automates the detection of these exported components. On top of that I have built a script that would even generates ready-to-use ADB commands for testing and automatically run them on Android to automate the full process.

Exported components in Android allow different apps to interact. While this is a feature, not a bug, the security risk comes from unintentionally or improperly exported components — especially if they lack permission protection.
For example:

AndroidManifest.xmlThese components become attack vectors if they’re not secured. So, during security audits or pen-testing, enumerating exported components is a fundamental step.
Imagine a standard workflow where you receive an APK file and need to test its exported components for vulnerabilities. The traditional approach is arduous and time-consuming:
For an app with 10-15 exported components, this can quickly accumulate hours of manual, repetitive work, assuming no problems. APK Components Inspector simplifies this task. It’s a lightweight, Python-based command-line utility designed for security researchers to automatically generate already crafted ADB commands for accessing exposed Android components. Here’s how it works:
getStringExtra("url") or getParcelableExtra("redirect_intent") from the code and generate the corresponding ADB commands.



In short, the script would:
Getting started with APK Components Inspector is straightforward:
pip install androguard==3.3.5)git clone https://github.com/thecybersandeep/apk-components-inspectorcd apk-components-inspectorpython3 -m venv venv and source venv/bin/activatepip install androguard==3.3.5 rich
Once installed, simply run the tool with your APK file: python apk-components-inspector.py vulnerable-app.apk

Below is a simple visual explanation of the tool workflow.

When tested against a sample APK, the output is clear and structured. You see each component listed with an appropriate ADB command like:
adb shell am start -n com.target.app/.ExportedActivity
adb shell am startservice -n com.target.app/.ExportedService
Also include a component summary:

com.jb.zcamera app (https://medium.com/@ostorlab/this-article-is-a-technical-deep-dive-showing-how-a-100m-installation-image-application-can-6343ce8ea076)However, while the tool is great with at generating these commands, it doesn’t execute them automatically. You’re still left with the task of manually copying each generated ADB command from the terminal output and pasting it into another terminal connected to your Android device to run it. This manual step slows down the workflow during a pentest or when auditing multiple apps.
To further simplify the testing process and solve the manual execution bottleneck, I propose an “update script”. This script would take the output of the apk-components-inspector.py as its input. Its functionality would be as follows:
adbcommands.txt file.python apk-components-inspector.py dvba_v1.1.0.apk | tee adbcommands.txt; python run_adb_commands.py

run_adb_commands.py script that will parse each identified ADB command from adbcommands.txt file and allows user to execute it. There is the workflow:
Here is a vibe coded run_adb_commands.py script:
import subprocess
def parse_adb_commands(file_path):
with open(file_path, 'r') as file:
lines = file.readlines()
commands = []
current_command = []
for line in lines:
stripped = line.strip()
if stripped.startswith("adb "):
current_command = [stripped]
elif stripped.startswith("#") or not stripped:
if current_command:
full_command = ' '.join(current_command).replace(" \\\\ ", " ").replace("\\", "").strip()
commands.append(full_command)
current_command = []
elif current_command:
current_command.append(stripped)
if current_command:
full_command = ' '.join(current_command).replace(" \\\\ ", " ").replace("\\", "").strip()
commands.append(full_command)
return commands
# Example usage
file_path = 'adbcommands.txt'
parsed_commands = parse_adb_commands(file_path)
for i, cmd in enumerate(parsed_commands, 1):
print(f"\nCommand {i}: {cmd}")
input("Press Enter to execute this command...")
try:
result = subprocess.run(cmd, shell=True, check=True, text=True, capture_output=True)
print("Output:\n", result.stdout)
if result.stderr:
print("Errors:\n", result.stderr)
except subprocess.CalledProcessError as e:
print(f"Command failed with error:\n{e.stderr}")
The benefit of this improvement is that it eliminates the need to manually copy and paste commands, saving time and reducing the chances of error, thereby accelerating the testing cycle even further.
Another major advantage of APK Components Inspector is its ability to run directly from a Android smartphone, making it a powerful on-the-go tool for mobile security analysts. Since the tool is built in Python and relies on standard Android command-line utilities. This means you can analyze and extract exported components without needing a laptop or full desktop setup — perfect for live testing, or auditing apps in the field.

While APK Components Inspector is fast and automation-friendly, there are other tools for similar purposes:
One of the most critical issues associated with exported components is the Intent Redirection vulnerability (CWE-926). This happens when an app blindly forwards received Intents to other components — either within the app or externally — without validating the source or intent contents. Malicious apps can exploit this trust to hijack app flow, trigger privileged actions, or access sensitive components, often bypassing permission boundaries.
Several vulnerabilities have been discovered in recent years, demonstrating how serious this issue is:
com.lge.lms.things.notification.ACTION. Attackers on LG devices could exploit this to trigger arbitrary components with system-level privilegesGoogle outlines clear guidance to mitigate these vulnerabilities:
android:exported="false" unless truly necessary.getCallingPackage() or getCallingActivity() to confirm the source of an Intent.By combining tools like APK Components Inspector with awareness of common flaws like Intent Redirection, security testers and developers can reduce the attack surface of Android applications.
Identifying exported components is non-negotiable in Android app security. APK Components Inspector makes it easier than ever, turning static analysis into a fast and nearly hands-free process. Combined with the automation script above, you can reduce hours of manual testing to minutes.
Security is only as good as your visibility. Tools like these not only help you see vulnerabilities faster but also help you act on them with precision.