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

[MSTG-STORAGE-12] Add Privacy Labels and Rework Privacy Chapter #1988

Merged
merged 36 commits into from
Dec 22, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
55d3704
add nutrition and data safety labels, references and first steps on t…
cpholguera Nov 24, 2021
8201839
add privacy report, data access audit and privacy dashboard.
cpholguera Nov 24, 2021
8eacbc5
Update Document/0x04i-Testing-user-interaction.md
cpholguera Nov 26, 2021
0057c88
remove unreferenced requirements
cpholguera Dec 2, 2021
3df7fc2
rewrite User Interaction since it's actually about User Provacy Prote…
cpholguera Dec 2, 2021
bd2d1ff
Merge branch 'enhance-storage-2' of github.com:OWASP/owasp-mstg into …
cpholguera Dec 2, 2021
7053d94
rename chapter file to be consistent
cpholguera Dec 2, 2021
761e348
change name also in the README
cpholguera Dec 2, 2021
7c35ccc
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
dbbb5dd
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
66c7879
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
2b7bda3
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
80d1518
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
0d5b88b
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
fe8d977
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
c91535f
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
0d5c2dc
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
ec27148
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
b8e43c6
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
622bd5f
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
4c0cce8
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
fddccfc
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
89db17f
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
b808850
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
7d5ad6e
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
7569113
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
463ebef
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
04bb15f
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
13fea44
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
9f36097
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
9298da0
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
0ba1b66
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
305e0c7
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 14, 2021
f29cfec
Update Document/0x04i-Testing-User-Privacy-Protection.md
cpholguera Dec 18, 2021
296ba05
fix to reduce the scope of the test
cpholguera Dec 22, 2021
17479d1
update common violations to express the relationship with other categ…
cpholguera Dec 22, 2021
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
10 changes: 0 additions & 10 deletions Document/0x04b-Mobile-App-Security-Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -366,13 +366,3 @@ The security of an application developed with DevOps must be considered during o

- [paul] - M. Paul. Official (ISC)2 Guide to the CSSLP CBK, Second Edition ((ISC)2 Press), 2014
- [mcgraw] - G McGraw. Software Security: Building Security In, 2006

### OWASP MASVS

- MSTG-ARCH-1: "All app components are identified and known to be needed."
- MSTG-ARCH-3: "A high-level architecture for the mobile app and all connected remote services has been defined and security has been addressed in that architecture."
- MSTG-ARCH-4: "Data considered sensitive in the context of the mobile app is clearly identified."
- MSTG-ARCH-5: "All app components are defined in terms of the business functions and/or security functions they provide."
- MSTG-ARCH-6: "A threat model for the mobile app and the associated remote services has been produced that identifies potential threats and countermeasures."
- MSTG-ARCH-7: "All security controls have a centralized implementation."
- MSTG-ARCH-10: "Security is addressed within all parts of the software development lifecycle."
136 changes: 136 additions & 0 deletions Document/0x04i-Testing-User-Privacy-Protection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# Mobile App User Privacy Protection

**IMPORTANT DISCLAIMER:** the MSTG is not a legal handbook. Therefore, we will not deep-dive into the GDPR or other possibly relevant legislations here. This chapter is meant to introduce you to the topics and provide you with essential references that you can use to continue researching by yourself. We'll also do our best effort to provide you with tests or guidelines for testing the privacy related requirements listed in the OWASP MASVS.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

## Overview

### The Main Problem

Mobile apps handle all kinds of sensitive user data, from identification or banking information to health data. There's an understadable concern about how this data is handled and where it ends up. We can also talk about "benefits users get from using the apps" vs "the real price that they are paying for it" (usually and unfortunately without even being aware of it).
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

### The Solution (pre 2020)

To ensure that users are properly protected, legislations such as the [General Data Protection Regulation (GDPR)](https://gdpr-info.eu/ "GDPR") in Europe have been developed and deployed (applicable since May 25th, 2018), forcing developers to be more transparent regarding the handling of sensitive user data. This has been mainly implemented using privacy policies.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

### The Challenge

There are two main dimensions to consider here:

- **Developer Compliance**: Developers need to comply with legal privacy princicples since they are enforced by law and therefore need to better comprehend the legal principles in order to know what exactly they need to implement to remain compliant. Ideally at least the following must be followed:
cpholguera marked this conversation as resolved.
Show resolved Hide resolved
- **Privacy-by-Design** approach (Art. 25 GDPR, "Data protection by design and by default").
- **Principle of Least Privilege** ("every program and every user of the system should operate using the least set of privileges necessary to complete the job").
cpholguera marked this conversation as resolved.
Show resolved Hide resolved
- **User Education**: users need to be educated on what is their sensitive data, be informed about how to use the application properly (to ensure a secure handling and processing of their information).
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

> Note: More often than not apps will claim to handle certain data and in reality that's not the case. The IEEE article ["Engineering Privacy in Smartphone Apps: A Technical Guideline Catalog for App Developers" by Majid Hatamian](https://www.researchgate.net/publication/339349349_Engineering_Privacy_in_Smartphone_Apps_A_Technical_Guideline_Catalog_for_App_Developers) gives a very nice introduction to this topic.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

### Protection Goals for Data Protection

When an app needs personal information from a user for its business process, the user needs to be informed on what happens with the data and why the app needs it. If there is a third party doing the actual processing of the data, the app should inform the user about that too.

Surely you're already familiar with the classic triad of security protection goals: confidentiality, integrity, and availability. However, you might not be aware of the three protection goals focusing on data protection have been proposed:
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

- **Unlinkability**:
- Users' privacy-relevant data must be unlinkable to any other set of privacy-relevant data outside of the domain
cpholguera marked this conversation as resolved.
Show resolved Hide resolved
- Includes: data minimization, anonymisation, pseudonymisation, etc.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved
- **Transparency**:
- Users should be able to request all information that the application has on them, and be explained how to request this information.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved
- Includes: privacy policies, user education, proper logging and auditing mechanisms, etc.
- **Intervenability**:
- Users should be able to correct their personal information, request its deletion and withdraw any given consent at any time, and be explained how to do so.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved
- Includes: privacy settings directly in the app, single points of contact for individuals’ intervention requests (e.g. in-app chat, telephone number, e-mail), etc.

> See Section 5.1.1 "Introduction to data protection goals" in ENISA's ["Privacy and data protection in mobile applications"](https%3A%2F%2Fwww.enisa.europa.eu%2Fpublications%2Fprivacy-and-data-protection-in-mobile-applications%2Fat_download%2FfullReport&usg=AOvVaw06m90YDUaLCeeD2r-Ompgn) for more detailed descriptions.

Addressing both security and privacy protection goals at the same time is a very challenging task (if not impossible in many cases). There's even an interesting visualization in IEEE's publication [Protection Goals for Privacy Engineering](https://ieeexplore.ieee.org/document/7163220) called ["The Three Axes"](https://ieeexplore.ieee.org/document/7163220#sec2e) representing the impossibility to ensure 100% of each of the six goals simultaneously.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

Most part of the processes derived from the protection goals are traditionally being covered in a privacy policy. However, this approach is not always optimal:
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

- developers are not legal experts but still need to be compliant.
- users would be require to read usually long and wordly policies.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

### The New Approach (Google's and Apple's take on this)

In order to address these challenges and help users easily understand how their data is being collected, handled and shared, Google and Apple introduced new privacy labeling systems (very much along the lines of NIST's proposal for [Consumer Software Cybersecurity Labeling](https://www.nist.gov/system/files/documents/2021/11/01/Draft%20Consumer%20Software%20Labeling.pdf):

- the App Store [Nutrition Labels](https://www.apple.com/privacy/labels/) (since 2020).
- the Google Play [Data Safety Labels](https://android-developers.googleblog.com/2021/05/new-safety-section-in-google-play-will.html) (since 2021).

As a new requirement on both platforms, it's vital that these labels are accurate in order to provide user assurance and mitigate developer abuse.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

### Common Violations that Can Be Addressed with the New Approach
Copy link
Collaborator

Choose a reason for hiding this comment

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

How shall the Pentester verify "An app that records a user’s screen and doesn't treat this data as personal or sensitive data that is subject to this policy." and also the others listed? Does this mean the nutrition / data safety label is missing?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We could make this maybe part of the test case below, or otherwise reference to it to make it clear how to test.


This is a non-exhaustive list of common violations that you as as security tester should report:
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

- An app collects device location but does not have a prominent disclosure explaining which feature uses this data and/or indicates the app's usage in the background.
- An app has a runtime permission requesting access to data before the prominent disclosure which specifies what the data is used for.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved
- An app that accesses a user's phone or contact book data and doesn't treat this data as personal or sensitive data subject to the above Privacy Policy, data handling, and Prominent Disclosure and Consent requirements.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved
- An app that records a user’s screen and doesn't treat this data as personal or sensitive data subject to this policy.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

Since we keep talking about location, contacts, screen recordings, etc., you probably have noticed that all of this is closely related to app permissions. App developers must explain the user why your app needs the permissions it requests. Both [iOS](https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/requesting-permission/) and [Android](https://developer.android.com/training/permissions/requesting.html#explain) have specific guidelines and best practices for that.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

> App Permissions have its own dedicated requirement in the OWASP MASVS, we suggest that you refer to the related test "Testing App Permissions (MSTG-PLATFORM-1)" for [Android](0x05h-Testing-Platform-Interaction.md#testing-app-permissions-mstg-platform-1) and [iOS](0x06h-Testing-Platform-Interaction.md#testing-app-permissions-mstg-platform-1).

### Learn More

You can learn more about this and other privacy related topics here:

- [iOS App Privacy Policy](https://developer.apple.com/documentation/healthkit/protecting_user_privacy#3705073)
- [iOS Privacy Details Section on the App Store](https://developer.apple.com/app-store/app-privacy-details/)
- [iOS Privacy Best Practices](https://developer.apple.com/documentation/uikit/protecting_the_user_s_privacy)
- [Android App Privacy Policy](https://support.google.com/googleplay/android-developer/answer/9859455#privacy_policy)
- [Android Data Safety Section on Google Play](https://support.google.com/googleplay/android-developer/answer/10787469)
- [Android Privacy Best Practices](https://developer.android.com/privacy/best-practices)

## Testing User Education (MSTG-STORAGE-12)

### Testing User Education on Data Privacy on the App Marketplace

At this point we're only interested into knowing which privacy related information is being disclosed by the developers and try to evaluate if it seems reasonable (similarly as you'd do when testing for permissions).

> It's possible that the developers are not declaring certain information that is indeed being collected and or shared, but that's a topic for a different test extending this one here.
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

### Static Anaylsis

You can follow these steps:

1. Search for the app in the corresponding app marketplace (e.g. Google Play, App Store).
2. Go to the section ["Privacy Details"](https://developer.apple.com/app-store/app-privacy-details/) (App Store) or ["Safety Section"](https://android-developers.googleblog.com/2021/05/new-safety-section-in-google-play-will.html) (Google Play).
3. Verify if there's any infomation available at all.
4. Compare the information available against the actual context of the app. Does everything makes sense?
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

Store the information you got from the app marketplace as evidence, if possible on a machine readable format that you can later use to verify potential violations of privacy or data protection by the developers (e.g. by comparing it to an exported [Privacy Report](https://developer.apple.com/documentation/network/privacy_management/inspecting_app_activity_data) on iOS or your own measurements).
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

### Testing User Education on Security Best Practices

Testing this might be especially challenging if you intend to automate it. We recommend to use the app extensively and try to answer the following questions whenever applicable:

- **Fingerprint usage**: when fingerprints are used for authentication providing access to high risk transactions/information,

_does the app inform the user about the issues there can be when having multiple fingerprints of other people registered to the device as well?_
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

- **Rooting/Jailbreaking**: when root or jailbreak detection is implemented,

_does the app inform the user of the fact that certain high-risk actions will carry additional risk due to the jailbroken/rooted status of the device?_

- **Specific credentials**: when a user gets a recovery code, a password or a pin from the application (or sets one),

_does the app instruct the user to never share this with anyone else and that only the app will request it?_

- **Application distribution**: in case of a high-risk application and in order to prevent users from downloading compromised versions of the application,

_does the app manufacturer properly communicate the official way of distributing the app (e.g. from Google Play or the App Store)?_

- **Prominent Disclosure**: on any case,
cpholguera marked this conversation as resolved.
Show resolved Hide resolved

_does the app display prominent disclosure of data access, collection, use, and sharing? e.g. does the app use the [App Tracking Transparency Framework](https://developer.apple.com/documentation/apptrackingtransparency) to ask for permission on iOS?_

## References

- Open-Source Licenses and Android - <https://www.bignerdranch.com/blog/open-source-licenses-and-android/>
- Software Licenses in Plain English - <https://tldrlegal.com/>
- Apple Human Interface Guidelines - <https://developer.apple.com/design/human-interface-guidelines/ios/app-architecture/requesting-permission/>
- Android App permissions best practices - <https://developer.android.com/training/permissions/requesting.html#explain>

### OWASP MASVS

- MSTG-STORAGE-12: "The app educates the user about the types of personally identifiable information processed, as well as security best practices the user should follow in using the app."
66 changes: 0 additions & 66 deletions Document/0x04i-Testing-user-interaction.md

This file was deleted.

2 changes: 1 addition & 1 deletion Document/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
- [Cryptography in Mobile Apps](0x04g-Testing-Cryptography.md)
- [Testing Code Quality](0x04h-Testing-Code-Quality.md)
- [Tampering and Reverse Engineering](0x04c-Tampering-and-Reverse-Engineering.md)
- [Testing User Education](0x04i-Testing-user-interaction.md)
- [Testing User Privacy Protection](0x04i-Testing-User-Privacy-Protection.md)

## Android Testing Guide

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ The MSTG and the MASVS are being adopted by many companies, standards, and vario
- [Cryptography in Mobile Apps](Document/0x04g-Testing-Cryptography.md)
- [Testing Code Quality](Document/0x04h-Testing-Code-Quality.md)
- [Tampering and Reverse Engineering](Document/0x04c-Tampering-and-Reverse-Engineering.md)
- [Testing User Education](Document/0x04i-Testing-user-interaction.md)
- [Testing User Privacy Protection](0x04i-Testing-User-Privacy-Protection.md)

### Android Testing Guide

Expand Down