Take the 2-minute tour ×
Information Security Stack Exchange is a question and answer site for Information security professionals. It's 100% free, no registration required.

I want to develop two Android apps that will communicate via intents (on the same device).

When the two apps transfer confidential data, should they encrypt it?

Or does the Android OS guarantee (or at least try to guarantee) that intent data is not seen by anyone but sender and recipient?

Of course, let's suppose the user always selects my app as the receiver of the intent.
Let's also say that both apps are installed, that should prevent namespace hijacking.

share|improve this question

1 Answer 1

No, the Android OS doesn't guarantee that intent data is not seen by anyone. Any malicious app implementing the intent filter is able to receive the message and thus get hold of your sensitive data. Encrypting data is good idea but make sure that:

  1. the key used for encryption is not stored on the SD card.
  2. you are not hard-coding the key in the app as it is very trivial to get the source from the apk.

Also, make sure that only the app(s) which are intended to receive the message (via intents) are receiving the intent and that no other app is able to receive that intent. If you want to communicate confidential data and if you know the class names the apps that would be communicating via intents, you can either ensure that only that specific app receives the intent by using the setClassname() method of the intents. For ex:

Intent i = new Intent(); 
i.setClassName(“your.pkg.name”, “your.pkg.name.Destination”);

or by letting apps having only specific permissions receive the intent. For ex:

Intent i = new Intent(); 
i.setAction(“your.own.action”); 
sendBroadcast(i, “your.own.permission”);

Source: "Seven Ways to Hang Yourself with Google Android" (Defcon 19)

share|improve this answer
    
I suppose that the user always selects my app as the receiver of the intent. Even this case, is your first paragraph still true? The setClassname paragraph is great! –  Nicolas Raoul Mar 31 at 8:52
    
What do you mean by "user always selects my app as the receiver of the intent"? How are you "selecting" your app without specifying the class (i.e without using setClassName)? –  TheRookierLearner Mar 31 at 9:03
    
Note that a (malicious) application can have any package name (unless an application already exists with that package name). –  domen Mar 31 at 10:03
    
@TheRookierLearner: If I choose a standard intent like ACTION_EDIT/etc there might be other apps handling the same intent. In such cases the user is shown a dialog to choose. –  Nicolas Raoul Mar 31 at 10:38
    
So, consider that you show a list of apps handling the same intent (say: {A, B and C}) and the user chooses say B. (I suppose you mean something like you are having a list and saving the index corresponding to B and then sending your data to B) You still either need to set the class name using setClassName otherwise A and C can listen for the same data or list the permission that only B has (uniquely) and no other app has that permission. –  TheRookierLearner Mar 31 at 16:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.