URL Scheme Validation Bypass in Shopify Mobile App Allows Javascript Execution
The Shopify Android app's NavigationActivity did not check the scheme of a URL passed to it as an extra, so a crafted data: or javascript: URL could load arbitrary HTML and JavaScript inside the app's WebView. This let an attacker run JavaScript and potentially reach Java code through the exposed SmartWebview and EASDK interfaces.
- Triaged in 17 days
- Fixed in 44 days
- Paid in 17 days
- Disclosed after 2.9 years
Summary by the program
A vulnerability in the Shopify mobile application allowed bypassing URL scheme validation in the NavigationActivity component. Attackers could craft malicious URLs using data: or javascript: schemes to execute JavaScript code within the app's webview context. JavaScript execution with potential access to device files through exposed interfaces. Exploitation required installation of a malicious app and significant user interaction.
The report
Summary:
[------------------------------------Package Details---------------------------------------]: | Application Name :Shopify | Package Name :com.shopify.mobile | Version code :33070 | Version Name :9.85.1 | Mimimum SDK :26 | Target SDK :32 | Max SDK :None | Sha256 :602982573bab04349ad812799319959e6236a746a41f88c7ec0196157ba15027 [------------------------------------------------------------------------------------------]
Shops Used to Test:
█████████.myshopify.com
Steps To Reproduce:
It was found that the com.shopify.mobile app doesn't validate the scheme of the url given as an extra parameter to the com.shopify.mobile.navigation.NavigationActivity which may allow the loading of arbitrary html content (including js code) in the application's webview and the takeover of the SmartWebview , EASDK js interface.
To reproduce, use the apk provided
█████
Supporting Material:
Expected behaviour:
Impact
Execution of js code ,including of running java code via the EASDK and SmartWebview interfaces.
Context
The target is the Shopify mobile application for Android, package com.shopify.mobile. The component at the centre of the report is com.shopify.mobile.navigation.NavigationActivity, an activity that accepts a URL as an extra parameter and loads it into the app's webview. The webview is not a bare browser surface: it exposes JavaScript interfaces named SmartWebview and EASDK, which the app uses to bridge web content and native functionality.
Normally such an activity is expected to load only URLs whose scheme is appropriate for the app, so that arbitrary content cannot be pulled into a privileged webview context. The report is about that scheme check being absent.
Setup
The researcher documented the build under test in a package details block:
[------------------------------------Package Details---------------------------------------]:
| Application Name :Shopify
| Package Name :com.shopify.mobile
| Version code :33070
| Version Name :9.85.1
| Mimimum SDK :26
| Target SDK :32
| Max SDK :None
| Sha256 :[redacted]
[------------------------------------------------------------------------------------------]
Testing was done against a development shop on the myshopify.com domain; the store name is redacted here. The reproduction used an APK build of the app, whose location is also redacted in the report.
Finding it
The researcher found that com.shopify.mobile.navigation.NavigationActivity does not validate the scheme of the URL passed to it as an extra parameter. Because the activity hands that URL to the app's webview without a scheme restriction, a caller can supply a data: or javascript: URL and have arbitrary HTML, including JavaScript, loaded in the webview context. That context is the one where the SmartWebview and EASDK JavaScript interfaces are attached, so the missing check also puts those interfaces within reach of the loaded content.
Exploitation
Step 1: Prepare the device and the target app
Install the Shopify app build identified above. The report notes that exploitation requires the installation of a malicious app, so the delivery vehicle for the crafted intent is a second, attacker-controlled application on the same device.
Step 2: Send a crafted URL to NavigationActivity
The malicious app starts com.shopify.mobile.navigation.NavigationActivity and passes a URL using a data: or javascript: scheme as the extra parameter. The report does not reproduce the exact intent or the exact payload string; it states only that the scheme of the URL supplied as the extra parameter is not validated.
Step 3: Observe execution in the webview
The supplied content is loaded into the app's webview and its JavaScript runs there. The supporting material is a screen recording of the expected behaviour:
The report labels the recording as the expected behaviour.
Root cause
The activity accepts a URL from an external caller and forwards it to the webview without checking its scheme. Because data: and javascript: URLs are accepted alongside whatever schemes the app legitimately needs, the caller controls the document that runs inside a webview which has the SmartWebview and EASDK JavaScript interfaces attached. The report does not describe any allowlist, intent filter restriction or other defence that would have limited which callers can reach the activity or which schemes it accepts.
Impact
The program summarised the impact as JavaScript execution within the app's webview context, with potential access to device files through exposed interfaces. The researcher's own impact statement is broader: execution of JavaScript code, including running Java code via the EASDK and SmartWebview interfaces.
The program was explicit about the conditions: exploitation required the installation of a malicious app and significant user interaction. The report was rated low severity, and the weakness was classified as forced browsing.
Fix
The report does not describe the fix that was applied. The change implied by the finding is to validate the scheme of the URL received by NavigationActivity before loading it, restricting it to the schemes the app actually needs and rejecting data: and javascript: URLs.
Variants to test
- Other activities and deep link handlers in the same app that take a URL parameter. A positive result is a
javascript:ordata:URL reaching a webview that has JavaScript interfaces attached. - The same activity reached through an exported deep link rather than an explicit intent from another app. A positive result is the crafted URL being accepted without the malicious app being installed, which would remove one of the stated preconditions.
- Scheme checks that only inspect the prefix of the URL. A positive result is a URL that passes the check but is still interpreted by the webview as
javascript:ordata:. - Webviews with JavaScript interfaces in other Shopify mobile surfaces. A positive result is any path from attacker-controlled content to a call on SmartWebview or EASDK.
Hunting notes
This kind of bug hides in activities that accept a URL as an intent extra and load it into a webview, particularly where that webview exposes JavaScript bridges. During recon, look for exported activities in the manifest, for deep link handling, and for webview classes with addJavascriptInterface style bridges; the combination of an externally supplied URL and an attached bridge is the signal. The report includes a recording labelled as the expected behaviour, tying the missing check to the app's own webview rather than a generic browser surface. The program still rated it low because of the installation and interaction requirements it identified.
What happened, in plain words
Shopify makes a mobile app for Android phones. Like many apps, it contains a small built-in browser window, called a webview, that it uses to show web pages inside the app itself rather than sending you out to Chrome or Firefox. That webview is special: the app has wired it up so that the web page inside it can talk to the phone's native code through two bridges the app calls SmartWebview and EASDK. A bridge is a doorway that lets a web page ask the app to do things on the phone.
One part of the app, a screen called com.shopify.mobile.navigation.NavigationActivity, is designed to receive a web address (a URL) from whoever opens it and then load that address into the webview. The researcher found that this screen never checks what kind of address it is given. A URL has a scheme at the front, the bit before the colon, such as https: for ordinary web pages. Two other schemes, data: and javascript:, let the person supplying the URL control the actual content that gets loaded, including code. Because the screen accepts those schemes, another app on the same phone could hand it a crafted URL and get its own HTML and JavaScript running inside Shopify's privileged webview, right next to those bridges.
The catch, which the program spelled out, is that pulling this off needs two things: the victim must install a malicious app, and there must be significant user interaction. That is why the whole thing was rated low severity. The weakness was filed under the label forced browsing.
The app under test
Before testing anything, the researcher wrote down exactly which build of the app was examined, so that anyone repeating the work knows they are looking at the same thing. This is standard practice: a bug report is only useful if the reader can reproduce it on the same version.
[------------------------------------Package Details---------------------------------------]:
| Application Name :Shopify
| Package Name :com.shopify.mobile
| Version code :33070
| Version Name :9.85.1
| Mimimum SDK :26
| Target SDK :32
| Max SDK :None
| Sha256 :[redacted]
[------------------------------------------------------------------------------------------]
Line by line:
Application Name :Shopifyis the human-friendly name you see on the phone's home screen.Package Name :com.shopify.mobileis the app's unique identifier on Android, the equivalent of a surname that no other app can share. Every Android app has one, and it is how other apps and the system refer to it.Version code :33070is an internal number Android uses to tell one build from another. It always goes up with each release.Version Name :9.85.1is the version number shown to people, the one you would see in the app store.Mimimum SDK :26(the report's spelling) means the oldest version of Android the app will run on, expressed as an API level. API level 26 is Android 8.0. An SDK, or software development kit, is the set of tools and libraries used to build apps for a platform; the minimum SDK is the lowest platform version the app supports.Target SDK :32is the Android version the app was built and tested against, API level 32 being Android 12L. Android changes some of its behaviour depending on this value, so it matters for security testing.Max SDK :Nonemeans there is no upper limit declared.Sha256 :[redacted]is a fingerprint of the app file. A hash function takes any file and produces a fixed-length string; change one byte of the file and the string changes completely. Comparing hashes is how you prove two people are testing byte-for-byte the same app.
The shop used for testing
The researcher tested against a development shop on the myshopify.com domain. A development shop is a throwaway store used for building and testing rather than selling, so experiments do not touch real customer data. The store's name is redacted in the report, shown only as a block of blacked-out characters followed by .myshopify.com.
The finding
The researcher found that com.shopify.mobile.navigation.NavigationActivity does not validate the scheme of the URL given to it as an extra parameter.
Two ideas need unpacking here. An activity is one screen of an Android app, and activities can be started by other apps on the phone, sometimes with extra pieces of data attached. Those extras are called intent extras: think of an intent as an envelope one app hands to another, and the extras as notes tucked inside it. A scheme is the first part of a URL, the label before the colon that says what kind of address this is: https, mailto, tel, and so on.
Validation means checking that a value is one of the kinds you expect and refusing it otherwise. Here there was no such check. The activity took whatever URL arrived in the envelope and passed it straight to the webview. Since data: and javascript: URLs are accepted just like ordinary ones, the caller decides what document gets loaded. And because that webview has the SmartWebview and EASDK JavaScript interfaces attached, the loaded content can reach those bridges too.
Reproducing it
Step 1: Get the device and the app ready
Install the Shopify build identified above. The report notes that exploitation requires the installation of a malicious app, so the thing that delivers the crafted intent is a second app on the same phone, one the attacker controls. The report points to an APK build of the app for reproduction, but the location is redacted. An APK is the installable file format for Android apps, the equivalent of an .exe on Windows.
Step 2: Send a crafted URL to the activity
The malicious app starts com.shopify.mobile.navigation.NavigationActivity and passes a URL using a data: or javascript: scheme as the extra parameter. The report does not reproduce the exact intent or the exact payload string; it states only that the scheme of the URL supplied as the extra parameter is not validated.
Why does this step matter? Because the whole bug is about trust. The activity trusts whatever URL it is handed. By handing it a URL whose scheme makes the caller the author of the content, the attacker turns the Shopify webview into a stage for their own code.
Step 3: Watch it run in the webview
The supplied content is loaded into the app's webview and its JavaScript runs there. The supporting material is a screen recording of the expected behaviour:
The report labels the recording as the expected behaviour.
Why it happens
The activity accepts a URL from an outside caller and forwards it to the webview without checking its scheme. Because data: and javascript: URLs are accepted alongside whatever schemes the app legitimately needs, the caller controls the document that runs inside a webview which has the SmartWebview and EASDK JavaScript interfaces attached. The report does not describe any allowlist, intent filter restriction or other defence that would have limited which callers can reach the activity or which schemes it accepts.
An allowlist is the opposite of a blocklist: instead of naming the bad things and banning them, you name the good things and permit only those. It is the difference between a bouncer with a guest list and a bouncer trying to remember every troublemaker's face.
What it means in practice
The program summarised the impact as JavaScript execution within the app's webview context, with potential access to device files through exposed interfaces. The researcher's own impact statement is broader: execution of JavaScript code, including running Java code via the EASDK and SmartWebview interfaces.
JavaScript is the language web pages run in the browser; Java is a different language, the one Android apps are largely written in. The bridges are what connect the two worlds, so code running in the webview can, through them, reach native functionality. The program was explicit about the conditions: exploitation required the installation of a malicious app and significant user interaction. The report was rated low severity, and the weakness was classified as forced browsing.
The fix
The report does not describe the fix that was applied. The change implied by the finding is to validate the scheme of the URL received by NavigationActivity before loading it, restricting it to the schemes the app actually needs and rejecting data: and javascript: URLs.
Other places to look
- Other activities and deep link handlers in the same app that take a URL parameter. A deep link is a URL that opens a specific screen inside an app rather than a web page. A positive result is a
javascript:ordata:URL reaching a webview that has JavaScript interfaces attached. - The same activity reached through an exported deep link rather than an explicit intent from another app. An exported component is one other apps are allowed to start. A positive result is the crafted URL being accepted without the malicious app being installed, which would remove one of the stated preconditions.
- Scheme checks that only inspect the prefix of the URL. A positive result is a URL that passes the check but is still interpreted by the webview as
javascript:ordata:. - Webviews with JavaScript interfaces in other Shopify mobile surfaces. A positive result is any path from attacker-controlled content to a call on SmartWebview or EASDK.
Notes for anyone hunting similar bugs
This kind of bug hides in activities that accept a URL as an intent extra and load it into a webview, particularly where that webview exposes JavaScript bridges. During recon, look for exported activities in the manifest, for deep link handling, and for webview classes with addJavascriptInterface style bridges; the combination of an externally supplied URL and an attached bridge is the signal. The manifest is the file inside an app that declares its components and which of them other apps may reach. The report includes a recording labelled as the expected behaviour, tying the missing check to the app's own webview rather than a generic browser surface. The program still rated it low because of the installation and interaction requirements it identified.
Glossary
- Activity: a single screen of an Android app, which other apps can sometimes start.
- Allowlist: a list of things that are permitted, with everything else refused.
- APK: the installable file format for Android apps.
- API level: a number identifying a version of the Android platform that apps are built against.
- Bridge (JavaScript interface): a doorway the app opens so that web content inside its webview can call native code.
- Deep link: a URL that opens a specific screen inside an app rather than a web page.
- EASDK: one of the two JavaScript interfaces the Shopify app exposes to its webview, as named in the report.
- Exported component: an app component that other apps on the device are allowed to start.
- Extra (intent extra): a piece of data attached to an intent, like a note tucked inside an envelope.
- Forced browsing: the weakness classification given to this report by the program.
- Hash (SHA-256): a fixed-length fingerprint computed from a file, used to prove two copies are identical.
- Intent: the message one Android app sends to another to ask it to do something, such as start an activity.
- Java: a programming language, widely used for Android apps.
- JavaScript: the programming language web pages run in a browser or webview.
- Manifest: the file inside an Android app that declares its components and which are reachable by other apps.
- Package name: an app's unique identifier on Android, such as
com.shopify.mobile. - Scheme: the first part of a URL, before the colon, saying what kind of address it is, such as
https,dataorjavascript. - SDK: a software development kit, the tools and libraries used to build for a platform.
- Severity: the rating given to a vulnerability to express how serious it is.
- SmartWebview: one of the two JavaScript interfaces the Shopify app exposes to its webview, as named in the report.
- URL: a web address.
- Validation: checking that a value is one of the expected kinds and refusing it otherwise.
- Version code / version name: the internal number and the public number identifying an app build.
- Webview: a browser window embedded inside an app, used to show web content without leaving the app.