Update: XcodeGhost Attacker Can Phish Passwords and Open URLs through Infected Apps

On Thursday we posted the initial analysis report on XcodeGhost malware and then found ithad infected 39 iOS apps, potentially impacting hundreds of millions of users. XcodeGhost embedded malicious code into those infected iOS apps. In the first report, we noted that the malicious code uploads device information and app information to its command and control (C2) server. But that isn’t all it does.

Today, inspired by a post by@Saic” on Sina Weibo, we analyzed the malicious code in more detail and found additional capabilities in the malware.  In summary, the malicious code that XcodeGhost embedded into infected iOS apps is capable of receiving commands from the attacker through the C2 server to perform the following actions:

  • Prompt a fake alert dialog to phish user credentials;
  • Hijack opening specific URLs based on their scheme, which could allow for exploitation of vulnerabilities in the iOS system or other iOS apps;
  • Read and write data in the user’s clipboard, which could be used to read the user’s password if that password is copied from a password management tool.

Additionally, according to one developer’s report, XcodeGhost has already launched phishing attacks to prompt a dialog asking victims to input their iCloud passwords.

Based on this new information, we believe XcodeGhost is a very harmful and dangerous malware that has bypassed Apple’s code review and made unprecedented attacks on the iOS ecosystem. The techniques used in this attack could be adopted by criminal and espionage focused groups to gain access to iOS devices.

Technical Details

XcodeGhost added code to some system APIs that are used by the infected apps. After the malware sends device and app information to it’s C2 servers, XcodeGhost will decrypt the content returned by the server and parse it as a piece of JSON formatted data.

Figure 1. XcodeGhost decrypts response JSON data

In the JSON data, XcodeGhost will look for these keys:

  • alertHeader
  • alertBody
  • appID
  • cancelTitle
  • confirmTitle

The malware uses the specified title and body texts to create a fake alert dialogue box.. Using this technique, XcodeGhost can be used to “phish” information from the user, or trick them into inputting sensitive data. For example, it can create a dialog that asks the victim to input their password. Since the dialog is a prompt from the running application, the victim may trust it and input a password without suspecting foul play.

Figure 2. XcodeGhost prompts a alert dialog with specific title and message text

If the returned JSON data from the server contains the key “url”, XcodeGhost will open the URL specified.

Figure 3. XcodeGhost opens remotely specified URL

Note that the specified URL doesn’t have to be only HTTP or FTP URLs but also the URLs used by iOS system with any scheme that local system can handle. (i.e. itunes:// or twitter://) The URL scheme is one of the main Inter-App Communication mechanisms in iOS system. Any iOS apps, include system apps, can define any scheme it can handle. Multiple previous vulnerabilities in iOS and various iOS apps have been caused by scheme handling flaws that can be exploited by opening specific URLs. These vulnerabilities must be exploited locally by a malicious app, which led many people to not treat them as serious as iOS malware is uncommon. XcodeGhost has broken this assumption by infecting many popular iOS apps that are widely used.

Finally, XcodeGhost will also use the clipboard functionality provided by iOS to temporarily store some data it needs. In fact, every time an infected app is launched, XcodeGhost will retrieve persistently stored data from the clipboard with a paste board named by app’s bundle ID and a fixed string “UIPasteBoard”, then store new data inside it. Although this behavior is not harmful to users, a slightly code change would allow the same technique to steal passwords from password management apps such as 1Password.

When people use apps like 1Password to manage their passwords in iOS, they often open 1Password, copy the stored password to system clipboard, then open the app they want to use and paste the password to the login window. At this moment, a malicious app can directly read the password from system clipboard. 1Password’s main security design for this situation is that, the password stored in the clipboard will only stay there for a very short time. However, since the malware can read it when the app launches, the attack can be successful.

Attack in the Wild

Earlier today on a popular Chinese forum V2EX, a user “realpg” mentioned his experience when developing iOS apps using the malicious Xcode package. His write-up disclosed that XcodeGhost’s attacker has used the malware to phish victims’ iCloud passwords.

In the discussion, “realpg” said that when they were developing a very simple iOS app that had no Internet functionality and didn’t use any iCloud APIs, the app would frequently display a dialog to ask the developer to input his iCloud password. They tested the app in their special testing iPhone without jailbreak.  Then they tried to capture the network traffic and found the exactly the same C2 domain name used by XcodeGhost infected apps.

Based on “realpg”’s account of the events, we believe that stealing passwords or potentially exploiting vulnerabilities in iOS and in legitimate applications may be the true purpose of XcodeGhost.

Acknowledgement

Thanks to Luyi Xing from Indiana University for providing knowledge about password management tools. Also, many thanks to @Saic on Sina Weibo for identifying potential behaviors in XcodeGhost.

[Palo Alto Networks Blog]

Malware XcodeGhost Infects 39 iOS Apps, Including WeChat, Affecting Hundreds of Millions of Users

Yesterday we posted an analysis report on a novel malware XcodeGhost that modifies Xcode IDE to infect Apple iOS apps. In the report, we mentioned that at least two popular iOS apps were infected. We now believe many more popular iOS apps have been infected, including WeChat, one of the most popular IM applications in the world.

After we posted the report, some security companies like Qihoo 360 scanned popular apps in App Store by code analysis; and some iOS developers analyzed some more apps using crowd-sourcing techniques. Several Internet companies such as Tencent, NetEase, and Jianshu, have made statements on their respective affected products..

We checked these apps and list them below in this report. As of this writing, we see 39 iOS apps being infected, some of which are extremely popular in China and in other countries around the world, comprising hundreds of millions users.

The infected iOS apps include IMs, banking apps, mobile carrier’s app, maps, stock trading apps, SNS apps, and games. Among the more well-known apps are WeChat (developed by Tencent); Didi Chuxing (developed by Didi Kuaidi) the most popular Uber-like app in China;Railway 12306, the only official app used for purchasing train tickets in China; China Unicom Mobile Office, which is in use by the biggest mobile carrier in China; and Tonghuashun, one of most popular stock trading apps.

Figure 1. WeChat 6.2.5 is also infected

Some apps are also available from the App Store in other countries. For example, CamCard, developed by a Chinese company, is the most popular business card reader and scanner in many countries (including the US) around the world. WeChat is the most popular IM app not only in China but also in many countries or regions in Asia Pacific. Version 6.2.5 of WeChat is what we have verified to be infected. Tencent has updated to 6.2.6, which removed the malicious code.

Palo Alto Networks is cooperating with Apple on the issue and we also suggest all iOS developers be aware and take necessary actions.

Infected iOS apps

网易云音乐  2.8.3

微信  6.2.5

讯飞输入法  5.1.1463

滴滴出行  4.0.0.6-4.0.0.0

滴滴打车  3.9.7.1 – 3.9.7

铁路12306  4.5

下厨房  4.3.2

51卡保险箱  5.0.1

中信银行动卡空间  3.3.12

中国联通手机营业厅  3.2

高德地图  7.3.8

简书  2.9.1

开眼  1.8.0

Lifesmart  1.0.44

网易公开课  4.2.8

马拉马拉  1.1.0

药给力  1.12.1

喜马拉雅  4.3.8

口袋记账  1.6.0

同花顺  9.60.01

快速问医生  7.73

懒人周末

微博相机

豆瓣阅读

CamScanner

CamCard

SegmentFault  2.8

炒股公开课

股市热点

新三板

滴滴司机

OPlayer  2.1.05

电话归属地助手  3.6.5

愤怒的小鸟2 2.1.1

夫妻床头话  1.2

穷游  6.6.6

我叫MT  5.0.1

我叫MT 2  1.10.5

自由之战  1.1.0

Fox-IT (fox-it.com), a Netherlands based security company, checked all C2 domain names from our reports in their network sensors and has found thousands of malicious traffic outside China. According to their data, these iOS apps were also infected:

Mercury

WinZip

Perfect365

Musical.ly

PDFReader

guaji_gangtai en

PDFReader Free

WhiteTile

IHexin

WinZip Standard

MoreLikers2

CamScanner Lite

MobileTicket

iVMS-4500

golfsense

QYER

[Palo Alto Networks Blog]

Watch: Secure Saas Applications with Aperture

In this video, Lee Klarich, senior vice president, product management, talks about our new offering, Aperture, which extends the visibility and granular control of our next-generation security platform further into SaaS applications.

For more on Aperture

[Palo Alto Networks Blog]

English
Exit mobile version