Skip to content

Lesson 12 of 13 · 14m

The Bugs You'll Actually Find

addJavascriptInterface RCE, intent redirection, overlay tapjacking, StrandHogg task hijack, pasteboard snooping, and scheme collisions — the recurring platform bug classes with their CVEs.

WebView: the RCE that wouldn't die

addJavascriptInterface injects a Java object into the page's JavaScript context. Below API 17 the bridge was unannotated — every public method on the injected object was callable, and reflection from JS reached Runtime.exec through methods nobody annotated. That's CVE-2012-6636, and it was exploited by ad SDKs broadly enough that API 17 made @JavascriptInterface mandatory. The fix didn't remove the attack surface; it moved it to whatever you annotate — SDKs that bridge openFile, exec, or download methods are still a bridge to the OS, now with a blessing.

The rest of the WebView surface: setJavaScriptEnabled(true) on content you don't control; setAllowFileAccess enabling file:// loads inside the WebView sandbox; setAllowFileAccessFromFileURLs/setAllowUniversalAccessFromFileURLs — deprecated at API 30, defaulted off since Jelly Bean — which let JS in a file:// page read the app's private storage (/data/data/<pkg>/) via XHR; and loadUrl("javascript:...") or deeplink-driven loadUrl letting an attacker choose the page. Microsoft's TikTok writeup (CVE-2022-28799, May 2022) chained a non-verified deeplink into exactly this: navigate a first-party WebView to an attacker URL, inherit its JS bridge.

The IPC bugs from lesson three, weaponized

Intent redirection — launching a caller-supplied Intent — is a confused-deputy primitive into non-exported components. PendingIntent with an implicit mutable base lets the filler choose action, component, data. Content provider openFile traversal with percent-encoded ..%2f reads app-private files — Uri.getPath() decodes before your startsWith(root) check runs, so check the decoded path against the canonical root. And taskAffinity/reparenting is StrandHogg (Promon, December 2019) and StrandHogg 2.0 (CVE-2020-0096): a hostile activity parks inside the victim's task and phishes from inside the real app's task card. Android 10/11 restricted task reparenting; the class lives on wherever an app leaves reparentable surfaces.

Overlay and tapjacking

SYSTEM_ALERT_WINDOW draws on top of everything. Cloak & Dagger, the 2017 Oakland paper by Fratantonio et al., showed overlay + BIND_ACCESSIBILITY_SERVICE was a complete compromise: steal keystrokes, overlay phishing UI, install apps silently. CVE-2017-0752 — the Toast overlay attack — drew a TYPE_TOAST window over system UI and even the lock screen, no permission prompt involved. Banking trojan families (Anatsa, Hook) still live on this surface. The defenses: setFilterTouchesWhenObscured(true) on sensitive views rejects touches that passed through an obscuring overlay; Android 12 blocks touches through untrusted overlays platform-wide; Android 14 hardened the opacity limits again. On your login screen, the flag is still worth writing.

The iOS side of the list

  • Pasteboard. UIPasteboard.general was readable by any foreground app until iOS 14's banner exposed the snoopers (TikTok got caught June 2020). iOS 16 requires consent for programmatic paste. Don't put secrets on it; clear it after use.
  • Custom schemes. Any app can register a scheme you registered; collision resolution is undocumented — custom-scheme callbacks are attacker-controlled input. Universal Links via apple-app-site-association are the verified path.
  • Keyboard cache and snapshots. secureTextEntry/textContentType keep sensitive input out of autocorrect's learned dictionary; the app-switcher snapshot persists on flash unless you blur on applicationDidEnterBackground.
  • App Groups. group.com.team.shared containers and keychain-access-groups deliberately share state between your apps — audit who else has the Team ID's signing keys before sharing secrets there.
  • LSApplicationQueriesSchemes. The 50-entry cap is also a ceiling on fingerprinting; iOS 9+ made canOpenURL require the declaration precisely because silent scheme probing enumerated installed apps.

Practice

On Android: exported=false by default, PendingIntents immutable with empty bases, filterTouchesWhenObscured on auth/payment screens, WebView surface reduced to setJavaScriptEnabled only where required, no file access, no bridges to privileged methods, verified App Links. On iOS: Universal Links only, secrets off the pasteboard, blur on background, scoped App Groups. Then grep the artifact — addJavascriptInterface, allowFileAccess, loadUrl, exported — because the manifest and the decompile are the audit, and they're exactly what the other side reads first.

Was this lesson helpful?

Sign in to rate

Keep reading

Related articles from the SudoSecurity blog.