Don’t stop at one bug \(\)
An exported Android activity accepted a URL from an intent and loaded it in a WebView with JavaScript enabled, without validating the input. An attacker could use this to redirect to arbitrary sites, run JavaScript in the WebView, or read local files from the app sandbox.
Published on medium.com
{{media:0}}
The full write-up lives on its author's site
It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.
Context
This write-up covers a submission to a private Android bug bounty program in which three issues were reported from a single exported activity: an open redirect, JavaScript injection and local file theft. The activity in question is named in the report as app.company.ui.events.web.WebViewActivity, a WebView-based activity inside a company Android app. The report uses a sample app to illustrate the method, so the package name is a placeholder rather than the real target.
The common thread is an exported activity that takes a URL from the intent and hands it to a WebView. Because the activity is exported, any other app on the device can start it and supply that URL.
Setup
The only tool the researcher names is JADx-GUI, linked from its GitHub releases page. The workflow is:
- Open JADx-GUI.
- Choose File, then Open file, and select
company-app.apk. - Open
AndroidManifest.xml.

The report notes that this time the researcher used JADx-GUI rather than starting from a plain decompile.
Finding it
The first step is to search AndroidManifest.xml for activities declared with android:exported="true". The researcher found one. The report links to the Android documentation on the activity element for background on the attribute.
The report states the consequence plainly: an exported activity, service or content provider can be accessed by other apps, which makes the exported component vulnerable.
With the activity name in hand, the next step is to open that activity in JADx-GUI and search for SetJavascriptEnable. The report links to the WebSettings#setJavaScriptEnabled documentation for context.

Two code areas then matter.
Snippet 1
intent.putExtra("EXTRA_URL", str);
putExtra(String name, str) adds extended data to an intent. The first parameter is the name of the extra, the second is the data itself.
Snippet 2
loadUrl(getIntent().getStringExtra("EXTRA_URL"));
getIntent() returns the intent that started the activity, and getStringExtra("EXTRA_URL") reads the value stored under that name. In the researcher's simplified explanation, EXTRA_URL behaves like a variable: putExtra writes it and getStringExtra reads it back. The value read from the intent is passed straight to loadUrl with no validation.
Exploitation
The three proofs of concept all use the Android am start command, passing the action ACTION_OPEN_WEB and an EXTRA_URL extra.
Step 1: Open redirect
am start -W -n app.company/.ui.events.web.WebViewActivity -a ACTION_OPEN_WEB -e EXTRA_URL https://evil.com
-n names the component to start, -a sets the action, and -e adds a string extra named EXTRA_URL with the value https://evil.com. The activity loads the URL it receives from the extra.

Step 2: JavaScript injection
am start -n app.company/.ui.events.web.WebViewActivity -a ACTION_OPEN_WEB -e EXTRA_URL "javascript://google.com%0A alert(lol);"
The activity does not validate the data passed to the intent, so a javascript: URL is accepted. The payload uses a javascript: URL with a %0A newline before alert(lol);. Combined with JavaScript being enabled in the WebView, this gives script execution in the WebView context.

Step 3: Local file theft
am start -n app.company/.ui.events.web.WebViewActivity -a ACTION_OPEN_WEB -e EXTRA_URL 'file:///sdcard/personal.txt'
Here the extra is a file:// URL pointing at external storage. The report lists what this class of bug can reach:
- tokens, auth data and config inside the app sandbox
- user data inside the app sandbox
- data under
/sdcard, if permission allows


Root cause
The activity is exported, so any app on the device can start it. It reads EXTRA_URL from the intent and passes the value directly to loadUrl without checking the scheme or the destination. Because the WebView has JavaScript enabled, a javascript: URL is executed rather than treated as an inert string, and a file:// URL is loaded from local storage. The report does not describe any allowlist, scheme check or caller verification that would have blocked these inputs.
Impact
An attacker who can install an app on the same device, or otherwise start the activity, can redirect the WebView to an arbitrary site, run script inside it, and read local files that the WebView can reach. The file theft is bounded by what the app sandbox and storage permissions allow: the report hedges the /sdcard case with "if permitted". The report does not give a bounty amount or a severity rating.
Fix
The natural fixes, given the root cause, are to stop exporting the activity unless another app genuinely needs it, and to validate EXTRA_URL against an allowlist of trusted schemes and hosts before calling loadUrl, rejecting javascript: and file:// values. Disabling JavaScript in the WebView where it is not required would remove the injection path as well.
Variants to test
- Search the manifest for other
android:exported="true"activities, services and receivers, and check whether each one takes a URL, a file path or an intent extra that reaches a sink. A positive result is a component you can start from another app witham startand observe the effect. - Grep decompiled code for
loadUrlcalls whose argument comes fromgetIntent(). A positive result is a value you control reaching the WebView. - Try other schemes in the same extra, such as
javascript:,file://,content://andintent://. A positive result is script execution or a local file rendering in the WebView. - Check whether
setJavaScriptEnabledis on in activities that load remote or user-supplied content. A positive result is ajavascript:URL executing. - Test deep links and custom schemes declared in the manifest for the same unvalidated forwarding into a WebView.
What happened, in plain words
A security researcher spent some time looking inside an Android app that belonged to a company running a private bug bounty programme. A bug bounty programme is an arrangement where a company invites outside people to look for security mistakes in its products and pays them for reporting what they find. "Private" means you can only take part if you are invited; the programme is not open to the public.
Inside that app, the researcher found one small design decision that led to three separate security problems. All three came from the same place: a single screen inside the app that any other app on the phone is allowed to open, and that will happily load whatever web address it is handed. Because it never checks what it is given, an attacker can make it open a malicious website, run their own code inside it, or read files stored on the phone.
The three problems are:
- Open redirect: the app can be made to send its built-in browser to any website the attacker chooses.
- JavaScript injection: the app can be made to run script code that the attacker supplies.
- Local file theft: the app can be made to open files stored on the phone, which the attacker should not be able to see.
The report uses a made-up example app to explain the method, so the app name you will see, app.company, is a placeholder, not the real company.
Background: the pieces you need to know
Before walking through the steps, here are the ideas the report relies on, explained from scratch.
An APK is the file format Android uses to install an app. Think of it as a zip archive: it contains the compiled program plus a set of text files describing how the app is put together. You can open one on a computer with the right tool and read those files.
Decompiling means turning the compiled program back into something close to readable source code. It is not perfect, but it is good enough to follow what the app does. The researcher used a free tool called JADx-GUI, which opens an APK and shows you its contents in a window you can browse and search.
An activity is one screen of an Android app. When you tap a button and a new screen slides in, that screen is usually an activity. Every activity has a name, written like app.company.ui.events.web.WebViewActivity, which is just a label that identifies it inside the app.
A WebView is a small browser built into an app. Many apps do not write their own way of displaying web pages; they embed a WebView and point it at a page. That is how apps show help pages, login screens or news without leaving the app.
An intent is the message Android uses when one part of the system wants another part to do something. "Open this screen and give it this piece of data" is an intent. Intents can carry small named values alongside them, called extras. An extra is like a labelled envelope: it has a name (the label) and a value (what is inside).
Exported is a setting on an activity. If an activity is exported, any other app on the same phone is allowed to send it an intent and start it. If it is not exported, only the app it belongs to can start it. Exporting is sometimes necessary, for example when a feature is meant to be opened from a link in another app, but it also means strangers can knock on that door.
The app sandbox is the private storage area Android gives each app. One app cannot normally read another app's files. The sandbox is where an app keeps things like login tokens, configuration and user data.
A token is a short string of characters that proves who you are, a bit like a wristband at an event: show it and you are let in, without having to prove your identity again. If someone steals a token, they can often act as you. That is why files inside the sandbox matter.
/sdcard is the shared storage area on an Android phone, where photos, downloads and other files that many apps can see are kept. Access to it depends on permissions the user has granted.
am start is a command you can run on an Android device (for example through a debugging connection from a computer) that tells Android to start an activity. It is the same mechanism an app would use, just typed out by hand, which makes it a convenient way to prove that another app could do the same thing.
A URL scheme is the first part of a web address, before the ://. https:// means a normal website. javascript: means "run the text that follows as code". file:// means "open a file on this device". A WebView that accepts any scheme will treat each of these very differently, and that difference is the heart of this report.
Step 1: Opening the app file
The researcher's starting point was to decompile the APK. The only tool named in the report is JADx-GUI, linked from its releases page on GitHub. The workflow is short:
- Open JADx-GUI.
- Choose File, then Open file, and select
company-app.apk. - Open
AndroidManifest.xml.

The report notes that this time the researcher used JADx-GUI rather than starting from a plain decompile, which is simply a choice of tool: JADx-GUI gives you a browsable, searchable view instead of a pile of output files.
Why start here? Because the manifest is the app's own description of itself. It lists every screen, service and other component, and for each one it says whether outsiders may start it. Reading it is the quickest way to see which doors are open to other apps.
Step 2: Finding an open door
The first real step is to search AndroidManifest.xml for activities declared with android:exported="true". The researcher found one. The report links to the Android documentation on the activity element for background on the attribute.
The report states the consequence plainly: an exported activity, service or content provider can be accessed by other apps, which makes the exported component vulnerable.
Think of it like a block of flats where one flat has left its front door unlocked onto the street. Most flats are only reachable through the main entrance, which is the app itself. This one can be entered directly by anyone walking past, and on a phone "anyone walking past" means any other app installed on the same device.
Step 3: Reading the code behind the door
With the activity name in hand, the next step is to open that activity in JADx-GUI and search for SetJavascriptEnable. The report links to the WebSettings#setJavaScriptEnabled documentation for context.

Why search for this? A WebView can be told whether or not to run JavaScript, the programming language of the web. Many apps turn it on because their pages need it. But if a WebView runs JavaScript and also loads addresses supplied by someone else, then a javascript: address stops being a harmless piece of text and becomes code the WebView will execute. Finding this setting tells you the injection path is open before you even try it.
Two code areas then matter.
Snippet 1
intent.putExtra("EXTRA_URL", str);
This line writes a value into the intent. putExtra takes two things: a name and the data. Here the name is EXTRA_URL and the data is whatever is held in str. In plain terms: "attach this piece of text to the message, and label it EXTRA_URL so the other side can find it again".
Snippet 2
loadUrl(getIntent().getStringExtra("EXTRA_URL"));
This line reads the value back out and hands it to the WebView. getIntent() returns the intent that started the activity, and getStringExtra("EXTRA_URL") looks up the value stored under that name. loadUrl then tells the WebView to open whatever address it was given. In the researcher's simplified explanation, EXTRA_URL behaves like a variable: putExtra writes it and getStringExtra reads it back. The value read from the intent is passed straight to loadUrl with no validation.
That last point is the whole bug. There is no check on what kind of address arrives. A normal website, a javascript: address and a file:// address are all treated the same way: load it. It is like a receptionist who forwards every caller to whoever they ask for, without checking whether the caller is allowed to speak to that person.
Step 4: Proving it, three times
The three proofs of concept all use the Android am start command, passing the action ACTION_OPEN_WEB and an EXTRA_URL extra. A proof of concept is a small, repeatable demonstration that a problem is real rather than theoretical; it is what turns "this looks wrong" into "here is what happens".
Open redirect
am start -W -n app.company/.ui.events.web.WebViewActivity -a ACTION_OPEN_WEB -e EXTRA_URL https://evil.com
Line by line:
am startasks Android to start something.-Wtells the command to wait until the activity has finished launching before returning, so you can see the result in order.-n app.company/.ui.events.web.WebViewActivitynames exactly which component to start: the packageapp.company, then the activity inside it.-a ACTION_OPEN_WEBsets the action, a label describing what the caller wants to do. The activity uses it to recognise this kind of request.-e EXTRA_URL https://evil.comadds a text extra namedEXTRA_URLwith the valuehttps://evil.com.evil.comis a stand-in domain used in examples to mean "a site the attacker controls".
The activity loads the URL it receives from the extra. The app's own screen loads the URL on request from any other app.

JavaScript injection
am start -n app.company/.ui.events.web.WebViewActivity -a ACTION_OPEN_WEB -e EXTRA_URL "javascript://google.com%0A alert(lol);"
Line by line:
am startstarts the activity, as before.-n app.company/.ui.events.web.WebViewActivitynames the same exported activity.-a ACTION_OPEN_WEBsets the same action.-e EXTRA_URLadds the extra, and the value this time is ajavascript:address rather than a website.
The activity does not validate the data passed to the intent, so a javascript: URL is accepted. The payload uses a javascript: URL with a %0A newline before alert(lol);. Combined with JavaScript being enabled in the WebView, this gives script execution in the WebView context.
In everyday terms: the WebView is asked to open an address, but the address begins with a word that means "run what follows as code". The newline is there to end the harmless-looking part and start the attacker's instruction on a fresh line. alert(lol); is a deliberately trivial script, a pop-up, used to show that code runs at all.

Local file theft
am start -n app.company/.ui.events.web.WebViewActivity -a ACTION_OPEN_WEB -e EXTRA_URL 'file:///sdcard/personal.txt'
Line by line:
am startstarts the activity.-n app.company/.ui.events.web.WebViewActivitynames the exported activity.-a ACTION_OPEN_WEBsets the action.-e EXTRA_URL 'file:///sdcard/personal.txt'supplies afile://address, which means "open a file stored on this device", pointing at a file in shared storage.
Here the extra is a file:// URL pointing at external storage. The report lists what this class of bug can reach:
- tokens, auth data and config inside the app sandbox
- user data inside the app sandbox
- data under
/sdcard, if permission allows
The phrase "if permission allows" matters: reading shared storage depends on what the user has granted the app, so the report does not claim it always works. The sandbox cases are the more serious ones, because that is where login tokens and private user data live.


Why one bug became three
All three problems share a single root cause. The activity is exported, so any app on the device can start it. It reads EXTRA_URL from the intent and passes the value directly to loadUrl without checking the scheme or the destination. Because the WebView has JavaScript enabled, a javascript: URL is executed rather than treated as an inert string, and a file:// URL is loaded from local storage. The report does not describe any allowlist, scheme check or caller verification that would have blocked these inputs.
This is the lesson in the title. Once you find one way in, do not stop: ask what else the same unchecked input can do. The same missing check produced a redirect, code execution and file access, which are three very different kinds of harm from one line of code.
What an attacker could do with it
An attacker who can install an app on the same device, or otherwise start the activity, can redirect the WebView to an arbitrary site, run script inside it, and read local files that the WebView can reach. The file theft is bounded by what the app sandbox and storage permissions allow: the report hedges the /sdcard case with "if permitted". The report does not give a bounty amount or a severity rating.
How it would be fixed
The natural fixes, given the root cause, are to stop exporting the activity unless another app genuinely needs it, and to validate EXTRA_URL against an allowlist of trusted schemes and hosts before calling loadUrl, rejecting javascript: and file:// values. An allowlist is the opposite of a blocklist: instead of trying to name every bad thing, you name the few good things and refuse everything else. Disabling JavaScript in the WebView where it is not required would remove the injection path as well.
Where else to look
If you want to try the same approach on an app you are authorised to test, these are the follow-up checks the report's method suggests:
- Search the manifest for other
android:exported="true"activities, services and receivers, and check whether each one takes a URL, a file path or an intent extra that reaches a sink. A sink is any place where a value is actually used, such as a WebView loading it. A positive result is a component you can start from another app witham startand observe the effect. - Grep decompiled code for
loadUrlcalls whose argument comes fromgetIntent(). A positive result is a value you control reaching the WebView. - Try other schemes in the same extra, such as
javascript:,file://,content://andintent://. A positive result is script execution or a local file rendering in the WebView. - Check whether
setJavaScriptEnabledis on in activities that load remote or user-supplied content. A positive result is ajavascript:URL executing. - Test deep links and custom schemes declared in the manifest for the same unvalidated forwarding into a WebView. A deep link is a link that opens a specific screen inside an app rather than a web page.
Glossary
- Activity: one screen of an Android app, such as a login page or a settings page.
- Allowlist: a list of things that are permitted, with everything else refused by default.
am start: an Android command that asks the system to start an activity, used here to imitate what another app could do.- AndroidManifest.xml: the file inside an APK that describes the app's components and their settings.
- APK: the installable file format for an Android app; a package containing the compiled program and its description files.
- App sandbox: the private storage area Android gives each app, which other apps cannot normally read.
- Bug bounty programme: an arrangement where a company pays outside researchers for reporting security problems in its products.
- Decompiling: turning a compiled program back into readable source-like code.
- Deep link: a link that opens a specific screen inside an app instead of a web page.
- Exported: a setting that lets other apps start a component; non-exported components can only be started by their own app.
- Extra: a small named value attached to an intent, like a labelled envelope carrying data.
- Intent: the message Android uses to ask one component to do something, optionally carrying extras.
- JADx-GUI: a free tool that opens an APK and lets you browse and search its decompiled contents.
- JavaScript: the programming language that web pages run in a browser or WebView.
- JavaScript injection: getting script code of your own into a place that then runs it.
- Local file theft: reading files stored on the device that the attacker should not be able to reach.
- Open redirect: making a trusted app or site send its user to an address the attacker chooses.
- Private programme: a bug bounty programme that only invited researchers may take part in.
- Proof of concept: a small, repeatable demonstration that a security problem is real.
- Root cause: the underlying mistake that produces a symptom; fixing it removes the symptom.
/sdcard: the shared storage area on an Android phone, holding files many apps can access, subject to permissions.- Sink: a place in code where a value is actually used, such as a WebView loading a URL.
- Token: a short string that proves identity, like a wristband; stealing one can let an attacker act as the user.
- URL scheme: the part of an address before
://, such ashttps,javascriptorfile, which tells the receiver how to treat it. - WebView: a small browser embedded inside an app to display web content.