| name | macos-file-extension-apps |
| description | macOS security skill for enumerating file extension handlers and URL scheme handlers via LaunchServices database. Use this skill whenever analyzing macOS systems for privilege escalation, investigating default app handlers, auditing file associations, or researching application capabilities. Trigger when users mention file extensions, URL schemes, LaunchServices, default apps, or macOS application handlers. |
macOS File Extension & URL Scheme App Handlers
A security skill for enumerating and analyzing macOS LaunchServices database to discover file extension handlers, URL scheme handlers, and application capabilities.
Overview
macOS maintains a LaunchServices database that tracks all installed applications and their capabilities. This database can be queried to discover:
- Which applications handle specific file extensions
- Which applications register URL schemes
- Application MIME type associations
- Default handler configurations
This information is valuable for:
- Privilege escalation research - Finding misconfigured handlers
- Security auditing - Understanding application attack surface
- Forensics - Identifying installed applications and their capabilities
- Malware analysis - Understanding persistence mechanisms
Quick Start
lsregister -dump
lsregister -dump | grep -E "path:|bindings:|name:" | grep -A5 "\.pdf"
./scripts/query-handlers.sh --extension "pdf"
Core Commands
Dump LaunchServices Database
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -dump
This outputs the complete database with all application bindings, UTIs, and URL schemes.
Find File Extension Handlers
lsregister -dump | grep -E "path:|bindings:|name:" | grep -B2 -A5 "\.ext"
lsregister -dump | grep "string" | grep -oE "\.[a-zA-Z0-9]+" | sort -u
Find URL Scheme Handlers
lsregister -dump | grep -E "path:|bindings:|name:" | grep -B2 -A5 "ftp://"
lsregister -dump | grep "LSHandlerRank" | grep -B10 "URL" | grep "string"
Check Application Capabilities
cd /Applications/Safari.app/Contents
grep -A3 CFBundleTypeExtensions Info.plist | grep string
cd /Applications/Safari.app/Contents
grep -A3 CFBundleURLSchemes Info.plist | grep string
Bundled Scripts
query-handlers.sh
Query file extension and URL scheme handlers with structured output.
./scripts/query-handlers.sh --extension "pdf"
./scripts/query-handlers.sh --scheme "ftp"
./scripts/query-handlers.sh --list-extensions
./scripts/query-handlers.sh --list-schemes
analyze-app.sh
Analyze a specific application's file and URL handler capabilities.
./scripts/analyze-app.sh /Applications/Safari.app
./scripts/analyze-app.sh /Applications/Chrome.app --verbose
dump-launchservices.sh
Dump and parse the LaunchServices database into structured JSON.
./scripts/dump-launchservices.sh --output ls-dump.json
./scripts/dump-launchservices.sh --filter "pdf" --output pdf-handlers.json
LaunchServices Architecture
Key Components
| Component | Path | Purpose |
|---|
lsregister | /System/Library/Frameworks/CoreServices.framework/.../Support/lsregister | Database registration and dumping |
lsd | /usr/libexec/lsd | LaunchServices daemon (XPC services) |
launchservicesd | /System/Library/CoreServices/launchservicesd | Running application queries |
lsappinfo | /usr/bin/lsappinfo | Query running applications |
XPC Services
The lsd daemon exposes several XPC services:
.lsd.installation - Application installation
.lsd.open - Open files with handlers
.lsd.openurl - Open URLs with handlers
.launchservices.changedefaulthandler - Change default handlers (requires entitlements)
.launchservices.changeurlschemehandler - Change URL scheme handlers (requires entitlements)
Note: Modifying handlers requires specific entitlements and elevated privileges.
Security Considerations
Privilege Escalation Vectors
- Misconfigured Handlers - Applications with excessive file type associations may be exploited
- URL Scheme Handlers - Custom URL schemes can be used for privilege escalation
- Default Handler Changes - Modifying default handlers can redirect file operations
- Entitlement Abuse - Applications with LaunchServices entitlements have elevated capabilities
Auditing Checklist
Example Workflows
Find All PDF Handlers
./scripts/query-handlers.sh --extension "pdf"
Audit All Custom URL Schemes
./scripts/dump-launchservices.sh --output all-schemes.json
./scripts/query-handlers.sh --list-schemes | grep -v "http\|https\|ftp\|mailto"
Compare Handler Changes Over Time
./scripts/dump-launchservices.sh --output baseline.json
./scripts/dump-launchservices.sh --output after-changes.json
./scripts/compare-dumps.sh baseline.json after-changes.json
Tools
External Tools
SwiftDefaultApps Commands
./swda getSchemes
./swda getApps
./swda getUTIs
./swda getHandler --URL ftp
Output Formats
JSON Output
Scripts output structured JSON for programmatic analysis:
{
"extension": "pdf",
"handlers": [
{
"name": "Preview",
"path": "/System/Applications/Preview.app",
"bundle_id": "com.apple.preview"
}
]
}
Text Output
Human-readable format for quick inspection:
Extension: .pdf
Handlers:
- Preview (/System/Applications/Preview.app)
- Adobe Acrobat (/Applications/Adobe Acrobat DC/Adobe Acrobat.app)
Troubleshooting
Permission Denied
sudo lsregister -dump
No Results
- Verify the extension/scheme exists in the system
- Check if the application is properly installed
- Ensure LaunchServices database is not corrupted
Database Corruption
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain local -domain system -domain user
References