1 Background ============ Android applications are executed in a sandbox environment, to ensure that no application can access sensitive information held by another, without adequate privileges. For example, The Browser application holds sensitive information such as cookies, cache and history, and this cannot be accessed by third-party apps, while the Google Talk application stores contacts and conversations. An android app may request specific privileges during its installation; if granted by the user, the app's capabilities are extended. One mechanism which Android uses in order to implement the sandbox, is running each application as a separate process, and as a Linux user which is private to the application's package. Running applications as different users makes files owned by one application inaccessible to another (unless explicitly allowed). At the application deployment phase, Android allocates the application a data directory, identified by the application's package, under the /data/data path. Android provides support for SQLite databases. Applications can create a private database identified by name. Once created, the database is stored under the /data/data//databases directory, with the chosen name as a filename. The SQLite database engine maintains a rollback journal. When an application changes the database, the original unchanged database is first copied to the journal, and in case of a crash or a ROLLBACK action, the database can be recovered. The journal has the same filename as the database itself, but with a -journal suffix. 2 Vulnerability =============== The journal file of SQLite databases can be read by all applications: * The application's data directory has execution rights for all users, up to the root. This means that files with read or write permissions for all users, found under the application's data directory are actually globally accessible. * The /data/data//databases directory is created with [rwxrwx--x] permissions, meaning that files under that dir with global read or write permissions, are globally readable or writable. * The journal file is created under the databases directory with [-rw-r--r--] permissions and therefore it can be read by all apps. Conclusion: All databases maintained by Android's SQLite engine (unless named with a random and unguessable string) can be leaked by malicious applications without the need to declare adequate privileges. The databases can be leaked during the lifetime of the journal file, (i.e. when the transaction is made). 3 Impact ======== A malicious app can eavesdrop on database activities performed by any other application using SQLite, allowing unauthorized access to information such as URL history, messages, and contacts. 4 Vulnerable versions ===================== Android 2.3.7. 5 Non-vulnerable versions ========================= Android 4.0.1. 6 Credit ======== Discovered by Roee Hay 7 Acknowledgments ================= We would like to thank the Android Security Team for the efficient way in which they handled this security issue. 8 References ============ * Full advisory with PoC. http://bit.ly/K0W0pT * Blog post. http://bit.ly/JEThEf * Video demonstration. http://youtu.be/oCXLHjmH5rY