32161610 Security Vulnerability - Information disclosure vulnerability

in AOSP Messaging

* Check to make sure the returned uri from the gallery picker does
not point to bugle's data directory (or any subdir).

* Test:
Manual-
* I created the test app in the bug, the one that injects the bad
uri into Bugle. I verified the bad behavior before the fix and the
good behavior after.
* I tested the gallery to make sure picking photos,
from the photos app and drive, still work.
* I verified the behavior in the debugger to be sure the code is
catching the bad uri from the test app.

Change-Id: I3393f3b886c837a49758b91945cf1e17ec9bee41
Fixes: 32161610
This commit is contained in:
Tom Taylor
2016-12-05 13:57:45 -08:00
parent 1bc276100f
commit 69ed579fb8
2 changed files with 25 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
package com.android.messaging.util;
import android.content.Context;
import android.os.Environment;
import android.webkit.MimeTypeMap;
import com.android.messaging.Factory;
@@ -116,6 +117,13 @@ public class FileUtil {
}
}
// Checks if the file is in /data, and don't allow any app to send personal information.
// We're told it's possible to create world readable hardlinks to other apps private data
// so we ban all /data file uris. b/28793303
public static boolean isInDataDir(File file) {
return isSameOrSubDirectory(Environment.getDataDirectory(), file);
}
/**
* Checks, whether the child directory is the same as, or a sub-directory of the base
* directory.