September 07, 2012, 10:33 AM — A new tool allows Mac OS X attackers with root OS access to easily steal the keychain password data of logged in users and reinforces the dangers of granting administrative privileges to applications without serious consideration.
The tool is called keychaindump and was created by Finnish software developer Juuso Salonen, the author of the Radio Silence firewall for Mac OS X.
The Mac OS X keychain is a password management system designed to allow the storing and accessing of user passwords for various types of accounts and applications in a secure manner.
"The passwords in a keychain file are encrypted many times over with various different keys," Salonen said Wednesday in a blog post. "Some of these keys are encrypted using other keys stored in the same file, in a russian-doll fashion."
"The [master] key that can open the outermost doll and kickstart the whole decryption cascade is derived from the user's login password using PBKDF2 [a cryptographic key derivation function]," Salonen said Wednesday in a blog post.
Salonen's keychaindump uses pattern recognition techniques to scan the memory space of "securityd" -- the process that handles keychain operations in Mac OS X -- and locate the keychain master key.
Keychaindump doesn't exploit a vulnerability in Mac OS X or securityd. However, it takes advantage of Apple's design choice to automatically unlock users' keychains when they log into their accounts and store the corresponding master keys in memory for easier access.
This is not necessarily a bad design decision and implementing the keychain access mechanism in a different manner -- for example, by asking the user to input their keychain password every time when an application needs to access keychain data -- wouldn't have ultimately impacted the ability of attackers with root access to steal keychain data. After all, it's a well known fact that you can do pretty much anything on an operating system from the root (administrator) account.
"News flash, root can also format your hard drive, news at 11," renowned Apple hacker Charlie Miller said on Twitter when learning about Salonen's tool.
"What I described was not a security vulnerability in OS X, as it requires root access to begin with," Salonen said Thursday via email. "And, as most developers know, root can do *anything*."
What sets keychaindump apart from other possible root-level password stealing methods is the speed and ease with which it can achieve its goal.
Salonen hopes that the tool will be of use to authorized penetration testers who wish to quickly grab passwords in a post-system-compromise scenario.