Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ The sensitive data is stored using `localStorage.setItem` in the inline HTML loa
4. Click the **Start** button in the app
5. Wait for the Frida script to capture the WebView cleanup calls
6. Stop the script by quitting the Frida CLI
7. Use @MASTG-TECH-0002 to search the contents of the `/data/data/<app_package>/app_webview/` directory for the sensitive data used in the WebView.
7. Use @MASTG-TECH-0142 to search the contents of the `/data/data/<app_package>/app_webview/` directory for the sensitive data used in the WebView.

{{ script.js # run.sh }}

Expand Down
54 changes: 52 additions & 2 deletions techniques/android/MASTG-TECH-0142.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,56 @@ title: Inspecting WebView Storage
platform: android
---

To inspect WebView Storage, first follow the steps in official ["Remote debugging WebViews" documentation](https://developer.chrome.com/docs/devtools/remote-debugging/webviews) to connect Chrome DevTools to the WebView of your app.
You can inspect WebView storage either directly on the device file system or using Chrome DevTools. @MASTG-KNOW-0018 describes the different storage areas and what to expect in each.

With the DevTools open, navigate to the Application tab. In the Storage section, you can inspect the different storage areas of the WebView.
## Direct File System Inspection

Android WebView stores its data in the `/data/data/<app_package>/app_webview/` directory. You can access and retrieve the contents of this directory using @MASTG-TECH-0002:

- **Using @MASTG-TOOL-0004**: Pull the directory directly with `adb pull`:

```bash
adb pull /data/data/<app_package>/app_webview/ ./app_webview/
```

You can then inspect the contents locally. To search for specific data without pulling the directory, use `adb shell`:

```bash
adb shell grep -r "<sensitive_data>" /data/data/<app_package>/app_webview/
```

!!! note
This requires either a rooted device or a debuggable app. On a non-rooted device with a non-debuggable app, `adb` won't have access to the app's private data directory.

- **Using @MASTG-TOOL-0007**: Open the Device File Explorer in Android Studio via **View** -> **Tool Windows** -> **Device File Explorer** and navigate to `/data/data/<app_package>/app_webview/`. You can then browse and download files directly from the UI.

!!! note
This requires either a rooted device or a debuggable app.

- **Using @MASTG-TOOL-0038**: Connect to the app with objection and navigate to the `app_webview` directory to list and download files:

```bash
objection -g <app_package> explore
```

```bash
# Navigate to the app_webview directory
cd app_webview

# List contents
ls

# Download a specific file
filesystem download <file_name>

# Download the entire directory
filesystem download app_webview ./app_webview --folder
```

This approach works without requiring a rooted device and without setting the app as debuggable.

## Using Chrome DevTools

To inspect WebView storage interactively, first follow the steps in the official ["Remote debugging WebViews" documentation](https://developer.chrome.com/docs/devtools/remote-debugging/webviews) to connect Chrome DevTools to the WebView of your app.

With the DevTools open, navigate to the **Application** tab. In the **Storage** section, you can inspect the different storage areas of the WebView.
2 changes: 1 addition & 1 deletion tests-beta/android/MASVS-PLATFORM/MASTG-TEST-0320.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This test uses dynamic analysis to monitor the relevant API calls and file syste
3. Open the app.
4. Use the app extensively to ensure that all relevant WebViews are covered and that sensitive data is loaded into them. Ensure you keep a list of the sensitive data you expect to be cleaned up.
5. Close the app.
6. Use @MASTG-TECH-0002 to pull the contents of the `/data/data/<app_package>/app_webview/` directory or simply search for the sensitive data used in the WebView within that directory.
6. Use @MASTG-TECH-0142 to inspect the contents of the `/data/data/<app_package>/app_webview/` directory or simply search for the sensitive data used in the WebView within that directory.

## Observation

Expand Down
Loading