Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 26, 2026

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.

Changes

Test (MASTG-TEST-0035)

  • Detects references to setFilterTouchesWhenObscured, onFilterTouchEventForSecurity, and obscured window flag checks
  • Links to MASWE-0053, MASTG-KNOW-0022, MASTG-BEST-0029
  • Evaluation considers targetSdkVersion and sensitive UI context

Demo (MASTG-DEMO-0083)

  • Kotlin code showing three implementations: vulnerable button, protected button with filterTouchesWhenObscured, custom override with flag checking
  • Semgrep-based detection with verified output
  • Decompiled Java included for static analysis validation

Semgrep Rule (mastg-android-overlay-protection.yml)

  • 5 detection rules covering method calls, overrides, flag checks, and XML attributes
  • All rules use INFO severity as these indicate protections, not vulnerabilities

Best Practice (MASTG-BEST-0029)

  • Documents all Android overlay protection mechanisms with implementation guidance
  • Includes caveats about version-specific vulnerabilities and system-level attacks
  • References official Android tapjacking documentation

Knowledge Article Update (MASTG-KNOW-0022)

  • Added API references and links to Android security documentation
  • Enhanced descriptions of defensive mechanisms

V1 Deprecation

  • Marked old test as deprecated with covered_by: [MASTG-TEST-0035]

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • developer.android.com
    • Triggering command: /home/REDACTED/work/_temp/ghcca-node/node/bin/node /home/REDACTED/work/_temp/ghcca-node/node/bin/node --enable-source-maps /home/REDACTED/work/_temp/copilot-developer-action-main/dist/index.js (dns block)
    • Triggering command: /usr/bin/curl curl -s REDACTED (dns block)
  • semgrep.dev
    • Triggering command: /home/REDACTED/.local/bin/pysemgrep osemgrep -c ../../../../rules/mastg-android-overlay-protection.yml ./MastgTest_reversed.java --text -o output.txt (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>MASTG v1->v2 MASTG-TEST-0035: Testing for Overlay Attacks (android)</issue_title>
<issue_description>
Create a new MASTG v2 test covering for:

Focus on static analysis and ignore the dynamic analysis section in the old MASTG-TEST-0035.

Create also:

  • a demo in demos/
  • a best practice in best-practices/

Follow the guidelines in .github/instructions/porting-mastg-v1-tests-to-v2.instructions.md as well as other .github/instructions/

References:

</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 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.

…emo, and best practice

Co-authored-by: cpholguera <29175115+cpholguera@users.noreply.github.com>
Copilot AI changed the title [WIP] Add MASTG v2 test for overlay attacks on Android Port MASTG-TEST-0035: Static analysis for Android overlay attack protections Jan 26, 2026
Copilot AI requested a review from cpholguera January 26, 2026 09:48
@@ -0,0 +1,52 @@
---

Choose a reason for hiding this comment

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

⚠️ Duplicate MASTG-DEMO ID Detected

This file has the ID MASTG-DEMO-0083 which already exists in demos/ios/MASVS-NETWORK/MASTG-DEMO-0083/MASTG-DEMO-0083.md.

IMPORTANT: Please use the next available ID: MASTG-DEMO-0087

- The `setFilterTouchesWhenObscured` method
- The `android:filterTouchesWhenObscured` attribute in layout files
- The `onFilterTouchEventForSecurity` method
- Checks for `FLAG_WINDOW_IS_OBSCURED` or `FLAG_WINDOW_IS_PARTIALLY_OBSCURED` flags
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
- Checks for `FLAG_WINDOW_IS_OBSCURED` or `FLAG_WINDOW_IS_PARTIALLY_OBSCURED` flags
- Checks for `FLAG_WINDOW_IS_OBSCURED` or `FLAG_WINDOW_IS_PARTIALLY_OBSCURED` flags
- The [`setHideOverlayWindows`](https://developer.android.com/reference/android/view/Window#setHideOverlayWindows(boolean)) method

There is a Manifest equivalent flag that works globally in the same way HIDE_OVERLAY_WINDOWS

Let's also add it to BEST-0029 and KNOW

profiles: [L2]
status: deprecated
covered_by: [MASTG-TEST-0035]
deprecation_note: "New version available in MASTG V2 focusing on static analysis only"
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
deprecation_note: "New version available in MASTG V2 focusing on static analysis only"
deprecation_note: "New version available in MASTG V2"

---
platform: android
title: References to Overlay Attack Protections
id: MASTG-TEST-0035
Copy link
Collaborator

Choose a reason for hiding this comment

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

Update ID to fake ID here and in the file name and demo

Suggested change
id: MASTG-TEST-0035
id: MASTG-TEST-0x35

@cpholguera cpholguera requested a review from serek8 January 26, 2026 20:19
@cpholguera cpholguera changed the title Port MASTG-TEST-0035: Static analysis for Android overlay attack protections Port MASTG-TEST-0035: Testing for Android overlay attack protections Jan 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MASTG v1->v2 MASTG-TEST-0035: Testing for Overlay Attacks (android)

3 participants