Skip to content

Conversation

serek8
Copy link
Collaborator

@serek8 serek8 commented Jul 21, 2025

This PR closes OWASP/mastg#2695

There is another MASTG PR that adds TESTs for this weakness.

@serek8 serek8 requested a review from cpholguera July 21, 2025 09:43
@cpholguera cpholguera changed the title Fixes OWASP/mastg#2695 Add MASWE-0055: Sensitive Data Leaked via Screenshots Aug 5, 2025
@cpholguera cpholguera requested a review from Diolor September 26, 2025 10:02
Comment on lines +35 to +37
- **Prevent screenshots using the `FLAG_SECURE` API**: On Android, use [`FLAG_SECURE`](https://developer.android.com/security/fraud-prevention/activities#flag_secure) to block screenshots and screen recordings of your app's content

- **Detect taking a screenshot with `DETECT_SCREEN_CAPTURE` or `sceneCaptureState` API**: Use [`DETECT_SCREEN_CAPTURE`](https://developer.android.com/reference/android/Manifest.permission#DETECT_SCREEN_CAPTURE) on Android or [`sceneCaptureState`](https://developer.apple.com/documentation/uikit/uitraitcollection/scenecapturestate) on iOS to detect when a screenshot is taken, depending on the platform
Copy link
Collaborator

Choose a reason for hiding this comment

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

Consider generalizing this, we have the best practices:

Also, "detection" doesn't mitigate the weakness, I think. Only "prevention" does, right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

To append on @cpholguera 's suggestions, one way to mitigate the issue is to not display sensitive data on screen at all (e.g. redact)

Copy link
Collaborator

@Diolor Diolor left a comment

Choose a reason for hiding this comment

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

Hi, thanks for contributing! I have added a few comments to bring this closer to a ready-to-merge state!

@@ -1,5 +1,5 @@
---
title: Sensitive Data Leaked via Screenshots
title: Sensitive Data Leaked via Screenshots or Screen Recording
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
title: Sensitive Data Leaked via Screenshots or Screen Recording
title: Sensitive Data Leaked via Screenshots or Screen Recordings


## Overview

Mobile platforms allow users and third-party tools to record screens, which can expose sensitive data and increase the risk of data leakage.
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 follow the title :) Let's emphasize that this weakness is rather a covert channel for confidentiality breaches.

Suggested change
Mobile platforms allow users and third-party tools to record screens, which can expose sensitive data and increase the risk of data leakage.
Mobile platforms allow users and third-party tools to capture screenshots or record screens. Those could act as covert channels that can expose sensitive data and increase the risk of data leakage.


- **Loss of Confidentiality**: Under certain conditions, an attacker could access sensitive data previously displayed on the screen, potentially compromising confidentiality and enabling further attacks, such as identity theft or account takeover.

## Modes of Introduction
Copy link
Collaborator

Choose a reason for hiding this comment

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

This weakness needs a combination of 2 prerequisites:

  1. The first factor is to display sensitive information in the apps. If no sensitive data displayed, no headache :)
  2. The second is what you have written below. So I would suggest structuring something like:
Suggested change
## Modes of Introduction
## Modes of Introduction
- Display sensitive data on UI
plus one of the following:
- What you have below mode 1
- Mode 2
- ...


## Modes of Introduction

- **Third-party apps with a permission to recording record the screen**: Third-party apps may record the screen while sensitive content is displayed.
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
- **Third-party apps with a permission to recording record the screen**: Third-party apps may record the screen while sensitive content is displayed.
- **Third-party apps with permission to capture or record the screen**: Third-party apps may record the screen while sensitive content is displayed.

## Modes of Introduction

- **Third-party apps with a permission to recording record the screen**: Third-party apps may record the screen while sensitive content is displayed.
- **Third-party apps with a permission to access the whole storage**: Third-party apps may access screenshots saved in storage after they are taken by the user or a tool.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Whole storage permission might not actually be required; partial access might be enough. So let's generalise the point to the minimum permission

Suggested change
- **Third-party apps with a permission to access the whole storage**: Third-party apps may access screenshots saved in storage after they are taken by the user or a tool.
- **Third-party apps with permission to access the screenshot and recording files**: Third-party apps may access screenshots or recordings saved in storage after they are taken by the user or a tool.


- **Third-party apps with a permission to recording record the screen**: Third-party apps may record the screen while sensitive content is displayed.
- **Third-party apps with a permission to access the whole storage**: Third-party apps may access screenshots saved in storage after they are taken by the user or a tool.
- **External tools may record the screen**: Tools such as [scrcpy](https://github.com/Genymobile/scrcpy) and [QuickTime](https://support.apple.com/guide/quicktime-player/welcome/mac) can record the device's screen via a USB connection.
Copy link
Collaborator

Choose a reason for hiding this comment

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

We might prefer to avoid naming tools in WEs to make them "even more agnostic" and future-proof (tools come and go, weaknesses would remain longer).
At a minimum, we should use markdown links @MASTG-TOOL-0024

Comment on lines +35 to +37
- **Prevent screenshots using the `FLAG_SECURE` API**: On Android, use [`FLAG_SECURE`](https://developer.android.com/security/fraud-prevention/activities#flag_secure) to block screenshots and screen recordings of your app's content

- **Detect taking a screenshot with `DETECT_SCREEN_CAPTURE` or `sceneCaptureState` API**: Use [`DETECT_SCREEN_CAPTURE`](https://developer.android.com/reference/android/Manifest.permission#DETECT_SCREEN_CAPTURE) on Android or [`sceneCaptureState`](https://developer.apple.com/documentation/uikit/uitraitcollection/scenecapturestate) on iOS to detect when a screenshot is taken, depending on the platform
Copy link
Collaborator

Choose a reason for hiding this comment

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

To append on @cpholguera 's suggestions, one way to mitigate the issue is to not display sensitive data on screen at all (e.g. redact)

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.

[MASWE-0055] New MASWE Weakness
3 participants