XcodeGhost

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

XcodeGhost (and variant XcodeGhost S) are a modified versions of Apple's Xcode development environment that are considered malware.[1] The software first gained widespread attention in September 2015, when a number of apps originating from China harbored the malicious code.[2] 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.[3] Over 4000 apps are infected, according to FireEye, far more than the 25 initially acknowledged by Apple,[4] 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 for 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.[5][6]

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".[7][8] The firm also identified a new variant of the malware and dubbed it XcodeGhost S, and among the apps that were infected were the popular messaging app WeChat and a Netease app Music 163.[9]

Discovery

On September 16, 2015, a Chinese iOS developer mentioned[10] on the social network Sina Weibo that a malware in Xcode injects third party code into apps compiled with it.

Alibaba researchers then published[11] detailed information on the malware and called it XcodeGhost.

On September 17, 2015, Palo Alto Networks published several reports on the malware.[12][13][14][15]

Operation

Propagation

Because of the slow download speed from Apple Servers, Chinese iOS developers used to download Xcode from third party website such as Baidu Yun, a cloud storage service hosted by Baidu, or get copies from co-workers. Attackers took advantage of this situation by distributing compromised version on such file hosting websites.[16]

File:Baidu Pan.png
Different versions of infected Xcode on Baidu Yun.

Palo Alto Networks suspects that the malware was available in March 2015.[15]

Attack vector

Origins

File:Strawhorse.png
Leaked document from Edward Snowden. "Strawhorse: Attacking the MacOS and iOS Software Development Kit".

The attacker used a compiler backdoor attack. The novelty of this attack is the modification of the Xcode compiler. However, according to Edward Snowden leaked documents, CIA security researcher from Sandia National Laboratories claimed that they "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.".[17]

Modified files

Known version of XcodeGhost adds extra files[12] 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

XcodeGhost also modified the linker to link the malicious files[15] into the compiled app. This step is reported on the compiling log but not on the Xcode IDE.

Both iOS and OS X apps are vulnerable to XcodeGhost.

Deployment

XcodeGhost compromised the CoreServices layer which contains highly used features and frameworks used by the app.[18] When a developer compiled his application with a compromised version of Xcode, the malicious CoreServices are automatically integrated into the app without the developer knowledge.

Then the malicious files will add extra code in UIWindow class and UIDevice class. The UIWindows class is "an object known as a window that manages and coordinates the views an app displays on a device screen".[19]

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.[20]

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 informations 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 :

  • http://init.crash-analytics.com
  • http://init.icloud-diagnostics.com
  • http://init.icloud-analysis.com

The last domain was also used in the iOS malware KeyRaider.[12]

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 capable 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[21] (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 website.

Prompting alert dialog

In his current known version XcodeGhost cannot prompt alert dialog on the user device.[15] 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.

Infected apps

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.

Pangu Team claimed that they counted 3,418 infected apps.[22]

Fox-it, a Netherland based security company reports that they found thousand of malicious traffic outside China.[23]

Removal

Neutralizing command and control servers and compromised versions of Xcode

Since the article of Alibaba and Palo Alto Networks, Amazon took down all the servers that were used by XcodeGhost. Baidu also removed all malicious Xcode installers from its cloud storage service.

Removing malicious apps from AppStore

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[24] 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.[25]

Checking Xcode version

Apple advises Xcode developers to verify[26][27] their version of Xcode and to always have GateKeeper activated on their machine.

References

  1. Lua error in package.lua at line 80: module 'strict' not found.
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. Lua error in package.lua at line 80: module 'strict' not found.
  4. https://www.fireeye.com/blog/executive-perspective/2015/09/protecting_our_custo.html
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. Lua error in package.lua at line 80: module 'strict' not found.
  7. Lua error in package.lua at line 80: module 'strict' not found.
  8. Lua error in package.lua at line 80: module 'strict' not found.
  9. Lua error in package.lua at line 80: module 'strict' not found.
  10. Lua error in package.lua at line 80: module 'strict' not found.
  11. Lua error in package.lua at line 80: module 'strict' not found.
  12. 12.0 12.1 12.2 Lua error in package.lua at line 80: module 'strict' not found.
  13. Lua error in package.lua at line 80: module 'strict' not found.
  14. Lua error in package.lua at line 80: module 'strict' not found.
  15. 15.0 15.1 15.2 15.3 Lua error in package.lua at line 80: module 'strict' not found.
  16. Lua error in package.lua at line 80: module 'strict' not found.
  17. Lua error in package.lua at line 80: module 'strict' not found.
  18. Lua error in package.lua at line 80: module 'strict' not found.
  19. Lua error in package.lua at line 80: module 'strict' not found.
  20. Lua error in package.lua at line 80: module 'strict' not found.
  21. Lua error in package.lua at line 80: module 'strict' not found.
  22. Lua error in package.lua at line 80: module 'strict' not found.
  23. Lua error in package.lua at line 80: module 'strict' not found.
  24. Lua error in package.lua at line 80: module 'strict' not found.
  25. http://www.macworld.co.uk/feature/iosapps/is-ipad-iphone-ios-safe-xcodeghost-what-security-software-need-3453938/#antivirus
  26. Lua error in package.lua at line 80: module 'strict' not found.
  27. Lua error in package.lua at line 80: module 'strict' not found.