WebView Types
UIWebView
Deprecated since iOS 12. Cannot disable JavaScript, making it inherently vulnerable to script injection and XSS. Avoid entirely in new apps.
WKWebView
Preferred choice. JavaScript can be disabled, supports
hasOnlySecureContent for mixed content detection, and minimizes memory corruption risk to the main app process.SFSafariViewController
Standardized browser experience sharing Safari’s cookies. Cannot disable JavaScript. Must be displayed prominently per App Store guidelines.
Static Analysis
Identify WebView Type
Check JavaScript Configuration
File Access Analysis
UIWebView allows universal file access by default. WKWebView is stricter but has two dangerous optional settings:
allowFileAccessFromFileURLs— allows file URLs to access other file URLs (default:false)allowUniversalAccessFromFileURLs— allows file URLs to access any origin (default:false)
false by default is the correct, secure state.
Dynamic Analysis
Heap Inspection with Frida
WebView Protocol Handling
WKWebView supports http(s)://, file://, and tel:// protocols. Methods for loading content:
loadHTMLString:baseURL:— loads HTML string with a base URLloadData:MIMEType:textEncodingName:baseURL:— loads raw dataloadRequest:— loads a URL requestloadFileURL:allowingReadAccessToURL:— loads a local file (dangerous if a directory is specified — exposes all files in it)
File Exfiltration PoC
This JavaScript payload exfiltrates a local file via XHR if the WebView has file access:Native Methods via WebViews
JSContext (UIWebView)
iOS 7+ allows JavaScript to call native Swift/Objective-C viaJSContext:
postMessage (WKWebView)
WKWebView uses message passing for JS-to-native communication:
Debugging iOS WebViews
1
Enable Web Inspector on iOS Device
Go to Settings → Safari → Advanced and enable Web Inspector.
2
Enable Developer Tools in Safari (macOS)
Open Safari → Safari → Preferences → Advanced → check Show Develop menu.
3
Connect and Debug
Connect the iOS device to the Mac. In Safari on Mac, go to Develop → [Your Device Name] and select the WebView instance to inspect.
Only WebViews in apps loaded via Xcode can be debugged this way. Apps installed via App Store or Apple Configurator cannot be inspected.