Test iOS WebViews (UIWebView/WKWebView/SFSafariViewController) for insecure config, JS-to-native bridge abuse, file:// access and XSS-to-native/local-file-theft. Tier 1. Use when the app renders web content. Needs device/instrumentation for dynamic bridge testing.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ios Webview Attacks?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/anandjogawade-ios-webview-attacks)
---
name: ios-webview-attacks
description: Test iOS WebViews (UIWebView/WKWebView/SFSafariViewController) for insecure config, JS-to-native bridge abuse, file:// access and XSS-to-native/local-file-theft. Tier 1. Use when the app renders web content. Needs device/instrumentation for dynamic bridge testing.
---
# iOS WebView Security
WebViews bridge untrusted web content to native capability. Misconfig (JS enabled on deprecated UIWebView, broad file access, exposed native handlers) turns XSS into local-file theft or native-method invocation (MASVS-PLATFORM).
## Trigger phrases
`ios webview, wkwebview, uiwebview, wkscriptmessagehandler, evaluatejavascript, allowfileaccessfromfileurls, js bridge ios, xss to native ios`
## Method
1. **Identify WebView type:** `rabin2 -zz App | egrep "UIWebView$|WKWebView$|SFSafariViewController"`. **UIWebView** is deprecated and can't disable JS — flag its presence. **WKWebView** preferred; **SFSafariViewController** runs out-of-process (app can't read its data).
2. **Static config review:** `grep`/Hopper for `javaScriptEnabled`, `loadHTMLString:baseURL:`, `hasOnlySecureContent`, `allowFileAccessFromFileURLs`, `allowUniversalAccessFromFileURLs` (both false by default — flag if enabled), `loadFileURL:allowingReadAccessToURL:` granting broad directories.
3. **Dynamic inspection:** `ObjC.choose(ObjC.classes.WKWebView,...)` to read live `configuration().preferences().javaScriptEnabled()`, `hasOnlySecureContent()`, and the message-handler names.
4. **Native bridge enumeration:** find `WKScriptMessageHandler` handlers (`window.webkit.messageHandlers.<name>.postMessage(...)`), `JSExport`-exposed objects, and `evaluateJavaScript:` calls built with interpolated input. For UIWebView, reach `JSContext` via `valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"`.
5. **Exploit:** if attacker content can run JS (reflected/stored XSS in loaded content, attacker-controlled URL, or deeplink-driven load), call the exposed native handlers to trigger privileged actions, and — with file access enabled — read local files via `XMLHttpRequest`/`fetch` on `file://` and exfiltrate.
6. **Debug:** Safari Web Inspector (Develop menu) against the app's WebView (Xcode-installed/dev builds).
## Modern / rare techniques
- **XSS + `allowUniversalAccessFromFileURLs`** → cross-origin reads of any `file://` → steal the app's local data/tokens.
- **Deeplink → WebView load of attacker URL** (chain `ios-url-scheme-abuse`) → bridge invocation = XSS-to-native/RCE-equivalent.
- **`evaluateJavaScript` with user input** → injection into the page context.
## Bypass / evasion
For dynamic hooking behind pinning/anti-debug, chain `ios-ssl-pinning-bypass` and `ios-anti-debug-bypass`; use XSS payloads from `${CLAUDE_PLUGIN_ROOT}/payloads/xss.md`/`${CLAUDE_PLUGIN_ROOT}/payloads/client-side.md` for the web-content injection.
## Escalation / chaining
Bridge abuse → native action/RCE-equivalent; file theft → `ios-insecure-storage`/backend creds; attacker-URL load path → `ios-url-scheme-abuse`. Server-side XSS source → `web-xss`.
## Backend & tooling
frida/objection + Safari Web Inspector + a headless/attacker page from Kali (WSL+Kali / Kali-SSH / HexStrike). Dynamic bridge testing needs a jailbroken or resigned+gadget device; static config review works on the bundle.
## Verification (background, before reporting)
Prove the impact independently — invoke an exposed native handler from injected JS, or read+exfil a local file — and reproduce it; use an OAST endpoint to confirm exfiltration for blind cases. Report true positives only.
## Evidence
Capture the WebView config, the exposed handler/JSExport, the injection PoC, and the native action / file contents retrieved (redacted). Remediation: migrate off UIWebView, keep file-access flags false, scope `loadFileURL` read access, validate bridge message origins/inputs, never interpolate untrusted input into `evaluateJavaScript`, load only trusted HTTPS. MASVS: MASVS-PLATFORM-2, MASVS-CODE-4.