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 PC World newsletter!

Error: Please check your email address.
Rocket to Success - Your 10 Tips for Smarter ERP System Selection
Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Lucian Constantin

IDG News Service
Show Comments

Most Popular Reviews

Latest Articles

Resources

PCW Evaluation Team

Matthew Stivala

HP OfficeJet 250 Mobile Printer

The HP OfficeJet 250 Mobile Printer is a great device that fits perfectly into my fast paced and mobile lifestyle. My first impression of the printer itself was how incredibly compact and sleek the device was.

Armand Abogado

HP OfficeJet 250 Mobile Printer

Wireless printing from my iPhone was also a handy feature, the whole experience was quick and seamless with no setup requirements - accessed through the default iOS printing menu options.

Azadeh Williams

HP OfficeJet Pro 8730

A smarter way to print for busy small business owners, combining speedy printing with scanning and copying, making it easier to produce high quality documents and images at a touch of a button.

Andrew Grant

HP OfficeJet Pro 8730

I've had a multifunction printer in the office going on 10 years now. It was a neat bit of kit back in the day -- print, copy, scan, fax -- when printing over WiFi felt a bit like magic. It’s seen better days though and an upgrade’s well overdue. This HP OfficeJet Pro 8730 looks like it ticks all the same boxes: print, copy, scan, and fax. (Really? Does anyone fax anything any more? I guess it's good to know the facility’s there, just in case.) Printing over WiFi is more-or- less standard these days.

Ed Dawson

HP OfficeJet Pro 8730

As a freelance writer who is always on the go, I like my technology to be both efficient and effective so I can do my job well. The HP OfficeJet Pro 8730 Inkjet Printer ticks all the boxes in terms of form factor, performance and user interface.

Michael Hargreaves

Windows 10 for Business / Dell XPS 13

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?