Technical details
Download and installation
OSX.Keydnap is initially downloaded as a Zip archive. This archive contains a singleEstablishing the backdoor connection
Since the downloader is not persistent, the downloaded backdoor component spawns a process named "icloudsyncd" that runs at all times. It also adds an entry to the LaunchAgents directory to survive reboots. The icloudsyncd process is used to communicate with a command & control server via an onion.to address, establishing the backdoor. It then attempts to capture passwords from the iCloud Keychain, using the proof-of-concept Keychaindump, and transmits them back to the server. Keychaindump reads securityd’s memory and searches for the decryption key for the user’s keychain as described in “Keychain Analysis with Mac OS X Memory Forensics” by K. Lee and H. Koo.{{Cite web, url=https://forensic.n0fate.com/wp-content/uploads/2012/07/Keychain-Analysis-with-Mac-OS-X-Memory-Forensics.pdf, title=Keychain Analysis with Mac OS X Memory Forensics, last=Lee, first=Kyeongsik, last2=Koo, first2=Hyungjoon, date=2012-07-01, website=forensic.n0fate.com, publisher=, access-date=2016-12-02Gatekeeper signing workaround
Mac OS uses Gatekeeper to verify if an application is signed with a valid Apple Developer ID certificate preventing OSX.Keydnap from running. Further, even if the user does have Gatekeeper turned off, they will see a warning that the file is an application downloaded from the Internet giving the user an option to not execute the application. However, by packing OSX.Keydnap with a legitimate signing key as in the case of the compromised Transmission app, it successfully bypasses Gatekeeper protection.Detection and removal
Activating Gatekeeper is an easy way to prevent accidental installation of OSX.Keydnap. If the user's Mac has Gatekeeper activated, the malicious file will not be executed and a warning will be displayed to the user. This is because the malicious Mach-O file is unsigned, which automatically triggers a warning in Gatekeeper.References