Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Phase 1] Refactor 0x05h-Testing-Platform-Interaction.md (@NowSecure) #2286

Merged
merged 10 commits into from
Nov 24, 2022

Conversation

dbasaraba
Copy link
Collaborator

This branch refactors 0x05h by reformatting to categorize by theory and tests. It also updates the testing sections overview to reflect the tests.

This PR closes #2217.

@dbasaraba dbasaraba changed the title Issue/2217 Issue/2217 - Refactor 0x05h-Testing-Platform-Interaction.md Oct 17, 2022
Copy link
Collaborator

@cpholguera cpholguera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @angrymuffinx! This is only a first round of review for the "Overview" section. I'll review the tests next but if you want you can start applying the suggestions.

Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved

None of the input from these sources can be trusted; it must be validated and/or sanitized. Validation ensures processing of data that the app is expecting only. If validation is not enforced, any input can be sent to the app, which may allow an attacker or malicious app to exploit app functionality.

## Fragment Injection
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move this back to the test since this is a very specific risk (and in the near future we'll actually move to the CODE category).

Copy link
Collaborator

@cpholguera cpholguera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Second round of review ^^

Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved

- **WebView APIs**:
- **Initialization**: an app might be initializing the WebView in a way to avoid storing certain information by using `setDomStorageEnabled`, `setAppCacheEnabled` or `setDatabaseEnabled` from [`android.webkit.WebSettings`](https://developer.android.com/reference/android/webkit/WebSettings "WebSettings"). The DOM Storage (for using the HTML5 local storage), Application Caches and Database Storage APIs are disabled by default, but apps might set these settings explicitly to "true".
- **Cache**: Android's WebView class offers the [`clearCache`](https://developer.android.com/reference/android/webkit/WebView#clearCache(boolean) "clearCache in WebViews") method which can be used to clear the cache for all WebViews used by the app. It receives a boolean input parameter (`includeDiskFiles`) which will wipe all stored resource including the RAM cache. However if it's set to false, it will only clear the RAM cache. Check the source code for usage of the `clearCache` method and verify its input parameter. Additionally, you may also check if the app is overriding `onRenderProcessUnresponsive` for the case when the WebView might become unresponsive, as the `clearCache` method might also be called from there.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- **Cache**: Android's WebView class offers the [`clearCache`](https://developer.android.com/reference/android/webkit/WebView#clearCache(boolean) "clearCache in WebViews") method which can be used to clear the cache for all WebViews used by the app. It receives a boolean input parameter (`includeDiskFiles`) which will wipe all stored resource including the RAM cache. However if it's set to false, it will only clear the RAM cache. Check the source code for usage of the `clearCache` method and verify its input parameter. Additionally, you may also check if the app is overriding `onRenderProcessUnresponsive` for the case when the WebView might become unresponsive, as the `clearCache` method might also be called from there.
- **Cache**: Android's WebView class offers the [`clearCache`](https://developer.android.com/reference/android/webkit/WebView#clearCache(boolean) "clearCache in WebViews") method which can be used to clear the cache for all WebViews used by the app. It receives a boolean input parameter (`includeDiskFiles`) which will wipe all stored resource including the RAM cache. However if it's set to false, it will only clear the RAM cache. Check the app for usage of the `clearCache` method and verify its input parameter. Additionally, you may also check if the app is overriding `onRenderProcessUnresponsive` for the case when the WebView might become unresponsive, as the `clearCache` method might also be called from there.

Comment on lines 596 to 598
- Deep Links. Check the test case ["Testing Deep Links"](#testing-deep-links-mstg-platform-3) as well for further test scenarios.
- IPC Mechanisms (Intents, Binders, Android Shared Memory, or BroadcastReceivers). Check the test case ["Testing for Sensitive Functionality Exposure Through IPC"](#testing-for-sensitive-functionality-exposure-through-ipc-mstg-platform-4) as well for further test scenarios.
- User interface. Check the test case ["Testing for Overlay Attacks"](#testing-for-overlay-attacks-mstg-platform-9).
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Deep Links. Check the test case ["Testing Deep Links"](#testing-deep-links-mstg-platform-3) as well for further test scenarios.
- IPC Mechanisms (Intents, Binders, Android Shared Memory, or BroadcastReceivers). Check the test case ["Testing for Sensitive Functionality Exposure Through IPC"](#testing-for-sensitive-functionality-exposure-through-ipc-mstg-platform-4) as well for further test scenarios.
- User interface. Check the test case ["Testing for Overlay Attacks"](#testing-for-overlay-attacks-mstg-platform-9).
- ["Testing Deep Links"](#testing-deep-links-mstg-platform-3)
- ["Testing for Sensitive Functionality Exposure Through IPC"](#testing-for-sensitive-functionality-exposure-through-ipc-mstg-platform-4)
- ["Testing for Overlay Attacks"](#testing-for-overlay-attacks-mstg-platform-9)


### Static Analysis

You can find some general guidelines about Android View security in the [Android Developer Documentation](https://developer.android.com/reference/android/view/View#security "View Security"), please be sure to read them carefully. For instance, the so-called _touch filtering_ is a common defense against tapjacking, which contributes to safeguarding users against these vulnerabilities, usually in combination with other techniques and considerations as we introduce in this section.

To start your static analysis you can check the source code for the following methods and attributes (non-exhaustive list):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To start your static analysis you can check the source code for the following methods and attributes (non-exhaustive list):
To start your static analysis you can check the app for the following methods and attributes (non-exhaustive list):

Copy link
Collaborator

@cpholguera cpholguera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent, thank you so much @angrymuffinx!

Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
Document/0x05h-Testing-Platform-Interaction.md Outdated Show resolved Hide resolved
@cpholguera cpholguera changed the title Issue/2217 - Refactor 0x05h-Testing-Platform-Interaction.md [Phase 1] Refactor 0x05h-Testing-Platform-Interaction.md (@NowSecure) Nov 24, 2022
@cpholguera cpholguera merged commit 23bf15c into OWASP:master Nov 24, 2022
@cpholguera cpholguera added this to the MASTG Refactor - Phase 1 milestone Nov 24, 2022
@dbasaraba dbasaraba deleted the issue/2217 branch April 1, 2024 01:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Phase 1] Refactor 0x05h-Testing-Platform-Interaction.md
2 participants