New Mac backdoor program steals keychain contents

The Keydnap malware uses creative ways to infect computers and gain root access

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.

Dubbed OSX/Keydnap by researchers from antivirus vendor ESET, this is the second backdoor program targeting Macs found by antivirus firms in the past few days.

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 CSO newsletter!

Error: Please check your email address.

More about ESETMacs

Show Comments

Featured Whitepapers

Editor's Recommendations

Solution Centres

Stories by Lucian Constantin

Latest Videos

  • 150x50

    CSO Webinar: Will your data protection strategy be enough when disaster strikes?

    Speakers: - Paul O’Connor, Engagement leader - Performance Audit Group, Victorian Auditor-General’s Office (VAGO) - Nigel Phair, Managing Director, Centre for Internet Safety - Joshua Stenhouse, Technical Evangelist, Zerto - Anthony Caruana, CSO MC & Moderator

    Play Video

  • 150x50

    CSO Webinar: The Human Factor - Your people are your biggest security weakness

    ​Speakers: David Lacey, Researcher and former CISO Royal Mail David Turner - Global Risk Management Expert Mark Guntrip - Group Manager, Email Protection, Proofpoint

    Play Video

  • 150x50

    CSO Webinar: Current ransomware defences are failing – but machine learning can drive a more proactive solution

    Speakers • Ty Miller, Director, Threat Intelligence • Mark Gregory, Leader, Network Engineering Research Group, RMIT • Jeff Lanza, Retired FBI Agent (USA) • Andy Solterbeck, VP Asia Pacific, Cylance • David Braue, CSO MC/Moderator What to expect: ​Hear from industry experts on the local and global ransomware threat landscape. Explore a new approach to dealing with ransomware using machine-learning techniques and by thinking about the problem in a fundamentally different way. Apply techniques for gathering insight into ransomware behaviour and find out what elements must go into a truly effective ransomware defence. Get a first-hand look at how ransomware actually works in practice, and how machine-learning techniques can pick up on its activities long before your employees do.

    Play Video

  • 150x50

    CSO Webinar: Get real about metadata to avoid a false sense of security

    Speakers: • Anthony Caruana – CSO MC and moderator • Ian Farquhar, Worldwide Virtual Security Team Lead, Gigamon • John Lindsay, Former CTO, iiNet • Skeeve Stevens, Futurist, Future Sumo • David Vaile - Vice chair of APF, Co-Convenor of the Cyberspace Law And Policy Community, UNSW Law Faculty This webinar covers: - A 101 on metadata - what it is and how to use it - Insight into a typical attack, what happens and what we would find when looking into the metadata - How to collect metadata, use this to detect attacks and get greater insight into how you can use this to protect your organisation - Learn how much raw data and metadata to retain and how long for - Get a reality check on how you're using your metadata and if this is enough to secure your organisation

    Play Video

  • 150x50

    CSO Webinar: How banking trojans work and how you can stop them

    CSO Webinar: How banking trojans work and how you can stop them Featuring: • John Baird, Director of Global Technology Production, Deutsche Bank • Samantha Macleod, GM Cyber Security, ME Bank • Sherrod DeGrippo, Director of Emerging Threats, Proofpoint (USA)

    Play Video

More videos

Blog Posts

Market Place