Protect iMessage Database from Unauthorized Access
Restrict iMessage chat.db database access to Apple Messages processes only, blocking infostealers from harvesting private chat history on macOS.
Idea
All of your private iMessage history is stored in an SQLite database in ~/Library/Messages. Apple's TCC might block new applications from getting to it, but if you've already given an application full disk access permission, like your favorite terminal emulator, programs can just go and read it. Santa's file access rules make it easy to limit access to this directory.
Solutions
- Path Prefixes
- •
- •
- •
- Options
- Allow Read Access:Audit Only:Rule Type:
- Processes
- •Signing ID:
- •Signing ID:
- •Signing ID:
- •Signing ID:
- •Signing ID:
- •Signing ID:
- •Signing ID:
- •Signing ID:
- •Signing ID:
- •Signing ID:
- •Signing ID:
- •
- Custom Message
Mitre Attack
Tactics
Techniques
Tags
Deployment Notes
This rule is safe to deploy widely. It only restricts access to legitimate system processes that need access. Running sudo fs_usage -f filesys -w can show all processes that are able to read this directory.
Testing Instructions
- Deploy the rule
- Try: sqlite3 ~/Library/Messages/chat.db "SELECT * FROM message LIMIT 1"
- Verify Santa blocks the access
- Open Messages app and verify it works normally