Port MASTG-TEST-0035: Testing for Android overlay attack protections#3649
Port MASTG-TEST-0035: Testing for Android overlay attack protections#3649
Conversation
…emo, and best practice Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
| --- | ||
| platform: android | ||
| title: References to Overlay Attack Protections | ||
| id: MASTG-TEST-0035 |
There was a problem hiding this comment.
Update ID to fake ID here and in the file name and demo
| id: MASTG-TEST-0035 | |
| id: MASTG-TEST-0x35 |
There was a problem hiding this comment.
Demo is missing:
class MastgTest (private val context: Context){
fun shouldRunInMainThread(): Boolean = true
fun mastgTest(): String {Co-authored-by: Jan Seredynski <janseredynski@gmail.com>
|
@copilot please do the following:
class MastgTest (private val context: Context){
fun shouldRunInMainThread(): Boolean = true
fun mastgTest(): String { |
…tructure Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
Done in commit dbe8198:
|
best-practices/MASTG-BEST-0029.md
Outdated
|
|
||
| 2. **Call `setFilterTouchesWhenObscured(true)`** programmatically on sensitive views to enable touch filtering at runtime. | ||
|
|
||
| 3. **Call `setHideOverlayWindows(true)`** on the window (API level 31+) to hide all non-system overlay windows while the activity is in the foreground. This provides stronger protection by preventing overlays entirely rather than just filtering touch events. |
There was a problem hiding this comment.
@copilot In the 1st and 2nd bullet points above you described one mechanism but applied in two different ways. The 3rd bullet points(this one) also has another way to apply the same technique by setting HIDE_OVERLAY_WINDOWS. I would even say this might be the most reliable way to stop overlays on supported API versions. I would add it too to the list.
Also, how about we sort this list by the most robust solutions. I believe HIDE_OVERLAY_WINDOWS / setHideOverlayWindows would be first one.
Then I would mention android:filterTouchesWhenObscured / setFilterTouchesWhenObscured.
Checking FLAG_WINDOW_IS_OBSCURED and FLAG_WINDOW_IS_PARTIALLY_OBSCURED might belong to a different category. They don't prevent touching UI if there is an overlay on the screen. Instead, they detect these overlays and allow to response accordingly. This might be worth mentioning.
There was a problem hiding this comment.
@copilot In the 1st and 2nd bullet points above you described one mechanism but applied in two different ways. The 3rd bullet points(this one) also has another way to apply the same technique by setting HIDE_OVERLAY_WINDOWS. I would even say this might be the most reliable way to stop overlays on supported API versions. I would add it too to the list.
Also, how about we sort this list by the most robust solutions. I believe HIDE_OVERLAY_WINDOWS / setHideOverlayWindows would be first one.
Then I would mention android:filterTouchesWhenObscured / setFilterTouchesWhenObscured.
Checking FLAG_WINDOW_IS_OBSCURED and FLAG_WINDOW_IS_PARTIALLY_OBSCURED might belong to a different category. They don't prevent touching UI if there is an overlay on the screen. Instead, they detect these overlays and allow to response accordingly. This might be worth mentioning.
Also, let's add Let's also add HIDE_OVERLAY_WINDOWS in knowledge/android/MASVS-PLATFORM/MASTG-KNOW-0022.md
in best-practices/MASTG-BEST-0029.mdIn the 1st and 2nd bullet points of the "## Recommendation", you described one mechanism but applied in two different ways. The 3rd bullet point also has another way to apply the same technique by setting Also, sort this list by the most robust solutions. e.g. make Checking in knowledge/android/MASVS-PLATFORM/MASTG-KNOW-0022.mdAdd |
… permission Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
... Done in commit 3e67a11: In MASTG-BEST-0029.md:
In MASTG-KNOW-0022.md:
|
Port MASTG-TEST-0x35: Testing for Android overlay attack protections
Ports v1 test for overlay/tapjacking attacks to v2 format. The v1 test included both static and dynamic analysis; v2 focuses exclusively on static detection of touch filtering mechanisms.
Checklist
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.