Skip to content

Commit 454ae14

Browse files
committed
2 parents 6765411 + 56c5ed4 commit 454ae14

1 file changed

Lines changed: 40 additions & 9 deletions

File tree

src/mobile-pentesting/android-app-pentesting/tapjacking.md

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,38 @@ In effect, it is **blinding the user from knowing they are actually performing a
1010

1111
### Detection
1212

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.
1616

1717
### Protection
1818

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:
2035

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**.
36+
```java
37+
@Override
38+
public boolean onFilterTouchEventForSecurity(MotionEvent event) {
39+
if ((event.getFlags() & MotionEvent.FLAG_WINDOW_IS_PARTIALLY_OBSCURED) != 0) {
40+
return false; // drop tap when anything partially obscures us
41+
}
42+
return super.onFilterTouchEventForSecurity(event);
43+
}
44+
```
2245

2346
#### `filterTouchesWhenObscured`
2447

@@ -65,6 +88,16 @@ The mitigation is relatively simple as the developer may choose not to receive t
6588
6689
---
6790

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.
98+
99+
---
100+
68101
## Accessibility Overlay Phishing (Banking-Trojan Variant)
69102

70103
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);
101134
* From the application side (bank / wallet):
102135
- Enable **`android:accessibilityDataSensitive="accessibilityDataPrivateYes"`** (Android 14+) on sensitive views to block non-Play-Store services.
103136
- 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.
107137

108138
For additional details on leveraging Accessibility Services for full remote device control (e.g. PlayPraetor, SpyNote, etc.) see:
109139

@@ -113,6 +143,7 @@ accessibility-services-abuse.md
113143
{{#endref}}
114144

115145
## References
116-
* [Bitsight – ToxicPanda Android Banking Malware 2025 Study](https://www.bitsight.com/blog/toxicpanda-android-banking-malware-2025-study)
146+
* [Android Developers – Tapjacking risk & mitigations (updated 2024)](https://developer.android.com/privacy-and-security/risks/tapjacking)
147+
* [Zimperium – HOOK v3 overlay expansion (Aug 2025)](https://thehackernews.com/2025/08/hook-android-trojan-adds-ransomware.html)
117148

118149
{{#include ../../banners/hacktricks-training.md}}

0 commit comments

Comments
 (0)