-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Add Tests and Demos about "Sensitive Data Stored Unencrypted via DataStore" #3540
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
Open
macik09
wants to merge
7
commits into
OWASP:master
Choose a base branch
from
macik09:feature/mastg-datastore-clean
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cpholguera
reviewed
Nov 27, 2025
cpholguera
reviewed
Nov 27, 2025
Comment on lines
22
to
39
| ### Static Analysis | ||
| 1. Obtain the application package (e.g., APK file) using @MASTG-TECH-0003. | ||
| 2. Use a static analysis technique (@MASTG-TECH-0014) to identify references to DataStore APIs such as: | ||
| - `androidx.datastore.preferences.preferencesDataStore` | ||
| - `androidx.datastore.core.DataStore` (or usage of generated Proto classes). | ||
| - `dataStore.edit`, `updateData`, or `write` operations. | ||
| 3. Inspect the code to determine whether: | ||
| - sensitive data is stored using the default, unencrypted implementation. | ||
| - a secure mechanism (e.g., applying an `EncryptedFile.Builder` for Preferences DataStore or using an encrypted custom serializer for Proto DataStore) is explicitly applied to the sensitive fields. | ||
|
|
||
| ### Dynamic Analysis | ||
| 1. Install and run the app on a rooted or emulated device (@MASTG-TECH-0005). | ||
| 2. Trigger app functionality that processes or stores sensitive data. | ||
| 3. Access the app’s private storage (typically `/data/data/<package_name>/datastore/`) and locate the DataStore files. This requires accessing the app data directories (@MASTG-TECH-0008). File names usually end with: | ||
| - `.preferences_pb` (Preferences DataStore) | ||
| - `.proto` (Proto DataStore) | ||
| 4. Extract the DataStore files from the device using @MASTG-TECH-0003. | ||
| 5. Inspect the file content using a suitable tool, applying the technique for Dynamic Analysis (@MASTG-TECH-0015) to confirm whether sensitive data is stored in plaintext. *Note: Proto DataStore files require a Proto decoder for inspection.* |
Collaborator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For all the new PRs:
We require separate tests.
See for example:
- https://mas.owasp.org/MASTG/tests/ios/MASVS-STORAGE/MASTG-TEST-0300/ (based on sast)
type: [static] - https://mas.owasp.org/MASTG/tests/ios/MASVS-STORAGE/MASTG-TEST-0301/ (based on hooking)
type: [dynamic](you can skip this type, if you want) - https://mas.owasp.org/MASTG/tests/ios/MASVS-STORAGE/MASTG-TEST-0302/ (based on file system pull)
type: [dynamic, filesystem]
7e31c5f to
57ed186
Compare
57ed186 to
4a930bc
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR closes #3449
Description
This PR introduces a new demo and finalizes the corresponding test for the MASVS-STORAGE requirement concerning unencrypted data persistence.
This submission specifically addresses data persistence via Jetpack DataStore by adding MASTG-DEMO-0069 and finalizing MASTG-TEST-0305.
The demo proves that sensitive PII (Email) and a secret (Password/Token) are stored in plaintext within the application's DataStore files (.preferences_pb or .proto). This occurs when developers fail to implement an explicit encryption layer, confirming the weakness MASWE-0006.
The included run.sh script demonstrates that these sensitive contents are trivially accessible from the app's private sandbox on a privileged device.
[x] I have read the contributing guidelines.