Mac Keychain Hack



Keychain has a number of excellent features, but it's not as easy to invoke nor as diverse as 1Password, LastPass, and other third-party password ecosystems.

A software developer has released an open-source app for the Mac that, when run with administrator privileges, dumps all the passwords belonging to other people currently logged on to the machine.

Within hours of the release of Keychaindump by Helsinki-based Juuso Salonen, other Mac experts were downplaying its significance. 'News flash, root can also format your hard drive, news at 11,' OS X serial hacker Charlie Miller wrote on Twitter, referring to the 'root' account that by definition has unfettered privileges in operating systems. 'Root is totally a dick, he stole my prom date in high school!' another exploit developer known as thegrugq responded.

  1. As for how the malware could get onto the Mac in the first place, a malicious hacker could hide the keychain exploit in a legitimate app, Henze hypothesized. Or a user could be directed to a.
  2. A video showing the hack in action follows below: Tags: Apple, High Sierra, MacOS Chris Smith started writing about gadgets as a hobby, and before he knew it he was sharing his views on tech.
  3. Mar 16, 2020 I found the problem emanated from my Mac and iCloud Keychain. On your Mac log in to Keychain and look for any multiple entries with the same login credentials. Once located, delete the duplicate(s) and restart your Mac. Then try your iDevice again; Try a full restore to stop the hourly prompt for your Apple ID/iCloud password.

Their point is that the Keychaindump's ability to root out passwords isn't a vulnerability or even an oversight by Apple engineers. It's a necessary design with parallels that can be found in any advanced operating system, including Microsoft Windows and various distributions of Linux. Labeling it as a 'bug' or a 'vulnerability' is like claiming a meat slicer is flawed because it can saw through the finger of the person using it.

That said, Salonen's software and an accompanying blog post appear to be the first time anyone has documented the inner workings of the widely used Mac Keychain and released attack code built on those findings. Salonen says his app is 'far from perfect,' but he also says it 'seems to work well' at scouring the internal memory of Macs for the passcodes all currently logged-in account owners enter to access passwords stored on their personal keychains. And that includes the passcode for the root user.

'If I'm writing a virus, I will use this code,' said Rob Graham, who as CEO of penetration testing firm Errata Security regularly writes software exploits to test the security of his clients. 'We've always known it's possible. It's just a matter of someone actually writing code for that part of the keychain.'

One application for such code would be for malware writers who want to collect as much information as possible on the people using a targeted Mac. By dumping the entire contents of a user's keychain, the passwords for virtually every WiFi network, e-mail account, and website account are quickly in the hands of the attacker. With the rise of the Flashback malware that infected an estimated 650,000 Macs or new strains of Mac-based espionage trojans targeting Chinese dissidents, it's not hard to imagine code like Salonen's being employed to give them powerful new capabilities.

Advertisement Mac

What's more, the password extraction method is significantly faster than attempting to brute-force crack a strong account password. That's because OS X stores account passwords using the PBK2F2 key derivation function, which, as Ars recently explained, was designed to thwart cracking attacks by requiring large amounts of time and computing resources to convert plaintext into cryptographic hashes.

'Encrypted many times over,' in 'Russian-doll fashion'

According to Salonen, keychain files are 'encrypted many times over' in a fashion similar to the way one Russian doll fits inside the next. The OS X system uses a variety of keys, including one derived from the account password belonging to the user who owns the password keychain. Once a user has unlocked that list, the password is converted into a 24-byte master key and stored in a part of computer memory reserved for a security process known as 'securityd.' With a little more research, the developer found a common structure in this memory region that points to the master key. It contains an 8-byte size field with the value of '0x18 (24 in hex).'

Keychaindump uses what's known as pattern recognition to search for the pointer and then test the following value to see if it's a master key. A Master key will reveal an intermediate key called a 'wrapping key.' Using a hard-coded 'obfuscation key,' the wrapping key in turn reveals an encrypted 'credential key,' which, at last, reveals the user's plaintext password. Salonen credited fellow developer Matt Johnston for the research into the decryption steps.

Running the code produced the following output, where actual passwords and usernames were replaced with x's:

As we made clear earlier in this post, there's no vulnerability here. Aside from following longstanding security advice to use lower-privileged accounts whenever possible and log out of those accounts when they're not in use, there's not much anyone can do to prevent these types of attacks. Update: Salonen points out in his blog post users can take additional steps to lock and unlock their keychain; Apple has more here.

Local

Mac Keychain Hack Password

None of this, however, means Salonen's app, which runs on OS X Lion and Mountain Lion, isn't of value, either to black-hat hackers or the white-hats who work to stop them.

How To Use Mac Keychain

Post updated to add sentence about locking and unlocking keychain.