T1555.001

Credentials from Password Stores Keychain

Description from ATT&CK

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/.(Citation: Keychain Services Apple)(Citation: Keychain Decryption Passware)(Citation: OSX Keychain Schaumann)

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.(Citation: External to DA, the OS X Way)(Citation: Empire Keychain Decrypt)

Tests

Test #1 - Copy login keychain database

Copies the user's login keychain database to a staging directory using Finder. Stealers such as BANSHEE, Odyssey and Atomic collect login.keychain-db so the stored credentials can be decrypted offline once the account password is captured.

⚠️ TCC Required

Input Arguments:

ArgumentTypeDefault Value
destination_pathstr/tmp
tell application "Finder"
  set destinationFolderPath to POSIX file "/tmp"
  set keychainPath to (path to library folder from user domain as text) & "Keychains:login.keychain-db"
  duplicate file keychainPath to folder destinationFolderPath with replacing
end tell

Download Files

Download .scpt Download .swift Download Binary Download Application Bundle

References

On this page