AAD Risk Management & Mitigation 3 — Questions and Answers
Question 1: What is the purpose of certificate pinning in Android network security?
- To compress network traffic
- To prevent man-in-the-middle attacks by validating the server's expected certificate (Correct answer)
- To cache SSL certificates for offline use
- To automatically renew expired certificates
Correct answer: To prevent man-in-the-middle attacks by validating the server's expected certificate
Certificate pinning rejects connections to servers presenting unexpected certificates, stopping MITM attacks even from compromised certificate authorities.
Question 2: Which Gradle configuration option enables R8/ProGuard to reduce attack surface by removing unused code from the release APK?
- minifyEnabled true (Correct answer)
- shrinkResources false
- debuggable false
- abiFilters 'armeabi-v7a'
Correct answer: minifyEnabled true
Setting minifyEnabled true activates R8/ProGuard code shrinking, removing unused classes and methods that could otherwise be exploited.
Question 3: A user's Android device is stolen while unlocked. What app-level mitigation best protects sensitive data in this scenario?
- Using Vector drawables
- Requiring re-authentication after a short inactivity timeout (Correct answer)
- Increasing the app's minSdkVersion
- Disabling the back button
Correct answer: Requiring re-authentication after a short inactivity timeout
Requiring re-authentication after a timeout ensures that even physical access to an unlocked device does not bypass in-app authentication.
Question 4: What risk is introduced when an app logs sensitive user data using Log.d() in production builds?
- The app crashes on release builds
- Sensitive data can be read from device logs by other apps with READ_LOGS permission or via ADB (Correct answer)
- Logging slows down the UI thread
- The Play Store rejects apps with Log statements
Correct answer: Sensitive data can be read from device logs by other apps with READ_LOGS permission or via ADB
Android logs can be accessed via ADB or by apps with READ_LOGS permission, making production debug logs a data leakage risk.
Question 5: Which approach mitigates the risk of sensitive data persisting in Android's task switcher (recent apps screen)?
- Setting launchMode to singleTop
- Using FLAG_SECURE or excluding the Activity from the Recents screen (Correct answer)
- Using a transparent theme
- Calling finish() in onPause()
Correct answer: Using FLAG_SECURE or excluding the Activity from the Recents screen
FLAG_SECURE prevents the system from capturing a snapshot of the window for the Recents screen, protecting sensitive content from being visible.
Question 6: Why should Android apps avoid storing sensitive data in External Storage (e.g., SD card)?
- External storage is slower than internal storage
- Any app with READ_EXTERNAL_STORAGE permission can access files on external storage (Correct answer)
- External storage does not support file encryption
- The Android OS deletes files from external storage during updates
Correct answer: Any app with READ_EXTERNAL_STORAGE permission can access files on external storage
External storage is world-readable to apps holding READ_EXTERNAL_STORAGE permission, making it unsuitable for private or sensitive files.
Question 7: An Android app accepts deep link URLs without validating the host or path. What attack does this enable?
- Increased APK size
- Deep link hijacking or unauthorized access to in-app screens (Correct answer)
- Battery drain from URL parsing
- Slower startup time
Correct answer: Deep link hijacking or unauthorized access to in-app screens
Unvalidated deep links allow malicious apps or websites to craft URLs that open protected in-app screens or trigger privileged actions.
What is the purpose of certificate pinning in Android network security?