Tool allows Mac OS X hackers with root access to easily extract keychain data

Developer creates tool to easily decrypt the keychain data of local Mac OS X users from the root account

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.

However, the tool can just as well be incorporated in malware, since its source code is freely available online.

Mac malware running as root is not an uncommon occurrence, Lysa Myers, virus hunter at Mac antivirus vendor Intego, said Thursday via email. "The two most common ways to achieve root access is by way of exploits and social engineering. Social engineering being far and away the most common, as it's often fairly easy to trick someone."

Social engineering in this context consists of the malware program masquerading as a legitimate program and asking the user to grant it administrative access.

"I'm personally worried about how easy it is to gain root on a Mac," Salonen said. "Not because of vulnerabilities, but because you end up doing it all the time in day-to-day use."

"For example, I just browsed my /Applications folder, and noticed that a majority of my apps are owned by root," Salonen said. "Even non-critical stuff like IRC clients, video players, games, tiny helper apps, even the official Twitter client. Each of those installers had root access at some point. I don't remember explicitly giving Twitter root access. I just remember running a typical installer. It's scary."

Mac malware authors have already shown an interest in keychain data. "One threat called DevilRobber discovered last year used a script to harvest passwords," Myers said. "The main trick in that instance was that it would automatically validate the system dialog box that prompts the user to allow their keys to be exported."

There isn't much Apple can do to ultimately stop attackers with root access from stealing credentials stored in a user's keychain. However, there are some methods to make it a bit harder.

Apple could, for example, better obfuscate the keychain master password key in memory and make it harder for a tool like keychaindump to find it and extract it, Arnaud Abbati, a malware analyst at Intego, said Thursday.

Apple did not return a request for comment regarding its keychain design choices or the security implications of Salonen's tool.

Join the newsletter!

Or

Sign up to gain exclusive access to email subscriptions, event invitations, competitions, giveaways, and much more.

Membership is free, and your security and privacy remain protected. View our privacy policy before signing up.

Error: Please check your email address.
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.
Lucian Constantin

Lucian Constantin

IDG News Service
Show Comments

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Tom Pope

Dynabook Portégé X30L-G

Ultimately this laptop has achieved everything I would hope for in a laptop for work, while fitting that into a form factor and weight that is remarkable.

Tom Sellers

MSI P65

This smart laptop was enjoyable to use and great to work on – creating content was super simple.

Lolita Wang

MSI GT76

It really doesn’t get more “gaming laptop” than this.

Jack Jeffries

MSI GS75

As the Maserati or BMW of laptops, it would fit perfectly in the hands of a professional needing firepower under the hood, sophistication and class on the surface, and gaming prowess (sports mode if you will) in between.

Taylor Carr

MSI PS63

The MSI PS63 is an amazing laptop and I would definitely consider buying one in the future.

Christopher Low

Brother RJ-4230B

This small mobile printer is exactly what I need for invoicing and other jobs such as sending fellow tradesman details or step-by-step instructions that I can easily print off from my phone or the Web.

Featured Content

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?