Securityd Memory
An adversary with root access may gather credentials by reading securityd's memory. securityd is a macOS service/daemon responsible for implementing security protocols such as encryption and authorization. A privileged adversary may scan through securityd's memory to find the correct sequence of keys to decrypt the user's logon keychain, yielding various plaintext passwords including user accounts, WiFi, mail, browsers, certificates, and secure notes. In OS X prior to El Capitan, users with root access could read plaintext keychain passwords of logged-in users because Apple's keychain implementation cached these credentials in securityd memory.
let SuspiciousProcesses = dynamic(["keychaindump", "chainbreaker", "keychain-dumper", "kcpassword"]);
let MemoryAccessPatterns = dynamic(["securityd", "vmmap securityd", "lldb -p", "dtrace -p", "heap securityd", "sample securityd"]);
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName has_any (SuspiciousProcesses)
or ProcessCommandLine has_any (SuspiciousProcesses)
or ProcessCommandLine has_any (MemoryAccessPatterns)
or (FileName in~ ("vmmap", "lldb", "dtrace", "heap", "sample", "leaks") and ProcessCommandLine has "securityd")
| extend MemoryDumpTool = FileName has_any ("vmmap", "lldb", "dtrace", "heap", "sample", "leaks")
| extend KeychainDumpTool = FileName has_any (SuspiciousProcesses) or ProcessCommandLine has_any (SuspiciousProcesses)
| project Timestamp, DeviceName, AccountName, FileName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine,
MemoryDumpTool, KeychainDumpTool
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- Apple engineers or macOS kernel developers debugging securityd during development
- Security researchers analyzing securityd behavior in controlled lab environments
- macOS diagnostic tools automatically sampling securityd during crash reporting
References (6)
- https://attack.mitre.org/techniques/T1555/002/
- https://web.archive.org/web/20130106164109/https://juusosalonen.com/post/30923743427/breaking-into-the-os-x-keychain
- https://developer.apple.com/library/archive/documentation/Security/Conceptual/Security_Overview/Architecture/Architecture.html
- https://www.welivesecurity.com/2016/07/06/new-osxkeydnap-malware-hungry-credentials/
- https://www.slideshare.net/slideshow/external-to-da-the-os-x-way/62021418
- https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1555.002/T1555.002.md
Unlock Pro Content
Get the full detection package for T1555.002 including response playbook, investigation guide, and atomic red team tests.