CWE

Common Weakness Enumeration

A Community-Developed List of Software Weakness Types

CWE/SANS Top 25 Most Dangerous Software Errors
Home > CWE List > CWE- Individual Dictionary Definition (2.11)  
ID

CWE-927: Use of Implicit Intent for Sensitive Communication

Weakness ID: 927
Abstraction: Variant
Status: Incomplete
Presentation Filter:
+ Description

Description Summary

The Android application uses an implicit intent for transmitting sensitive data to other applications.

Extended Description

Since an implicit intent does not specify a particular application to receive the data, any application can process the intent by using an Intent Filter for that intent. This can allow untrusted applications to obtain sensitive data. There are two variations on the standard broadcast intent, ordered and sticky.

Ordered broadcast intents are delivered to a series of registered receivers in order of priority as declared by the Receivers. A malicious receiver can give itself a high priority and cause a denial of service by stopping the broadcast from propagating further down the chain. There is also the possibility of malicious data modification, as a receiver may also alter the data within the Intent before passing it on to the next receiver. The downstream components have no way of asserting that the data has not been altered earlier in the chain.

Sticky broadcast intents remain accessible after the initial broadcast. An old sticky intent will be broadcast again to any new receivers that register for it in the future, greatly increasing the chances of information exposure over time. Also, sticky broadcasts cannot be protected by permissions that may apply to other kinds of intents.

In addition, any broadcast intent may include a URI that references data that the receiving component does not normally have the privileges to access. The sender of the intent can include special privileges that grant the receiver read or write access to the specific URI included in the intent. A malicious receiver that intercepts this intent will also gain those privileges and be able to read or write the resource at the specified URI.

+ Time of Introduction
  • Architecture and Design
+ Applicable Platforms

Languages

Language-independent

Architectural Paradigms

Mobile Application

+ Common Consequences
ScopeEffect
Confidentiality

Technical Impact: Read application data

Other applications, possibly untrusted, can read the data that is offered through the Intent.

Integrity

Technical Impact: Varies by context

The application may handle responses from untrusted applications on the device, which could cause it to perform unexpected or unauthorized actions.

+ Demonstrative Examples

Example 1

This application wants to create a user account in several trusted applications using one broadcast intent:

(Bad Code)
Example Language: Java 
Intent intent = new Intent();
intent.setAction("com.example.CreateUser");
intent.putExtra("Username", uname_string);
intent.putExtra("Password", pw_string);
sendBroadcast(intent);

This application assumes only the trusted applications will be listening for the action. A malicious application can register for this action and intercept the user's login information, as below:

(Attack)
Example Language: Java 
IntentFilter filter = new IntentFilter("com.example.CreateUser");
MyReceiver receiver = new MyReceiver();
registerReceiver(receiver, filter);

When a broadcast contains sensitive information, create a whitelist of applications that can receive the action using the application's manifest file, or programmatically send the intent to each individual intended receiver.

Example 2

This application interfaces with a web service that requires a separate user login. It creates a sticky intent, so that future trusted applications that also use the web service will know who the current user is:

(Bad Code)
Example Language: Java 
Intent intent = new Intent();
intent.setAction("com.example.service.UserExists");
intent.putExtra("Username", uname_string);
sendStickyBroadcast(intent);
(Attack)
Example Language: Java 
IntentFilter filter = new IntentFilter("com.example.service.UserExists");
MyReceiver receiver = new MyReceiver();
registerReceiver(receiver, filter);

Sticky broadcasts can be read by any application at any time, and so should never contain sensitive information such as a username.

Example 3

This application is sending an ordered broadcast, asking other applications to open a URL:

(Bad Code)
Example Language: Java 
Intent intent = new Intent();
intent.setAction("com.example.OpenURL");
intent.putExtra("URL_TO_OPEN", url_string);
sendOrderedBroadcastAsUser(intent);

Any application in the broadcast chain may alter the data within the intent. This malicious application is altering the URL to point to an attack site:

(Attack)
Example Language: Java 
public class CallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
String Url = intent.getStringExtra(Intent.URL_TO_OPEN);
attackURL = "www.example.com/attack?" + Url;
setResultData(attackURL);
}
}

The final receiving application will then open the attack URL. Where possible, send intents to specific trusted applications instead of using a broadcast chain.

Example 4

This application sends a special intent with a flag that allows the receiving application to read a data file for backup purposes.

(Bad Code)
Example Language: Java 
Intent intent = new Intent();
intent.setAction("com.example.BackupUserData");
intent.setData(file_uri);
intent.addFlags(FLAG_GRANT_READ_URI_PERMISSION);
sendBroadcast(intent);
(Attack)
Example Language: Java 
public class CallReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
Uri userData = intent.getData();
stealUserData(userData);
}
}

Any malicious application can register to receive this intent. Because of the FLAG_GRANT_READ_URI_PERMISSION included with the intent, the malicious receiver code can read the user's data.

+ Potential Mitigations

Phase: Implementation

If the application only requires communication with its own components, then the destination is always known, and an explicit intent could be used.

+ Relationships
NatureTypeIDNameView(s) this relationship pertains toView(s)
ChildOfWeakness ClassWeakness Class285Improper Authorization
Development Concepts (primary)699
Research Concepts (primary)1000
ChildOfWeakness ClassWeakness Class668Exposure of Resource to Wrong Sphere
Research Concepts1000
+ References
[REF-35] Erika Chin, Adrienne Porter Felt, Kate Greenwood and David Wagner. "Analyzing Inter-Application Communication in Android". 3.2.1. <http://www.eecs.berkeley.edu/~daw/papers/intents-mobisys11.pdf>.
[REF-34] Android Open Source Project. "Security Tips". 2013-07-16. <http://developer.android.com/training/articles/security-tips.html#ContentProviders>.
+ Maintenance Notes

This entry will be made more comprehensive in later CWE versions.

+ Content History
Submissions
Submission DateSubmitterOrganizationSource
2013-07-09MITREInternal CWE Team
Modifications
Modification DateModifierOrganizationSource
2014-02-18CWE Content TeamMITREInternal
updated Demonstrative_Examples, Description, References

More information is available — Please select a different filter.
Page Last Updated: May 05, 2017