Apple’s Xcode Under Attack by Hackers Planting Malware
Table of Contents
- By Dawna M. Roberts
- Published: Mar 29, 2021
- Last Updated: Mar 18, 2022
Nefarious criminals are loading Xcode developer projects with malware designed to compromise the Xcode network targeting developers and researchers.
What is Happening?
On Thursday, security experts released a report about a new cyber threat where hackers are injecting malicious code into an Xcode project available on GitHub. The threat is called “XcodeSpy” and uses a common Xcode snippet available for download from GitHub called TabBarInteraction. Developers use the snippet to animate iOS tab bars during user interaction.
When a user downloads the tainted code, it installs a “custom variant of the EggShell backdoor on the developer’s macOS along with a persistence mechanism,” according to The Hacker News.
Because hackers are using Xcode to deliver the payload, threat researchers said that Apple developers are the only targets. However, they had seen something similar before when a North Korean group used “a Visual Studio project designed to load a malicious DLL on Windows systems.”
The malware exploits a feature of Apple’s IDE that allows developers to run a shell script when they launch an instance of the new project. Without knowing what to look for, a developer would be unaware that the malicious code was executed on their system.
More Technical Details of the Attack
According to The Hacker News, “Besides including the original code, XcodeSpy also contains an obfuscated Run Script that’s executed when the developer’s build target is launched. The script then contacts an attacker-controlled server to retrieve a custom variant of the EggShell backdoor on the development machine, which comes with capabilities to record information from the victim’s microphone, camera, and keyboard.”
Threat researchers found two variants of the malicious EggShell payload so far, targeting Asian developers. These findings are on the heels of hackers “previously resorting to tainting Xcode executables (aka XCodeGhost) to inject malicious code into iOS apps compiled with the infected Xcode without the developers’ knowledge, and subsequently, use the infected apps to collect information from the devices once they are downloaded and installed from the App Store.
Trend Micro found similar threats in August 2020 that installed a mac malware dubbed XCSSET that has the capabilities to steal passwords, capture screenshots, grab other credentials, and steal private information from messages, notes, and other apps. This particular threat had a ransomware component and could encrypt files and demand a ransom to unlock them.
What is Xcode?
Xcode is Apple’s integrated development environment (IDE) and a proprietary developer tool for building apps that work on macOS, iOS, iPadOS, tvOS, and WatchOS. The downloadable app is a visual coding tool that makes it easy for new and veteran developers to create apps quickly and easily.
Xcode first came out in 2003 and has been steadily improved with new releases leading up to the latest, which was January 26, 2021, version 12.4. Users can download all previous releases. Although Xcode uses a visual environment, it also includes Command Line Tools (CLT) to mimic the UNIX-style environment. The tool supports many different programming languages, including:
- C, C++.
- Objective-C.
- Objective-C++.
- Java.
- AppleScript.
- Python.
- Ruby.
- ResEdit (Rez).
- Swift.
How Can Developers Stay Safe?
A few tips to keep Apple developers safe are:
- Only download Xcode files and samples from trusted sources.
- Run all downloads through an antivirus/anti-malware scanner.
- Run all your scripts on a clean machine (from a CD rather than the hard drive).
- Keep good backups in the event that you are hacked or malware infected.