diff --git a/tests/android/MASVS-CODE/MASTG-TEST-0x27-1.md b/tests/android/MASVS-CODE/MASTG-TEST-0x27-1.md index cb4ddca8dd..4316f34fac 100644 --- a/tests/android/MASVS-CODE/MASTG-TEST-0x27-1.md +++ b/tests/android/MASVS-CODE/MASTG-TEST-0x27-1.md @@ -1,6 +1,6 @@ --- Title: Testing for URL Loading in WebViews -ID: MASTG-TEST-0027 +ID: MASTG-TEST-0x27-1 Link: https://mas.owasp.org/MASTG/tests/android/MASVS-CODE/MASTG-TEST-0027/ Platform: android type: [static] @@ -14,8 +14,9 @@ By default, navigation events inside of a WebView will redirect to the default b ## Steps -1. -To test if the app is overriding the default page navigation logic by configuring a `WebViewClient`, search for and inspect the following interception callback functions: +1. Examine the application's code (see @MASTG-TECH-0023) +2. Look for occurences of WebViews being used and examine if they are configured with a custom `WebViewClient`. +3. Search for and inspect the following interception callback functions for the `WebViewClient`: - `shouldOverrideUrlLoading` allows your application to either abort loading pages with suspicious content by returning `true` or allow the WebView to load the URL by returning `false`. Considerations: - This method is not called for POST requests. diff --git a/tests/android/MASVS-CODE/MASTG-TEST-0x27-2.md b/tests/android/MASVS-CODE/MASTG-TEST-0x27-2.md index 9184cb72e1..e42a302ae1 100644 --- a/tests/android/MASVS-CODE/MASTG-TEST-0x27-2.md +++ b/tests/android/MASVS-CODE/MASTG-TEST-0x27-2.md @@ -1,46 +1,34 @@ --- Title: Testing for URL Loading in WebViews -ID: MASTG-TEST-0027 +ID: MASTG-TEST-0x27-2 Link: https://mas.owasp.org/MASTG/tests/android/MASVS-CODE/MASTG-TEST-0027/ Platform: android -type: [static] +type: [dynamic] MASVS v1: ['MSTG-PLATFORM-2'] MASVS v2: ['MASVS-CODE-4'] --- ## Overview -In order to test for [URL loading in WebViews](../../../Document/0x05h-Testing-Platform-Interaction.md#url-loading-in-webviews "URL Loading in WebViews") you need to carefully analyze [handling page navigation](https://developer.android.com/guide/webapps/webview#HandlingNavigation "Handling page navigation"), especially when users might be able to navigate away from a trusted environment. The default and safest behavior on Android is to let the default web browser open any link that the user might click inside the WebView. However, this default logic can be modified by configuring a `WebViewClient` which allows navigation requests to be handled by the app itself. +By default, navigation events inside of a WebView will redirect to the default browser application. However, it is possible to stay within the WebView and handle all new page loads. This can be dangerous, as the new page may be malicous and interact with either the JavaScript bridge, or phish the user. The application should monitor navigation events inside the WebView to make sure that only legitimate pages are loaded, while others are redirected to the browser application. ## Steps -To test if the app is overriding the default page navigation logic by configuring a `WebViewClient`, search for and inspect the following interception callback functions: - -- `shouldOverrideUrlLoading` allows your application to either abort loading pages with suspicious content by returning `true` or allow the WebView to load the URL by returning `false`. Considerations: - - This method is not called for POST requests. - - This method is not called for XmlHttpRequests, iFrames, "src" attributes included in HTML or `