MASTG-TEST-0226
android
MASTG-DEMO-0040: Debuggable Flag Enabled in the AndroidManifest with semgrep
Download MASTG-DEMO-0040 APK
Open MASTG-DEMO-0040 Folder
Build MASTG-DEMO-0040 APK
Sample
The code snippet below shows a sample manifest file with the debuggable flag enabled.
Steps
Let's run our semgrep rule against the manifest file.
../../../../rules/mastg-android-debuggable-flag.yml rules :
- id : mastg - android - debuggable - flag
severity : WARNING
languages :
- xml
metadata :
summary : This rule inspects the AndroidManifest . xml for the debuggable flag .
message : "[MASVS-RESILIENCE-4] debuggable detected as $ARG."
patterns :
- pattern : 'android:debuggable="$ARG"
run.sh NO_COLOR = true semgrep - c ../../../../ rules / mastg - android - debuggable - flag . yml ./ AndroidManifest_reversed . xml > output . txt
Observation
The rule has identified the android:debuggable
attribute in the AndroidManifest.
output.txt 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 ┌────────────────┐
│ 1 Code Finding │
└────────────────┘
AndroidManifest_reversed . xml
❯❱ mastg - android - debuggable - flag
[ MASVS - RESILIENCE - 4 ] debuggable detected as true .
5 ┆ < application android : allowBackup = "true"
android : appComponentFactory = "androidx.core.app.CoreComponentFactory"
android : dataExtractionRules = "@xml/data_extraction_rules" android : debuggable = "true"
android : extractNativeLibs = "false" android : fullBackupContent = "@xml/backup_rules"
android : icon = "@mipmap/ic_launcher" android : label = "@string/app_name"
android : roundIcon = "@mipmap/ic_launcher_round" android : supportsRtl = "true"
android : theme = "@style/Theme.MASTestApp" >
Evaluation
The test case fails because the android:debuggable
attribute is explicitly set to true
.