Webview Vulnerablity [OwnCloudAndroid Application]
The SAML WebView in the ownCloud Android app had JavaScript enabled, which could allow untrusted JavaScript to run. The report claims an attacker could use this to invoke Java methods and execute arbitrary commands, but no actual exploit or proof is shown.
- Triaged in 1 hour
- Fixed in 3 hours
- Disclosed after 34 days
Hi OwnCloud Team ,
###Vulnerability Description:###
What is Webview?: We can load a remote URL or display HTML pages stored in our application within an activity using WebView. Internally it uses WebKit rendering engine to display web pages. It supports methods to navigate forward and backward, text searches, etc. It has some nice features such as support for the usage of JavaScript.
###Where I found it?###
In SamlWebViewDialog.java.class located under the path android/src/com/owncloud/android/ui/dialog/
I clipped the important code which introduced this vulnerability in your app.
if (mSsoWebView == null) {
// initialize the WebView
mSsoWebView = new SsoWebView(getActivity().getApplicationContext());
mSsoWebView.setFocusable(true);
mSsoWebView.setFocusableInTouchMode(true);
mSsoWebView.setClickable(true);
WebSettings webSettings = mSsoWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setBuiltInZoomControls(false);
webSettings.setLoadWithOverviewMode(false);
webSettings.setSavePassword(false);
webSettings.setUserAgentString(MainApp.getUserAgent());
webSettings.setSaveFormData(false);
CookieManager cookieManager = CookieManager.getInstance();
cookieManager.setAcceptCookie(true);
cookieManager.removeAllCookie();
mSsoWebView.loadUrl(mInitialUrl);
}
here you can see that:
`webSettings.setJavaScriptEnabled(true);`
The WebView Object been activated to parse javascript inside it.
However by default when we create an WebView object JavaScript is disabled by default until and unless it explicitly declare by the developer.
The untrusted Javascript code can call into the Java Reflection APIs exposed by the Interface and execute arbitrary commands. Some distributions of the Android Browser app have an addJavascriptInterface call tacked on, and thus are vulnerable to RCE.
###Mitigation:###
If you turn off the setJavaScriptEnabled as follows, adversaries will not be able to run any JavaScript in order to perform XSS
webSettings.setJavaScriptEnabled(False);
###SEVERITY: High ###
It is not just limited to XSS because of javascript ! In fact, using this, an attacker can even use JavaScript to invoke certain methods on the phone, such as sending an SMS to another number, making a call, or even getting a remote shell using tools such as Drozer.
I highly recommend my article on github for the mitgation and understanding of the attack
##https://github.com/vjex/WriteUp/blob/master/WebviewVuln.md##
###More References:###
- http://www.wintellect.com/devcenter/paulballard/new-report-sites-significant-security-vulnerabilities-in-android-devices
- http://www.cvedetails.com/cve/CVE-2013-4710/
- https://community.rapid7.com/community/metasploit/blog/2015/01/02/2014-a-year-of-android-exploits-in-metasploit
- https://github.com/jduck/VulnWebView/
Happy to help. Cheers #:)#
@avicoder
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 WebView had JavaScript enabled without restricting which pages could load or exposing only safe interfaces.
Impact
The report claims an attacker could run JavaScript to invoke phone methods, send SMS, make calls, or get a remote shell, but no exploit is demonstrated and the actual risk depends on what the WebView loads.
What the attacker needed
Victim uses the app's SAML login; attacker can inject JavaScript into the loaded page
The fix
The report recommends disabling JavaScript in the WebView to stop JavaScript-based attacks.
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.
A WebView is a mini browser inside an app. This app turned on JavaScript for a login page, and the report says that if bad JavaScript got in, it might be able to run phone commands. However, the report does not show a working attack, so it is mostly a warning.
What is Mobile?
Flaws specific to Android and iOS apps: exported components, deep links, WebViews and data left on the device.