XcodeGhost (and variant XcodeGhost S) are modified versions of Apple's Xcode development environment that are considered malware. The software first gained widespread attention in September 2015, when a number of apps originating from China harbored the malicious code. It was thought to be the "first large-scale attack on Apple's App Store", according to the BBC. The problems were first identified by researchers at Alibaba, a leading e-commerce firm in China. Over 4000 apps are infected, according to FireEye, far more than the 25 initially acknowledged by Apple, including apps from authors outside China.
Security firm Palo Alto Networks surmised that because network speeds were slower in China, developers in the country looked for local copies of the Apple Xcode development environment, and encountered altered versions that had been posted on domestic web sites. This opened the door for the malware to be inserted into high profile apps used on iOS devices.
Even two months after the initial reports, security firm FireEye reported that hundreds of enterprises were still using infected apps and that XcodeGhost remained "a persistent security risk". The firm also identified a new variant of the malware and dubbed it XcodeGhost S; among the apps that were infected were the popular messaging app WeChat and a Netease app Music 163.
- 1 Discovery
- 2 Operation
- 2.1 Propagation
- 2.2 Attack vector
- 2.3 Behavior on infected devices
- 2.4 Infected apps
- 3 Removal
- 4 References
Because of the slow download speed from Apple servers, Chinese iOS developers would download Xcode from third party websites, such as Baidu Yun (now called Baidu WangPan), a cloud storage service hosted by Baidu, or get copies from co-workers. Attackers took advantage of this situation by distributing compromised versions on such file hosting websites.
The attacker used a compiler backdoor attack. The novelty of this attack is the modification of the Xcode compiler. However, according to documents leaked by Edward Snowden, CIA security researchers from Sandia National Laboratories claimed that they "had created a modified version of Apple’s proprietary software development tool, Xcode, which could sneak surveillance backdoors into any apps or programs created using the tool."
Known versions of XcodeGhost add extra files to the original Xcode application:
- Core service framework on iOS, iOS simulator and OS X platforms
- IDEBundleInjection framework added on IOS, IOS simulator and OS X platforms
Both iOS and OS X apps are vulnerable to XcodeGhost.
XcodeGhost compromised the CoreServices layer, which contains highly used features and frameworks used by the app. When a developer compiles their application with a compromised version of Xcode, the malicious CoreServices are automatically integrated into the app without the developer's knowledge.
Then the malicious files will add extra code in UIWindow class and UIDevice class. The UIWindow class is "an object that manages and coordinates the views an app displays on a device screen".
The UIDevice class provides a singleton instance representing the current device. From this instance the attacker can obtain information about the device such as assigned name, device model, and operating-system name and version.
Behavior on infected devices
Remote control security risks
XcodeGhost can be remotely controlled via commands sent by an attacker from a Command and control server through HTTP. This data is encrypted using the DES algorithm in ECB mode. Not only is this encryption mode known to be weak, the encryption keys can also be found using reverse engineering. An attacker could perform a man in the middle attack and transmit fake HTTP traffic to the device (to open a dialog box or open specific app for example).
Stealing user device information
When the infected app is launched, either by using an iPhone or the simulator inside Xcode, XcodeGhost will automatically collect device information such as :
- Current time
- Current infected app's name
- The app's bundle identifier
- Current device's name and type
- Current system's language and country
- Current device's UUID
- Network type
Then the malware will encrypt those data and send it to a command and control server. The server differs from version to version of XcodeGhost; Palo Alto Networks was able to find three server URLs :
Read and write from clipboard
XcodeGhost is also able, each time an infected app is launched, to store the data written in the iOS clipboard. The malware is also able to modify this data. This can be particularly dangerous if the user uses a password management app.
Hijack opening specific URLs
XcodeGhost is also able to open specific URLs when the infected app is launched. Since Apple iOS and OS X work with Inter-App Communication URL mechanism (e.g. : 'whatsapp://', 'Facebook://', 'iTunes://'?), the attacker can open any apps installed on the compromised phone or computer (in case of an infected OS X app). Such mechanism could be harmful with password management apps or even on phishing websites.
Prompting alert dialog
In its current known version XcodeGhost cannot prompt alert dialogs on the user device. However, since it only requires to minor changes.
By using a UIAlertView class with the UIAlertViewStyleLoginAndPasswordInput property, the infected app can display a fake alert dialog box that looks like a normal Apple ID user credential check and send the input to the Command and control server.
Among all the Chinese apps, IMs app, banking apps, mobile carrier's app, maps, stock trading apps, SNS apps and games were infected. Popular apps used all over the world were also infected such as WeChat, a popular instant messaging app, CamScanner, an app to scan document using the smartphone camera or WinZip.
Fox-it, a Netherland-based security company reports that they found thousand of malicious traffic outside China.
Neutralizing command and control servers and compromised versions of Xcode
Removing malicious apps from the App Store
On September 18, 2015 Apple admitted the existence of the malware and began asking all developers with compromised apps to compile their apps with a clean version of Xcode before submitting them for review again.
Pangu Team released a tool to detect infected apps on a device, but like other antivirus apps it won't run on a device that hasn't been jailbroken. Apple does not allow antivirus apps into the iOS App Store.
Checking Xcode version
- Dan Goodin (September 21, 2015). "Apple scrambles after 40 malicious "XcodeGhost" apps haunt App Store". Ars Technica. Retrieved 2015-11-05.
- Joe Rossignol (September 20, 2015). "What You Need to Know About iOS Malware XcodeGhost". macrumors.com. Retrieved 2015-11-05.
- "Apple's App Store infected with XcodeGhost malware in China". BBC News. 2015-09-21. Retrieved 2016-09-22.
- "Apple's App Store infected with XcodeGhost malware in China". BBC News. 21 September 2015. Retrieved 2015-11-05.
- Byford, Sam (September 20, 2015). "Apple removes malware-infected App Store apps after major security breach". The Verge. Retrieved 2015-11-05.
- James Temperton (September 21, 2015). "Apple App Store hack: XcodeGhost attack strikes China (Wired UK)". Wired UK. Retrieved 2015-11-05.
- Kirk, Jeremy (November 4, 2015). "Many US enterprises still running XcodeGhost-infected Apple apps, FireEye says". InfoWorld. Retrieved 2015-11-05.
- Ben Lovejoy (November 4, 2015). "A modified version of XcodeGhost remains a threat as compromised apps found in 210 enterprises". 9to5Mac. Retrieved 2015-11-05.
- Yong Kang; Zhaofeng Chen; Raymond Wei (3 November 2015). "XcodeGhost S: A New Breed Hits the US". FireEye. Retrieved 2015-11-05.
XcodeGhost S: A New Breed Hits the US
- "First mention of XcodeGhost on SinaWeibo". Sina Weibo. September 17, 2015. Retrieved 2015-11-11.
- "Xcode编译器里有鬼 – XcodeGhost样本分析-安全漏洞-安全研究-阿里聚安全". jaq.alibaba.com. Retrieved 2015-11-11.
- Claud Xiao (September 17, 2015). "Novel Malware XcodeGhost Modifies Xcode, Infects Apple iOS Apps and Hits App Store - Palo Alto Networks Blog". Palo Alto Networks Blog. Retrieved 2015-11-11.
- Claud Xiao (September 18, 2015). "Malware XcodeGhost Infects 39 iOS Apps, Including WeChat, Affecting Hundreds of Millions of Users - Palo Alto Networks Blog". Palo Alto Networks Blog. Retrieved 2015-11-11.
- Claud Xiao (September 18, 2015). "Update: XcodeGhost Attacker Can Phish Passwords and Open URLs through Infected Apps - Palo Alto Networks Blog". Palo Alto Networks Blog. Retrieved 2015-11-11.
- Claud Xiao (September 21, 2015). "More Details on the XcodeGhost Malware and Affected iOS Apps - Palo Alto Networks Blog". Palo Alto Networks Blog. Retrieved 2015-11-11.
- Thomas Fox-Brewster (September 18, 2015). "Hackers Sneak Malware Into Apple App Store 'To Steal iCloud Passwords'". Forbes. Retrieved 2015-11-11.
- Jeremy Scahill; Josh Begley (March 10, 2015). "The CIA Campaign to Steal Apple's Secrets". The Intercept. Retrieved 2015-11-11.
- "Core Services Layer". developer.apple.com. Retrieved 2015-11-11.
- "UIWindow Class Reference". developer.apple.com. Retrieved 2015-11-11.
- "UIDevice Class Reference". developer.apple.com. Retrieved 2015-11-11.
- "Inter-App Communication". developer.apple.com. Retrieved 2015-11-11.
- "Pangu Team on Weibo". September 21, 2015. Retrieved 2015-11-11.
- "Combined research Fox-IT and Palo Alto Networks revealed popular apps infected with malware". Fox-it. September 18, 2015. Retrieved 2015-11-11.
- "Xcode病毒检测,XcodeGhost病毒检测 － 盘古越狱". x.pangu.io. Retrieved 2015-11-11.
- Haslam, Karen. "Why the iOS app XcodeGhost exploit shouldn't concern you". Macworld UK. Retrieved 2017-09-24.
- "有关 XcodeGhost 的问题和解答". Apple. Archived from the original on November 14, 2015. Retrieved June 17, 2016.
- "Validating Your Version of Xcode - News and Updates - Apple Developer". developer.apple.com. Retrieved 2015-11-11.