Hacktricks-skills android-tapjacking-test
Test Android applications for tapjacking vulnerabilities. Use this skill whenever you're doing Android app security testing, pentesting, or analyzing exported activities for clickjacking risks. Trigger when the user mentions tapjacking, clickjacking, overlay attacks, exported activities, or Android UI security testing.
git clone https://github.com/abelrguezr/hacktricks-skills
skills/mobile-pentesting/android-app-pentesting/tapjacking/SKILL.MDAndroid Tapjacking Testing
A skill for detecting and testing tapjacking vulnerabilities in Android applications.
What is Tapjacking
Tapjacking is an attack where a malicious application positions itself on top of a victim application, tricking users into interacting with the victim app while believing they're interacting with the overlay. This effectively blinds users to their actual actions.
When to Use This Skill
Use this skill when:
- Testing Android apps for UI security vulnerabilities
- Analyzing exported activities in Android manifests
- Investigating overlay-based attack vectors
- Reviewing Android app security posture
- Preparing penetration test reports for Android applications
Detection Workflow
Step 1: Analyze the Android Manifest
Check for exported activities that could be vulnerable:
# Extract and analyze the manifest unzip -p app.apk AndroidManifest.xml | grep -A 5 "<activity"
Look for:
- Activities with
(exported by default)intent-filter - Activities without
android:exported="false" - Activities protected only by custom permissions
Step 2: Check Minimum SDK Version
# Check minSdkVersion in manifest unzip -p app.apk AndroidManifest.xml | grep "minSdkVersion"
Risk assessment:
: Higher risk (older default behaviors)minSdkVersion < 30
: Android 12+ has default blockingminSdkVersion >= 31
Step 3: Runtime Detection (Android 12+)
Monitor for blocked touches during testing:
# Watch for occlusion warnings adb logcat | grep -i "untrusted touch\|occlusion"
Look for:
Untrusted touch due to occlusion by <package>
Step 4: Check for Protection Flags
Search the decompiled code for protection mechanisms:
# Check for filterTouchesWhenObscured strings app.apk | grep -i "filterTouchesWhenObscured" # Check for onFilterTouchEventForSecurity override strings app.apk | grep -i "onFilterTouchEventForSecurity"
Exploitation Testing
Using Tapjacking-ExportedActivity Tool
The most recent tool for testing exported activity tapjacking:
-
Clone the repository:
git clone https://github.com/carlospolop/Tapjacking-ExportedActivity -
Build and install the test APK
-
Run against the target app's exported activities
Manual Testing Approach
- Identify target activities from manifest analysis
- Create overlay app with transparent or semi-transparent UI
- Position overlay to match target UI elements
- Test touch forwarding to verify vulnerability
Testing Android 12+ Bypass
Android 12 blocks overlays with opacity ≥0.8. Test bypass:
# Disable blocking for PoC testing (requires root/adb) adb shell am compat disable BLOCK_UNTRUSTED_TOUCHES com.example.victim # Re-enable after testing adb shell am compat reset BLOCK_UNTRUSTED_TOUCHES com.example.victim
Protection Recommendations
For Developers
-
Set filterTouchesWhenObscured on sensitive views:
<Button android:text="Confirm" android:filterTouchesWhenObscured="true" ... /> -
Override onFilterTouchEventForSecurity in activities:
@Override public boolean onFilterTouchEventForSecurity(MotionEvent event) { if ((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_PARTIALLY_OBSCURED) != 0) { return false; // Drop tap when partially obscured } return super.onFilterTouchEventForSecurity(event); } -
Use FLAG_SECURE for sensitive screens:
getWindow().setFlags( WindowManager.LayoutParams.FLAG_SECURE, WindowManager.LayoutParams.FLAG_SECURE ); -
Android 14+: Set
on sensitive viewsandroid:accessibilityDataSensitive="accessibilityDataPrivateYes"
For Security Teams
- Audit exported activities in all app releases
- Test with overlay tools before production
- Monitor for accessibility service abuse in production apps
- Review minSdkVersion and update if below 30
Modern Threat Context
Recent Malware Techniques
- Hook/Ermac variants: Use alpha < 0.8 overlays to bypass Android 12 blocking
- Anatsa/TeaBot: Full-screen "maintenance" overlays with ATS automation
- Hidden-VNC RATs: Brief phishing overlays + covert VNC for replay
Accessibility Overlay Phishing
Modern banking trojans (ToxicPanda, BrasDex, Sova) use:
permissionBIND_ACCESSIBILITY_SERVICE
windowsTYPE_ACCESSIBILITY_OVERLAY- WebView overlays with touch forwarding
flagsFLAG_NOT_FOCUSABLE | FLAG_NOT_TOUCH_MODAL
Detection Commands
# Check for apps with accessibility service adb shell pm list packages -3 -e | grep -i accessibility # List apps with BIND_ACCESSIBILITY_SERVICE adb shell pm list packages -3 -e BIND_ACCESSIBILITY_SERVICE
Reporting
When documenting findings:
- Vulnerability: Tapjacking / Clickjacking
- CVSS Vector: Consider UI manipulation, data exposure, action hijacking
- Affected Activities: List specific exported activities
- Proof of Concept: Include overlay app or tool output
- Remediation: Reference protection recommendations above