Deep Links & WebViews Exploitations Part I - by Just Mobile Security - Medium
Deep Links & WebViews Exploitations Part I - by Just Mobile Security - Medium
Listen Share
TLDR: This post is the first of a two-part series covering Deep Links & WebViews
Exploitations. This article focuses on WebViews. It analyzes the implementation and
security risks of WebViews in Android apps, including JavaScript execution
vulnerabilities and the exposure of Java objects.
TLDR2: The post uses practical examples and screenshots to demonstrate these
concepts, aiming to educate on potential exploits and necessary precautions. For all
the practical examples and exercises of this unit, we are going to use the
WebViews_&_DeepLinks-true.apk application by Just Mobile Security. Additionally
we’ll provide WebViews_&_DeepLinks-false.apk which mitigates the vulnerabilities
analyzed in this post.
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 1/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
1. XSS in WebViews
Exploitations related to Open Redirect via Deep Link and File Theft will be covered
in the next post. Each topic in this article will be explored in detail to provide a clear
understanding of their impact and mitigation strategies.
Static analysis involves examining the app’s code to pinpoint potential weaknesses.
Dynamic analysis, meanwhile, is about observing the app in action, particularly
useful for understanding how it handles network traffic.
WebViews
WebViews allow native applications to incorporate web content seamlessly. They’re
designed to be flexible, ensuring that they align with the app’s visual and functional
design. WebViews aren’t just for displaying content; they enable interactive features
such as user navigation, input processing, and the ability to execute JavaScript code,
enhancing the app’s interactive capabilities.
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 2/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
Common vulnerabilities
Web applications can be at risk from various vulnerabilities, which also extend to
WebViews, if they are not configured safely. These vulnerabilities include Open
Redirect Exploitation via Deep Link, XSS in WebViews, and potential information
or files theft.
For penetration testers, a key strategy is to analyze controllable data and input fields
within web & mobile applications. Determining if these inputs are sanitized is
crucial. This approach helps uncover implementations in Android apps that are
potentially vuln
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 3/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 4/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 5/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
2. When the WebView sends the request for getting the page, we will intercept it and
inject the XSS payload
<script>alert(‘XSS%20PoC%20by%20Just%20Mobile%20Sec’)</script>.
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 6/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 7/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 8/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 9/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 10/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
In Android versions below 4.2 (API level 17), this risk is greater as all Java Object
methods are accessible by default, leading to potential remote code execution
through malicious JavaScript injections. If you want to check this out you can install
this vulnerable version of android in an emulator and execute this metasploit
exploit to generate the PoC.
1. We decompile the APK with JADX and analyze the code to find the unsafe
implementation.
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 11/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
3. Now we generate an XSS payload to exploit this unsafe interface and obtain the
device’s information <script>alert(window.TelephonyManager.getSystemDetail())
</script>.
5. When the WebView sends the request for getting the page, we will intercept it and
inject the XSS payload.
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 12/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
The exploitation of the XSS that gets the device’s information is possible due to the
unsafe implementation of the JavaScript Interface.
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 13/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 14/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
Search
If this post was useful for you, share it! Don’t forget to follow us!
Follow
237 Followers
We are a company that focuses on the business of mobile applications, their environment and the
information that travels through them.
Jun 8, 2023 62
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 16/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
How to Improve Your Android & iOS Static Analysis with Nuclei!
TL;DR: In this post, we will cover how to statically analyze Android and iOS applications using
Nuclei. We’ll start:
Apr 29 96 1
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 17/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
Feb 22 50 2
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 18/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
n00 🔑
Android Pentesting
Android Penetration Testing is a systematic process used to identify security vulnerabilities in
an Android application. It involves using…
Mar 31 129
Jonathan Mondaut
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 19/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
Jun 19 114
Lists
Staff Picks
681 stories · 1109 saves
Self-Improvement 101
20 stories · 2234 saves
Productivity 101
20 stories · 1981 saves
Vickie Li
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 20/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
Attacking OAuth
OAuth Basics
May 9 40 1
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 21/22
04/07/2024, 16:57 Deep Links & WebViews Exploitations Part I | by Just Mobile Security | Medium
Feb 22 50 2
Ria Banerjee
Apr 30 23
https://medium.com/@justmobilesec/deep-links-webviews-exploitations-part-i-452e8aad124f 22/22