Skip to content

Commit f69f1f3

Browse files
committed
Update MASTG-DEMO-0002.md to refine details
1 parent d9a9496 commit f69f1f3

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

demos/android/MASVS-STORAGE/MASTG-DEMO-0002/MASTG-DEMO-0002.md

+14-12
Original file line numberDiff line numberDiff line change
@@ -8,39 +8,41 @@ test: MASTG-TEST-0201
88

99
### Sample
1010

11-
The snippet below shows sample code that creates two files in the external storage using the `getExternalFilesDir` method and the `MediaStore` API.
11+
The snippet below shows sample code that creates two files in external storage using the `getExternalFilesDir` method and the `MediaStore` API.
1212

1313
{{ MastgTest.kt }}
1414

1515
### Steps
1616

17-
1. Ensure the app is running on the target device.
18-
2. Execute `run.sh`.
19-
3. Close the app once you finish testing.
17+
1. Install the app on a device (@MASTG-TECH-0005)
18+
2. Make sure you have @MASTG-TOOL-0001 installed on your machine and the frida-server running on the device
19+
3. Run `run.sh` to spawn the app with Frida
20+
4. Click the **Start** button
21+
5. Stop the script by pressing `Ctrl+C`
2022

21-
The `run.sh` script will inject a @MASTG-TOOL-0001 script called `script.js`. The Frida script will hook and log calls to `open` and `android.content.ContentResolver.insert`. The script will log the paths of the files written to the external storage, the stack trace of the caller, and additional details such as `ContentValues`.
23+
The `run.sh` script injects a @MASTG-TOOL-0001 script named `script.js`. This script hooks and logs calls to the native `open` function and to `android.content.ContentResolver.insert`. It logs the paths of files written to external storage, the caller's stack trace, and additional details such as the `ContentValues` provided.
2224

2325
{{ run.sh # script.js }}
2426

2527
### Observation
2628

27-
In the output you can see the paths, the relevant stack trace, and additional details which help to identify the actual APIs used to write to external storage and their respective callers.
29+
In the output you can observe the file paths, the relevant stack traces, and other details that help identify which APIs were used to write to external storage and their respective callers.
2830

2931
{{ output.txt }}
3032

31-
There are two files written to the external storage:
33+
Two files are written to external storage:
3234

33-
- `/storage/emulated/0/Android/data/org.owasp.mastestapp/files/secret.txt` written using `java.io.FileOutputStream` from `org.owasp.mastestapp.MastgTest.mastgTestApi(MastgTest.kt:26)`
34-
- `content://media/external/downloads/1000000108` written using `android.content.ContentResolver.insert` from `org.owasp.mastestapp.MastgTest.mastgTestMediaStore(MastgTest.kt:44)`
35+
- `/storage/emulated/0/Android/data/org.owasp.mastestapp/files/secret.txt`: written via `java.io.FileOutputStream` from `org.owasp.mastestapp.MastgTest.mastgTestApi(MastgTest.kt:26)`.
36+
- `content://media/external/downloads/1000000108`: written via `android.content.ContentResolver.insert` from `org.owasp.mastestapp.MastgTest.mastgTestMediaStore(MastgTest.kt:44)`.
3537

36-
The `ContentResolver.insert` call included the following `ContentValues`:
38+
The `ContentResolver.insert` call used the following `ContentValues`:
3739

3840
- `_display_name: secretFile55.txt`
3941
- `mime_type: text/plain`
4042
- `relative_path: Download`
4143

42-
Note that the calls via `ContentResolver.insert` do not write directly to the file system, but to the `MediaStore` content provider, and therefore we can't see the actual file path, instead we see the `content://` URI. However, the `ContentValues` reveal the file name and the directory where the file was written.
44+
Note that calls via `ContentResolver.insert` write to the MediaStore content provider rather than directly to the file system. As a result, you see a `content://` URI instead of a typical file path. However, the provided `ContentValues` still reveal the intended file name and the target directory.
4345

4446
### Evaluation
4547

46-
This test fails because the files are not encrypted and contain sensitive data (a password and an API key). You can further confirm this by reverse engineering the app and inspecting the code as well as retrieving the files from the device.
48+
This test fails because the files are not encrypted and contain sensitive data (such as a password and an API key). This can be further confirmed by reverse-engineering the app to inspect its code and retrieving the files from the device.

0 commit comments

Comments
 (0)