Android Security

TiredEngineer

Member
Jul 26, 2013
98
0
66
Asked this over at XDA, but no one replied. This post is primarily pertaining to Gmail and Google Drive on Android. Currently when I open a document (pdf, docx, xlsx, etc) from Gmail or Google Drive the files open in Quickoffice as expected (clearly a local copy is being cached SOMEWHERE).

If I choose to make a file available offline in Google Drive it is available in ./sdcard/Android/<something docs>. I do enable offline document encryption (a setting in Drive), so the contents of the file are scrambled and unusable. With Gmail if I save locally it creates the file in ./Downloads/. All of this is fine and expected.

My concern is for the first situation where where the file is opened and cached, but not permanently saved. I cannot find where this is cached locally. I am hoping it is /data/ so other apps have no visibility into this.

The reason I am asking is for security purposes. The inherent design of Android is open due to the ./sdcard/ directory. Obviously any app on my phone can see any file there. Sometimes I have sensitive attachments I don't want exposed in these public directories (as a side note I hate that Chrome downloads are saved publicly with no option to change this). Are Gmail attachments and Google Drive documents cached securely in /data/ where other apps cannot access them when all I do is "preview" and not explicitly download a local copy?

One other question, assuming these documents are cached in /data/<something Gmail/Drive>. My understanding is that in /data/ that an app only has access to its home directory in data, which NO other app can see or access in any way. How then does Quickoffice, Adobe Reader, Gallery, etc access these cached documents from a directory they can't even know exist due to the inherent architecture of Android?
 

smakme7757

Golden Member
Nov 20, 2010
1,487
1
81
I'd imagine it's under /Data

For example:
/data/com.quickoffice.android/cache/file-previews

You most likely need root to dive into those folders. I'd suggest encrypting your whole device if possible. It won't encrypt an external SDCard, but it will encrypt your entire local storage. So if you have a device like the Nexus 7 (which i have) encrypting the device will encrypt everything.

Mine is encrypted and there is no noticeable lag or slowdown at all.
 
Last edited:

TiredEngineer

Member
Jul 26, 2013
98
0
66
Yes, I cannot access the /data/ directory due to the fact that I will not root my devices.

You mention encryption, which I agree with, as I have done this before with Android, but I am looking at inter-app security.

I don't trust certain third-party apps to have any access to these sensitive files (they could theoretically upload them to the web without my knowledge). A zero permission app can use the /sdcard/ directory to upload any file there. If this data is cached in /data/ then it should be protected.

That's why I was asking where the cache for these apps is located (I looked in /sdcard/ but could not find it). Also, I am curious how Android exposes data from /data/gmail/cache (don't know exact directory...just guessing) to allow Adobe Reader to open a pdf.
 

smakme7757

Golden Member
Nov 20, 2010
1,487
1
81
I'm pretty sure Android uses SELinux to limit access to the filesystem. So apps can only access the part of the file system that is reserved for them. Most apps will however have SDCard access, but I'm not sure how strict the SELinux policies are on the SDcard partition.
 

TiredEngineer

Member
Jul 26, 2013
98
0
66
The /sdcard/ directory is the internal directory of Android that is shared between everything. It has your music, photos, download, etc.

I am mainly asking if previewed attachments from Gmail and documents opened with Drive (but not offlined) are protected in their own /data/ directory which is completely hidden unless you are root.

I am also asking, that if it does work this way, how does Android expose a file (e.g. report.pdf) located at /data/gmail/cache/report.pdf to Adobe Reader, which can only see files located in /data/adobereader and anything located in /sdcard/?
 

smakme7757

Golden Member
Nov 20, 2010
1,487
1
81
http://developer.android.com/training/articles/security-tips.html

Have a read of that. It seems applications can make files accessible to other apps of they wish too. But unless they do files are only accessible by the specific app that created it. I would imagine cached and temporary files are not world readable.

Then you have app policies where an app might ask for too many permissions granting it more access and so on, but in that case you have to accept that before installing it. But they would still need permissions to access various parts of the file system.

http://developer.android.com/support.html

Maybe you should ask on one of the IRC channels there?
 
Last edited:

TiredEngineer

Member
Jul 26, 2013
98
0
66
Thanks for those links. I hadn't heard of the "Content Provider", but was assuming something like that had to exist.

Edit: I will do some research on this tool, but I guess my questions now boil down to:

1) Does Gmail/Drive expose the confidential file ONLY to the requested app (in this case Adobe Reader for a pdf).

2) After the file is closed, does Adobe Reader lose access to this file, and would need to be explicitly granted access again by the user choosing to open it again?
 
Last edited: