MASTG Tests
Last updated
Was this helpful?
Last updated
Was this helpful?
đ 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.
(tests examples are made with those vulnerable apps)
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
for uses-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 encryption
Check 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
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
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
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
Static
Check for the android:inputType
XML attribute and its constants like
textPassword
, textVisiblePassword
, numberPassword
, textWebPassword
Check the android:minSdkVersion
in the AndroidManifest.xml
file for the above constants support
Dynamic
Check for input fields that take sensitive data.
Keyboard cache is enabled if strings are suggested
Static
Check the AndroidManifest.xml
for android: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
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
Check the memory dump for sensitive data, using strings
command to extract strings from the dmp
files
Indicative field names like "password", "pass", "pin", "secret", "private", etc.
Indicative patterns in strings, char arrays, byte arrays, etc.
Known secrets (credit card number, etc)
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.
if found any .realm
files, explore them with
Check system and application logs with Logcat
or for unintended data leakage
Convert the .ab
backup file (with ) to .tar
and extract the data from it
Retrieve and analyze a memory dump using or .
can be used for Runtime Memory Analysis, searching the memory for a strings, values, etc.