Researchers have identified a new Mac backdoor program that's designed to steal credentials stored in the OS-encrypted keychain and give attackers control over the system.
It's not clear how Keydnap is distributed, but it arrives on computers in the form of a zip archive. Inside there's an executable file with an apparently benign extension such as .txt or .jpg that actually has a space character at the end. The file also has an icon indicating an image or text file.
Opening this malicious file in Finder actually executes its code in the Terminal application. The execution happens really fast, with the Terminal window just flashing for a bit. The good news is that if the file is downloaded from the internet and the Gatekeeper security feature is turned on on the latest versions of OS X, the file won't be executed automatically and the user will see a security warning.
However, if the code is executed, it will download and install the backdoor component, called icloudsyncd, which connects to a command-and-control channel over the Tor anonymity network. If it has root access, this component also configures itself to start every time the Mac is rebooted.
The way it tries to obtain root access is also interesting. It will wait until the user runs a different application and it will immediately spawn a window asking for the user’s credentials, exactly like the window OS X users usually see when an application requires admin privileges.
The backdoor can receive commands from the control server to update itself, to download and execute files and scripts, to execute shell commands and to send back the output. It also includes a component that steals the contents of the OS X keychain.
This component seems to be based on open-source, proof-of-concept code published on GitHub. It reads the memory of the securityd OS X service, which handles the keychain access, and searches for the keychain decryption key. Once it has this key, it can exfiltrate user credentials stored inside.
While infecting Macs with malware is arguably more difficult than PCs, especially in the latest version of OS X with all the security features turned on, Keydnap shows that attackers can still come up with creative ways to trick users and exploit their habits.
Join the CIO New Zealand group on LinkedIn. The group is open to CIOs, IT Directors, COOs, CTOs and senior IT managers.