MASTG Tests
đ These study notes serve as a concise reference, capturing the essential insights, guidelines, and best practices for securing mobile applications, based on the OWASP MASTG (Mobile Application Security Testing) Standard - Tests.
đ Resources đ
MASTG - Apps (tests examples are made with those vulnerable apps)
Android
MASTG-TEST-0001 Testing Local Storage for Sensitive Data
Open the app and click everywhere possible to trigger all possible functionalities and ensure data generation
Check all app generated files (SharedPreferences, SQL, Realm dbs, Internal/External Storage, etc)
Data stored locally should be at least encrypted and stored within the app sandbox. If possible, sensitive data should not be stored at all.
Static
Input the
apk
intojadx-gui
Check
AndroidManifest.xml
foruses-permission android:name="android.permission
Check the source code for file permissions, classes and functions, and bad practices.
Dynamic
To manage all those tests, a full pull data from an Android device's local storage may be useful.
Check internal and external local storage, dev files, backup files, old files
Check permissions in the app folder
/data/data/<package-name>
Check SQLite databases stored in
/data/data/<package-name>/databases
(on device) for sensitive data and db encryptionCheck Shared Preferences in
/data/data/<package-name>/shared_prefs
Check for Firebase Real-time dbs in
/data/data/<package-name>/files/
call
https://_firebaseProjectName_.firebaseio.com/.json
if found any
.realm
files, explore them with Realm Studio
MASTG-TEST-0003 Testing Logs for Sensitive Data
Check for log related source code and files, and analyze them for any sensitive data
Logging should be removed from production releases.
Static
Check the source code for logging classes.
Dynamic
Use all the app functions at least once. Look for logs inside the app's data directory /data/data/<package-name
Check system and application logs with
Logcat
orpidcat
for unintended data leakage
MASTG-TEST-0004 Determining Whether Sensitive Data Is Shared with Third Parties via Embedded Services
Static
Review third-party libraries source code, requested permissions and vulnerabilities
Prevent PII exposure
Dynamic
Launch a man-in-the-middle (MITM) attack by routing the traffic through BurpSuite
or ZAP
proxy and sniffing the traffic between the app and the server.
Check for sensitive information (PII), specially in ads or tracking services
MASTG-TEST-0005 Determining Whether Sensitive Data Is Shared with Third Parties via Notifications
Static
Understand if notification management classes (e.g.
NotificationManager
) are used, how the application works and which data is shown in the generated notifications.
Dynamic
Trace calls to functions related to notifications creation and check if it contains any sensitive information.
use
Frida
scripts
MASTG-TEST-0006 Determining Whether the Keyboard Cache Is Disabled for Text Input Fields
Static
Check for the
android:inputType
XML attribute and its constants liketextPassword
,textVisiblePassword
,numberPassword
,textWebPassword
Check the
android:minSdkVersion
in theAndroidManifest.xml
file for the above constants support
Dynamic
Check for input fields that take sensitive data.
Keyboard cache is enabled if strings are suggested
MASTG-TEST-0009 Testing Backups for Sensitive Data
Static
Check the
AndroidManifest.xml
forandroid:allowBackup
if
true
, check for sensitive data in the saved backup
Pay attention to cloud (auto) backup, it may contain unencrypted sensitive data files
Check the source code for
BackupAgent
,BackupAgentHelper
classes
Dynamic
Use adb
to backup the app and check the backup archive for sensitive data.
Approve the backup in the device
Convert the
.ab
backup file (with ABE) to.tar
and extract the data from it
MASTG-TEST-0011 Testing Memory for Sensitive Data
Check for data disclosure via process memory, by creating a memory dump or real-time memory analysis (debugger).
Static
Identify and map data usage across application components.
Minimize the number of components handling sensitive data.
Ensure prompt removal of object references when sensitive data is no longer needed.
Request garbage collection after removing references.
Overwrite sensitive data immediately when it becomes unnecessary.
Follow best practices and coding recommendations (SecureSecretKey
class, etc) to make sure that sensitive data in memory is cleared out at logout and during onPause
events for example, managing user's authentication experience.
Dynamic
Retrieve and analyze a memory dump using objection
or fridump
.
Check the memory dump for sensitive data, using
strings
command to extract strings from thedmp
filesIndicative field names like "password", "pass", "pin", "secret", "private", etc.
Indicative patterns in strings, char arrays, byte arrays, etc.
Known secrets (credit card number, etc)
r2frida can be used for Runtime Memory Analysis, searching the memory for a strings, values, etc.
MASTG-TEST-0012 Testing the Device-Access-Security Policy
Applications dealing with sensitive data should run in a secure and trusted environment. To establish this environment, the app can verify the device for:
Device lock with PIN or password protection
Up-to-date Android OS version
Activated USB Debugging
Device encryption
Device rooting
Static
Check the source code for functions implementing a device-access-security policy (e.g.
App runs only on Android 9.0+) and determine if it can be bypassed.
system preferences
Settings.Secure
Dynamic
Validate the bypassed security enforcing checks if present.
MASTG-TEST-0019 Testing Data Encryption on the Network
MASTG-TEST-0020 Testing the TLS Settings
MASTG-TEST-0021 Testing Endpoint Identify Verification
MASTG-TEST-0022 Testing Custom Certificate Stores and Certificate Pinning
MASTG-TEST-0023 Testing the Security Provider
Last updated