Definition:
Activities define screens with which users can interact. They can be exported using android:exported="true" or implicitly via intent-filters.
Testing:
Check AndroidManifest.xml for android:exported="true".
Look for intent-filters indicating implicit export.
Search for sensitive actions or data handled by the activity.
Intents are messages used to request an action from another app component, such as starting an activity, service, or broadcasting a message. Vulnerabilities arise when exported components handle malicious or unvalidated intents.
Testing:
Review AndroidManifest.xml for exported components with intent-filters.
Check for android:exported="true".
Look for <intent-filter> entries specifying action or category.
Search for intent-handling code using Intent intent = getIntent().
Verify whether the component validates the received intent's data or extras.
Exploit:
Triggering with ADB:
Use am start to deliver a crafted intent.
If the ChangePin activity is exported, it could be triggered by a malicious intent with arbitrary username.
BroadcastReceivers
Definition:
BroadcastReceivers respond to broadcast intents, such as system events or app-specific messages. If exported, they might allow malicious intent delivery.
Testing:
Review AndroidManifest.xml for android:exported="true".
Inspect the onReceive method for sensitive data or actions.
Search for dynamically registered receivers in code using registerReceiver().
Definition:
ContentProviders handle structured data sharing between applications. They are vulnerable to SQL Injection or Path Traversal if insecurely implemented.
Testing:
Check AndroidManifest.xml for android:exported="true".
Review query, insert, update, and delete methods for sanitization.
Definition:
ContentProviders manage access to a structured set of app data. They are designed for inter-app data sharing. Vulnerabilities arise if exported providers allow unauthorized access, SQL injection, or path traversal attacks.
Testing
Check AndroidManifest.xml:
Look for android:exported="true".
Verify permissions, especially protectionLevel values (e.g., dangerous or signature).
Example:
The SQL syntax will be generated out of these parameters as follow:
query ( Uri, projection, selection, selectionArgs, sortOrder content://com.example.app/news payloadnull,null,null)SELECT projection FROM Uri WHERE selection=selectionArgs ORDER BY sortOrder;
Now we need to identify the tables in the Java code. We can look for the keyword “content://“.
// Source: DBContentProvider - Sieve.apkpublicstaticfinalint KEY =200;publicstaticfinalUri KEYS_URI =Uri.parse("content://com.mwr.example.sieve.DBContentProvider/Keys");publicstaticfinalintKEY ID =230;publicstaticfinalintKEY PASSWORD =210;publicstaticfinalintKEY PIN =220;publicstaticfinalint PASSWORDS 100;publicstaticfinalintPASSWORDS EMAIL =140;publicstaticfinalintPASSWORDS ID =110;publicstaticfinalintPASSWORDS PASSWORD 150;publicstaticfinalintPASSWORDS SERVICE 120;publicstaticfinalUri PASSWORDS_URI =Uri.parse("content://com.mwr.example.sieve.DBContentProvider/Passwords");
The actual table names might be different, we have to track this in the code because within the SQL injection attack, we have to use the correct table names and not the authority names.
Example SQL Query Structure:
SELECT projection FROM Uri WHERE selection=selectionArgs ORDER BY sortOrder;
Exploit via ADB:
contentquery--uricontent://<authority>/Passwords--projection"* FROM Key--"
Example SQL Injection Command:
contentquery--uricontent://com.mwr.example.sieve.DBContentProvider/Passwords--projection"* FROM Key--"
2. Path Traversal
Improper URI validation in methods like openFile() allows arbitrary file access.