/macos-preference-injection-hunting:macos-preference-injection-huntingfrom macos-preference-injection-hunting
Systematic methodology for finding NSUserDefaults preference injection vulnerabilities in macOS daemons. Use when: (1) auditing macOS daemon security, (2) hunting for debug/test preferences in production binaries, (3) assessing preference-based attack surface on macOS. Covers discovery via string scanning, validation via defaults write, and impact assessment. Found 7+ vulnerable daemons including sharingd (AirDrop), callservicesd (FaceTime), rapportd (Continuity), studentd (Classroom).
Ships in macos-preference-injection-hunting. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
macOS daemons frequently use NSUserDefaults (defaults read/write) for
configuration, including debug and test settings. These preferences are
stored in user-domain plist files (~/Library/Preferences/) writable by
any process running as the same UID. When daemons consume these preferences
for security-critical decisions without validation, any unprivileged process
can inject values that disable encryption, bypass authentication, suppress
quarantine, or enable forced screen observation.
Use this methodology when:
# List all running user-agent daemons
ps aux | grep -E "/usr/libexec/|/System/Library/" | awk '{print $NF}' | sort -u
# For each daemon binary, extract injectable-looking string constants
for bin in /usr/libexec/*; do
if [ -f "$bin" ] && [ -x "$bin" ]; then
hits=$(strings "$bin" 2>/dev/null | grep -cE \
"^(AlwaysAuto|DisableQuarantine|DisableTLS|DisableEncrypt|EnableDebug|EnableTest|EnableDemo|ForceAllow|BypassAuth|SkipValidat|OverrideSecur|DisableSandbox|ForceTrust|AllowUnsigned|TestMode|DebugMode|DemoMode|MockMode)")
if [ "$hits" -gt 0 ]; then
name=$(basename "$bin")
keys=$(strings "$bin" 2>/dev/null | grep -E \
"^(AlwaysAuto|Disable|Enable|Force|Bypass|Skip|Override|Mock|Fake|Test|Debug|Demo|Allow|pretend)" \
| sort -u | tr '\n' ', ')
echo "$name ($hits): $keys"
fi
fi
done
# Find what pref domain a daemon reads
strings /path/to/daemon 2>/dev/null | grep "^com\.apple\." | sort -u
# Or check if the daemon has a readable domain already
defaults read com.apple.DAEMONNAME 2>/dev/null
# Test if we can write to the preference domain
defaults write com.apple.DOMAIN testkey testval
echo "Write: $?"
defaults delete com.apple.DOMAIN testkey
# Write a dangerous key and verify it takes
defaults write com.apple.sharing DisableQuarantine -bool true
defaults read com.apple.sharing DisableQuarantine
# Clean up immediately
defaults delete com.apple.sharing DisableQuarantine
For each injectable key, determine:
codesign -d --entitlements -)lsof -i -P -n | grep daemonname)Map the full attack:
| Pattern | What It Usually Controls |
|---|---|
Disable* | Security feature toggle (TLS, encryption, quarantine, sandbox) |
Enable*Mode | Debug/test/demo mode activation |
Force* | Override security decisions |
Bypass* | Skip authentication or validation |
Allow* | Permit normally-blocked operations |
pretend* | Fake security state (bypass time/state checks) |
Mock* | Inject simulated data |
Skip* | Skip security checks |
Override* | Override security policies |
*TestMode* | Activate test infrastructure |
*Password | Plaintext credential storage in prefs |
| Daemon | Domain | Critical Keys | Impact |
|---|---|---|---|
| sharingd | com.apple.sharing | AlwaysAutoAccept, DisableQuarantine, DisableContinuityTLS | Silent AirDrop RCE chain |
| callservicesd | com.apple.TelephonyUtilities | disableFaceTimeKeyExchange, DisableBlastdoorValidationPrompt | FaceTime E2E disable |
| studentd | com.apple.classroom | forceUnpromptedRemoteScreenObservation, allowClassroom* | Forced screen observation |
| rapportd | com.apple.rapport | allowUnauthenticated, ForceL2CAP | Accept unauthenticated connections |
| securityuploadd | com.apple.securityuploadd | allowInsecureSplunkCert, disableUploads | Disable security telemetry |
| gamed | com.apple.gamed | BypassAuthentication | GameCenter auth bypass |
| intelligenceflowd | com.apple.intelligenceflow | agenticPlannerZincUrl, disableToolBoxAllowList | Redirect AI inference |
After finding an injectable preference:
Use airdrop-observatory --security --headless to monitor preference changes in real-time.
com.apple.classroom keys have per-device suffixes (use defaults read domain and grep)dyld_info -section __TEXT __cstring instead of stringsWhat SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub dmaynor/dmaynor-skills-marketplace --plugin macos-preference-injection-hunting