Credentials from Password Stores: Keychain

Adversaries may acquire credentials from Keychain. Keychain (or Keychain Services) is the macOS credential management system that stores account names, passwords, private keys, certificates, sensitive application data, payment data, and secure notes. There are three types of Keychains: Login Keychain, System Keychain, and Local Items (iCloud) Keychain. The default Keychain is the Login Keychain, which stores user passwords and information. The System Keychain stores items accessed by the operating system, such as items shared among users on a host. The Local Items (iCloud) Keychain is used for items synced with Apple’s iCloud service.

Keychains can be viewed and edited through the Keychain Access application or using the command-line utility security. Keychain files are located in ~/Library/Keychains/, /Library/Keychains/, and /Network/Library/Keychains/.[1][2][3]

Adversaries may gather user credentials from Keychain storage/memory. For example, the command security dump-keychain –d will dump all Login Keychain credentials from ~/Library/Keychains/login.keychain-db. Adversaries may also directly read Login Keychain credentials from the ~/Library/Keychains/login.keychain file. Both methods require a password, where the default password for the Login Keychain is the current user’s password to login to the macOS host.[4][5]

ID: T1555.001
Sub-technique of:  T1555
Platforms: macOS
Version: 1.1
Created: 12 February 2020
Last Modified: 15 October 2024

Procedure Examples

ID Name Description
S0274 Calisto

Calisto collects Keychain storage data and copies those passwords/tokens to a file.[6][7]

S1153 Cuckoo Stealer

Cuckoo Stealer can capture files from a targeted user's keychain directory.[8]

S0690 Green Lambert

Green Lambert can use Keychain Services API functions to find and collect passwords, such as SecKeychainFindInternetPassword and SecKeychainItemCopyAttributesAndData.[9][10]

S0278 iKitten

iKitten collects the keychains on the system.[11]

S0349 LaZagne

LaZagne can obtain credentials from macOS Keychains.[12]

S1016 MacMa

MacMa can dump credentials from the macOS keychain.[13]

S0279 Proton

Proton gathers credentials in files for keychains.[11]

Mitigations

ID Mitigation Description
M1027 Password Policies

The password for the user's login keychain can be changed from the user's login password. This increases the complexity for an adversary because they need to know an additional password.

Detection

ID Data Source Data Component Detects
DS0017 Command Command Execution

Monitor executed commands with arguments that may be used to collect Keychain data from a system to acquire credentials.

Analytic 1 - Commands indicating credential searches in Keychain.

index=security sourcetype="macos_secure"(event_type="process" AND (command IN ("security dump-keychain", "security find-generic-password", "security find-internet-password", "security unlock-keychain") OR command IN ("security dump-keychain", "security find-generic-password", "security find-internet-password", "security unlock-keychain")))

DS0022 File File Access

Monitor for Keychain files being accessed that may be related to malicious credential collection.

Analytic 1 - Unauthorized access to Keychain files.

index=security sourcetype="macos_secure"(event_type="file_open" AND file_path IN ("~/Library/Keychains/", "/Library/Keychains/", "/Network/Library/Keychains/*"))

DS0009 Process OS API Execution

Monitor for Keychain Services API calls, specifically legacy extensions such as SecKeychainFindInternetPassword, that may collect Keychain data from a system to acquire credentials.[14]

Analytic 1 - Suspicious Keychain API calls.

index=security sourcetype="macos_secure"(event_type="api_call" AND api IN ("SecKeychainCopySearchList", "SecKeychainFindGenericPassword", "SecKeychainFindInternetPassword", "SecKeychainOpen", "SecKeychainCopyDefault", "SecItemCopyMatching"))

Process Creation

Monitor processes spawned by command line utilities to manipulate keychains directly, such as security, combined with arguments to collect passwords, such as dump-keychain -d.

Analytic 1 - New processes with parameters indicating attempts to manipulate keychains.

index=security sourcetype="macos_secure" event_type="process"(CommandLine IN ("security dump-keychain", "security find-generic-password", "security find-internet-password", "security unlock-keychain", "security delete-keychain", "security set-keychain-settings", "security add-internet-password", "security add-generic-password", "security import", "security export"))

References