You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/mobile-pentesting/android-app-pentesting/tapjacking.md
+40-9Lines changed: 40 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,38 @@ In effect, it is **blinding the user from knowing they are actually performing a
10
10
11
11
### Detection
12
12
13
-
In order to detect apps vulnerable to this attacked you should search for **exported activities** in the android manifest (note that an activity with an intent-filter is automatically exported by default). Once you have found the exported activities, **check if they require any permission**. This is because the **malicious application will need that permission also**.
14
-
15
-
You can also check the minimum SDK version of the app, checking the value of **`android:minSdkVersion`** in the **`AndroidManifest.xml`** file. If the value is **lower than 30**, the app is vulnerable to Tapjacking.
13
+
* Look for **exported activities** in the Android manifest (an activity with an intent-filter is exported by default). If an exported activity is protected by a permission, the attacking app will need the **same permission**, which limits exploitability.
14
+
* Check the **minimum SDK** version `android:minSdkVersion` in `AndroidManifest.xml`. If it is **lower than 30**, older default behaviors may make tapjacking easier to exploit.
15
+
* At runtime, use `logcat` to spot blocked touches on Android 12+: the system logs `Untrusted touch due to occlusion by <package>` when overlays are filtered.
16
16
17
17
### Protection
18
18
19
-
#### Android 12 (API 31,32) and higher
19
+
#### Android 12+ default blocking & compat flags
20
+
21
+
Android 12 (API 31) introduced **"Block untrusted touches"**: touches coming from another UID window of type `TYPE_APPLICATION_OVERLAY` (opacity ≥0.8) are dropped. This is enabled by default. During tests you can toggle it:
22
+
23
+
```bash
24
+
# disable blocking for a specific package (for PoC crafting)
25
+
adb shell am compat disable BLOCK_UNTRUSTED_TOUCHES com.example.victim
26
+
# re‑enable
27
+
adb shell am compat reset BLOCK_UNTRUSTED_TOUCHES com.example.victim
28
+
```
29
+
30
+
Trusted windows (accessibility, IME, assistant) still receive events. Invisible or fully transparent overlays also bypass the block, which attackers try to abuse by keeping `alpha < 0.8`.
31
+
32
+
#### Handling **partial occlusion**
33
+
34
+
Partial overlays that leave the target area visible are not auto-blocked. Mitigate in sensitive views by rejecting events with the **`FLAG_WINDOW_IS_PARTIALLY_OBSCURED`** flag:
20
35
21
-
[**According to this source**](https://www.geeksforgeeks.org/tapjacking-in-android/)**,** tapjacking attacks are automatically prevented by Android from Android 12 (API 31 & 30) and higher. So, even if the application is vulnerable you **won't be able to exploit it**.
if ((event.getFlags() &MotionEvent.FLAG_WINDOW_IS_PARTIALLY_OBSCURED) !=0) {
40
+
returnfalse; // drop tap when anything partially obscures us
41
+
}
42
+
returnsuper.onFilterTouchEventForSecurity(event);
43
+
}
44
+
```
22
45
23
46
#### `filterTouchesWhenObscured`
24
47
@@ -65,6 +88,16 @@ The mitigation is relatively simple as the developer may choose not to receive t
65
88
66
89
---
67
90
91
+
### Recent overlay-based malware techniques
92
+
93
+
***Hook/Ermac variants** use nearly transparent overlays (e.g., fake NFC prompts) to capture gestures and lock-screen PINs while forwarding touches underneath, delivered via Accessibility-ATS modules.
94
+
***Anatsa/TeaBot droppers** ship overlays for hundreds of banking/crypto apps and show full-screen "maintenance" overlays to stall victims while ATS completes transfers.
95
+
***Hidden-VNC banking RATs** briefly display phishing overlays to capture credentials, then rely on covert VNC plus Accessibility to replay taps with fewer on-device artifacts.
96
+
97
+
Practical takeaway for red teams: mix an `alpha < 0.8` overlay to bypass Android 12 blocking, then escalate to a full-screen accessibility overlay once the user toggles the service. Instrument `GestureDescription` or a headless VNC to keep control after credentials are captured.
Besides classic Tapjacking, modern Android banking malware families (e.g. **ToxicPanda**, BrasDex, Sova, etc.) abuse the **Accessibility Service** to place a full-screen WebView **overlay** above the legitimate application while still being able to **forward the user input** to the view underneath. This dramatically increases believability and allows attackers to steal credentials, OTPs or even automate fraudulent transactions.
@@ -101,9 +134,6 @@ wm.addView(phishingView, lp);
101
134
* From the application side (bank / wallet):
102
135
- Enable **`android:accessibilityDataSensitive="accessibilityDataPrivateYes"`** (Android 14+) on sensitive views to block non-Play-Store services.
103
136
- Combine with `setFilterTouchesWhenObscured(true)` and `FLAG_SECURE`.
104
-
* System hardening:
105
-
- Disable *Install from Unknown Sources* & *Accessibility for untrusted apps*.
106
-
- Enforce PlayProtect & up-to-date devices.
107
137
108
138
For additional details on leveraging Accessibility Services for full remote device control (e.g. PlayPraetor, SpyNote, etc.) see:
0 commit comments